Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
include docs/*.txt
include license.txt
graft .github
graft tests
graft paste/deploy/paster_templates

include docs/*.txt
include license.txt
include pytest.ini
include tox.ini
include rtd.txt
include pyproject.toml
include contributing.md

global-exclude __pycache__ *.py[cod]
global-exclude .DS_Store
8 changes: 4 additions & 4 deletions paste/deploy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def local_dict():
return result


class DispatchingConfig(object):
class DispatchingConfig:

"""
This is a configuration object that can be used globally,
Expand Down Expand Up @@ -135,7 +135,7 @@ def __setitem__(self, key, value):
CONFIG = DispatchingConfig()


class ConfigMiddleware(object):
class ConfigMiddleware:

"""
A WSGI middleware that adds a ``paste.config`` key to the request
Expand Down Expand Up @@ -194,7 +194,7 @@ def make_config_filter(app, global_conf, **local_conf):
make_config_middleware = ConfigMiddleware.__doc__


class PrefixMiddleware(object):
class PrefixMiddleware:
"""Translate a given prefix into a SCRIPT_NAME for the filtered
application.

Expand Down Expand Up @@ -277,7 +277,7 @@ def __call__(self, environ, start_response):
if self.force_port is not None:
host = environ.get('HTTP_HOST', '').split(':', 1)[0]
if self.force_port:
host = '%s:%s' % (host, self.force_port)
host = f'{host}:{self.force_port}'
environ['SERVER_PORT'] = str(self.force_port)
else:
if environ['wsgi.url_scheme'] == 'http':
Expand Down
14 changes: 7 additions & 7 deletions paste/deploy/loadwsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ def _interpolate(self, section, option, rawval, vars):
except Exception:
e = sys.exc_info()[1]
args = list(e.args)
args[0] = 'Error in file %s: %s' % (self.filename, e)
args[0] = f'Error in file {self.filename}: {e}'
e.args = tuple(args)
e.message = args[0]
raise

class InterpolateWrapper(object):
class InterpolateWrapper:
# Python >= 3.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a Python less than 3 branch here somewhere?

I'm on mobile!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, removed that code

def __init__(self, original):
self._original = original
Expand All @@ -102,7 +102,7 @@ def before_get(self, parser, section, option, value, defaults):
except Exception:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a really yucky way to reraise with a changed exception message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, not going to try to clean it up right now though :-)

e = sys.exc_info()[1]
args = list(e.args)
args[0] = 'Error in file %s: %s' % (parser.filename, e)
args[0] = f'Error in file {parser.filename}: {e}'
e.args = tuple(args)
e.message = args[0]
raise
Expand All @@ -113,7 +113,7 @@ def before_get(self, parser, section, option, value, defaults):
############################################################


class _ObjectType(object):
class _ObjectType:

name = None
egg_protocols = None
Expand All @@ -125,7 +125,7 @@ def __init__(self):
self.config_prefixes = [_aslist(p) for p in _aslist(self.config_prefixes)]

def __repr__(self):
return '<%s protocols=%r prefixes=%r>' % (
return '<{} protocols={!r} prefixes={!r}>'.format(
self.name, self.egg_protocols, self.config_prefixes)

def invoke(self, context):
Expand Down Expand Up @@ -349,7 +349,7 @@ def _loadfunc(object_type, uri, spec, name, relative_to,
############################################################


class _Loader(object):
class _Loader:

def get_app(self, name=None, global_conf=None):
return self.app_context(
Expand Down Expand Up @@ -694,7 +694,7 @@ def get_context(self, object_type, name=None, global_conf=None):
)


class LoaderContext(object):
class LoaderContext:

def __init__(self, obj, object_type, protocol,
global_conf, local_conf, loader,
Expand Down
2 changes: 1 addition & 1 deletion paste/deploy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def fix_type_error(exc_info, callable, varargs, kwargs):
kwargs = sorted(kwargs.items())
args += ', '.join(['%s=...' % n for n, v in kwargs])
gotspec = '(%s)' % args
msg = '%s; got %s, wanted %s' % (exc_info[1], gotspec, argspec)
msg = f'{exc_info[1]}; got {gotspec}, wanted {argspec}'
exc_info[1].args = (msg,)
return exc_info

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools >= 41"]
build-backend = "setuptools.build_meta"
70 changes: 68 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,68 @@
[wheel]
universal = true
[metadata]
name = PasteDeploy
version = 2.1.1
author = Ian Bicking
author_email = pylons-discuss@googlegroups.com
maintainer = Chris Dent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno, would have to find out if chris is around - going to leave it as is.

maintainer_email = pylons-discuss@googlegroups.com
license = MIT
description = Load, configure, and compose WSGI applications and servers
keywords =
web
wsgi
application
server
url = https://docs.pylonsproject.org/projects/pastedeploy/en/latest/
long_description = file: README.rst
long_description_content_type = text/x-rst
classifiers =
Development Status :: 6 - Mature
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content
Topic :: Internet :: WWW/HTTP :: WSGI
Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
Topic :: Software Development :: Libraries :: Python Modules
Framework :: Paste
project_urls =
Documentation = https://docs.pylonsproject.org/projects/pastedeploy/en/latest/
Changelog = https://docs.pylonsproject.org/projects/pastedeploy/en/latest/news.html
Issue Tracker = https://github.com/Pylons/pastedeploy/issues

[options]
packages = find:
zip_safe = False
install_requires =
setuptools
include_package_data = True
namespace_packages =
paste

[options.packages.find]
exclude =
tests

[options.extras_require]
config =
paste =
Paste
docs =
Sphinx >= 1.7.5
pylons-sphinx-themes

[options.entry_points]
paste.filter_app_factory =
config = paste.deploy.config:make_config_filter [Config]
prefix = paste.deploy.config:make_prefix_middleware

paste.paster_create_template =
paste_deploy = paste.deploy.paster_templates:PasteDeploy
69 changes: 2 additions & 67 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,68 +1,3 @@
import os
from setuptools import setup

from setuptools import setup, find_packages

here = os.path.dirname(__file__)
readme_path = os.path.join(here, "README.rst")
readme = open(readme_path).read()

docs_extras = [
"Sphinx >= 1.7.5", # Read The Docs minimum version
"pylons-sphinx-themes",
]

setup(
name="PasteDeploy",
version="3.0.dev0",
description="Load, configure, and compose WSGI applications and servers",
long_description=readme,
classifiers=[
"Development Status :: 6 - Mature",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware",
"Topic :: Software Development :: Libraries :: Python Modules",
"Framework :: Paste",
],
keywords="web wsgi application server",
author="Ian Bicking",
author_email="pylons-discuss@googlegroups.com",
maintainer="Chris Dent",
maintainer_email="pylons-discuss@googlegroups.com",
url="https://pylonsproject.org/",
project_urls={
"Documentation": "https://docs.pylonsproject.org/projects/pastedeploy/en/latest/",
"Changelog": "https://docs.pylonsproject.org/projects/pastedeploy/en/latest/news.html",
"Issue Tracker": "https://github.com/Pylons/pastedeploy/issues",
},
license="MIT",
namespace_packages=["paste"],
packages=find_packages(exclude=["tests"]),
include_package_data=True,
zip_safe=False,
install_requires=['setuptools'],
extras_require={
"Config": [],
"Paste": ["Paste"],
"docs": docs_extras,
},
entry_points="""
[paste.filter_app_factory]
config = paste.deploy.config:make_config_filter [Config]
prefix = paste.deploy.config:make_prefix_middleware

[paste.paster_create_template]
paste_deploy=paste.deploy.paster_templates:PasteDeploy
"""
)
setup()
4 changes: 2 additions & 2 deletions tests/fake_packages/FakeApp.egg/fakeapp/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def make_remote_addr(loader, global_conf, **conf):
dispatcher.map[addrs[name]] = apps[name]
return dispatcher

class RemoteAddrDispatch(object):
class RemoteAddrDispatch:
def __init__(self, map=None):
self.map = map or {}

Expand All @@ -53,7 +53,7 @@ def cap_filter(app):
return CapFilter(app, global_conf, method_to_call)
return cap_filter

class CapFilter(object):
class CapFilter:

def __init__(self, app, global_conf, method_to_call='upper'):
self.app = app
Expand Down
2 changes: 1 addition & 1 deletion tests/fake_packages/FakeApp.egg/fakeapp/configapps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class SimpleApp(object):
class SimpleApp:
def __init__(self, global_conf, local_conf, name):
self.global_conf = global_conf
self.local_conf = local_conf
Expand Down