diff options
| author | Michael Merickel <michael@merickel.org> | 2018-10-15 03:02:45 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2018-10-15 09:24:08 -0500 |
| commit | a54bc1ccac17625991e26eb5d4577f893803c683 (patch) | |
| tree | 304c696c105ca15bbe0f13d96c79524974de768b /src | |
| parent | 10ddb6f08592c2740b966e98a6f98a5b83af1896 (diff) | |
| download | pyramid-a54bc1ccac17625991e26eb5d4577f893803c683.tar.gz pyramid-a54bc1ccac17625991e26eb5d4577f893803c683.tar.bz2 pyramid-a54bc1ccac17625991e26eb5d4577f893803c683.zip | |
fix lint on src
Diffstat (limited to 'src')
| -rw-r--r-- | src/pyramid/authentication.py | 22 | ||||
| -rw-r--r-- | src/pyramid/config/__init__.py | 3 | ||||
| -rw-r--r-- | src/pyramid/config/routes.py | 16 | ||||
| -rw-r--r-- | src/pyramid/config/tweens.py | 2 | ||||
| -rw-r--r-- | src/pyramid/config/util.py | 6 | ||||
| -rw-r--r-- | src/pyramid/config/views.py | 39 | ||||
| -rw-r--r-- | src/pyramid/csrf.py | 4 | ||||
| -rw-r--r-- | src/pyramid/httpexceptions.py | 24 | ||||
| -rw-r--r-- | src/pyramid/i18n.py | 12 | ||||
| -rw-r--r-- | src/pyramid/interfaces.py | 5 | ||||
| -rw-r--r-- | src/pyramid/location.py | 2 | ||||
| -rw-r--r-- | src/pyramid/paster.py | 2 | ||||
| -rw-r--r-- | src/pyramid/resource.py | 8 | ||||
| -rw-r--r-- | src/pyramid/scaffolds/__init__.py | 2 | ||||
| -rw-r--r-- | src/pyramid/security.py | 10 | ||||
| -rw-r--r-- | src/pyramid/traversal.py | 17 | ||||
| -rw-r--r-- | src/pyramid/url.py | 40 | ||||
| -rw-r--r-- | src/pyramid/view.py | 9 | ||||
| -rw-r--r-- | src/pyramid/viewderivers.py | 4 |
19 files changed, 117 insertions, 110 deletions
diff --git a/src/pyramid/authentication.py b/src/pyramid/authentication.py index f4c2b51ef..7cb6b6811 100644 --- a/src/pyramid/authentication.py +++ b/src/pyramid/authentication.py @@ -143,8 +143,8 @@ class CallbackAuthenticationPolicy(object): if self._clean_principal(userid) is None: debug and self._log( ( - 'unauthenticated_userid returned disallowed %r; returning %r ' - 'as if it was None' % (userid, effective_principals) + 'unauthenticated_userid returned disallowed %r; returning ' + '%r as if it was None' % (userid, effective_principals) ), 'effective_principals', request, @@ -315,8 +315,8 @@ class RepozeWho1AuthenticationPolicy(CallbackAuthenticationPolicy): if groups is None: # is None! self.debug and self._log( ( - 'security policy groups callback returned None; returning %r' - % effective_principals + 'security policy groups callback returned None; returning ' + '%r' % effective_principals ), 'effective_principals', request, @@ -339,8 +339,8 @@ class RepozeWho1AuthenticationPolicy(CallbackAuthenticationPolicy): if self._clean_principal(userid) is None: self.debug and self._log( ( - 'unauthenticated_userid returned disallowed %r; returning %r ' - 'as if it was None' % (userid, effective_principals) + 'unauthenticated_userid returned disallowed %r; returning ' + '%r as if it was None' % (userid, effective_principals) ), 'effective_principals', request, @@ -596,7 +596,7 @@ class AuthTktAuthenticationPolicy(CallbackAuthenticationPolicy): .. versionchanged:: 1.10 Added the ``samesite`` option and made the default ``'Lax'``. - + Objects of this class implement the interface described by :class:`pyramid.interfaces.IAuthenticationPolicy`. @@ -1044,8 +1044,8 @@ class AuthTktCookieHelper(object): "userid is of type {}, and is not supported by the " "AuthTktAuthenticationPolicy. Explicitly converting to string " "and storing as base64. Subsequent requests will receive a " - "string as the userid, it will not be decoded back to the type " - "provided.".format(type(userid)), + "string as the userid, it will not be decoded back to the " + "type provided.".format(type(userid)), RuntimeWarning, ) encoding, encoder = self.userid_type_encoders.get(text_type) @@ -1154,8 +1154,8 @@ class BasicAuthAuthenticationPolicy(CallbackAuthenticationPolicy): ``realm`` - Default: ``"Realm"``. The Basic Auth Realm string. Usually displayed to - the user by the browser in the login dialog. + Default: ``"Realm"``. The Basic Auth Realm string. Usually displayed + to the user by the browser in the login dialog. ``debug`` diff --git a/src/pyramid/config/__init__.py b/src/pyramid/config/__init__.py index ab5edfefe..f5790352e 100644 --- a/src/pyramid/config/__init__.py +++ b/src/pyramid/config/__init__.py @@ -395,7 +395,8 @@ class Configurator( # commit below because: # # - the default exceptionresponse_view requires the superdefault view - # mapper, so we need to configure it before adding default_view_mapper + # mapper, so we need to configure it before adding + # default_view_mapper # # - superdefault renderers should be overrideable without requiring # the user to commit before calling config.add_renderer diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index 46b8921cd..4e1cb0762 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -158,8 +158,8 @@ class RoutesConfiguratorMixin(object): For backwards compatibility purposes (as of :app:`Pyramid` 1.0), a ``path`` keyword argument passed to this function will be used to represent the pattern value if the ``pattern`` argument is - ``None``. If both ``path`` and ``pattern`` are passed, ``pattern`` - wins. + ``None``. If both ``path`` and ``pattern`` are passed, + ``pattern`` wins. xhr @@ -298,9 +298,9 @@ class RoutesConfiguratorMixin(object): if custom_predicates: warnings.warn( ( - 'The "custom_predicates" argument to Configurator.add_route ' - 'is deprecated as of Pyramid 1.5. Use ' - '"config.add_route_predicate" and use the registered ' + 'The "custom_predicates" argument to ' + 'Configurator.add_route is deprecated as of Pyramid 1.5. ' + 'Use "config.add_route_predicate" and use the registered ' 'route predicate as a predicate argument to add_route ' 'instead. See "Adding A Third Party View, Route, or ' 'Subscriber Predicate" in the "Hooks" chapter of the ' @@ -315,9 +315,9 @@ class RoutesConfiguratorMixin(object): if '*' in accept: warnings.warn( ( - 'Passing a media range to the "accept" argument of ' - 'Configurator.add_route is deprecated as of Pyramid ' - '1.10. Use a list of explicit media types.' + 'Passing a media range to the "accept" argument ' + 'of Configurator.add_route is deprecated as of ' + 'Pyramid 1.10. Use a list of explicit media types.' ), DeprecationWarning, stacklevel=3, diff --git a/src/pyramid/config/tweens.py b/src/pyramid/config/tweens.py index a90008784..b74a57adf 100644 --- a/src/pyramid/config/tweens.py +++ b/src/pyramid/config/tweens.py @@ -56,7 +56,7 @@ class TweensConfiguratorMixin(object): - An iterable of any combination of the above. This allows the user to specify fallbacks if the desired tween is not included, as well as compatibility with multiple other tweens. - + ``under`` means 'closer to the main Pyramid application than', ``over`` means 'closer to the request ingress than'. diff --git a/src/pyramid/config/util.py b/src/pyramid/config/util.py index 627b78b6f..8723b7721 100644 --- a/src/pyramid/config/util.py +++ b/src/pyramid/config/util.py @@ -126,9 +126,9 @@ class PredicateList(object): def add(self, name, factory, weighs_more_than=None, weighs_less_than=None): # Predicates should be added to a predicate list in (presumed) # computation expense order. - ## if weighs_more_than is None and weighs_less_than is None: - ## weighs_more_than = self.last_added or FIRST - ## weighs_less_than = LAST + # if weighs_more_than is None and weighs_less_than is None: + # weighs_more_than = self.last_added or FIRST + # weighs_less_than = LAST self.last_added = name self.sorter.add( name, factory, after=weighs_more_than, before=weighs_less_than diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py index 277b207fd..cc5b48ecb 100644 --- a/src/pyramid/config/views.py +++ b/src/pyramid/config/views.py @@ -728,8 +728,8 @@ class ViewsConfiguratorMixin(object): If CSRF checking is performed, the checked value will be the value of ``request.params[check_name]``. This value will be compared against the value of ``policy.get_csrf_token()`` (where ``policy`` is an - implementation of :meth:`pyramid.interfaces.ICSRFStoragePolicy`), and the - check will pass if these two values are the same. If the check + implementation of :meth:`pyramid.interfaces.ICSRFStoragePolicy`), and + the check will pass if these two values are the same. If the check passes, the associated view will be permitted to execute. If the check fails, the associated view will not be permitted to execute. @@ -808,13 +808,13 @@ class ViewsConfiguratorMixin(object): if custom_predicates: warnings.warn( ( - 'The "custom_predicates" argument to Configurator.add_view ' - 'is deprecated as of Pyramid 1.5. Use ' - '"config.add_view_predicate" and use the registered ' - 'view predicate as a predicate argument to add_view instead. ' - 'See "Adding A Third Party View, Route, or Subscriber ' - 'Predicate" in the "Hooks" chapter of the documentation ' - 'for more information.' + 'The "custom_predicates" argument to ' + 'Configurator.add_view is deprecated as of Pyramid 1.5. ' + 'Use "config.add_view_predicate" and use the registered ' + 'view predicate as a predicate argument to add_view ' + 'instead. See "Adding A Third Party View, Route, or ' + 'Subscriber Predicate" in the "Hooks" chapter of the ' + 'documentation for more information.' ), DeprecationWarning, stacklevel=4, @@ -824,10 +824,10 @@ class ViewsConfiguratorMixin(object): warnings.warn( ( 'The "check_csrf" argument to Configurator.add_view is ' - 'deprecated as of Pyramid 1.7. Use the "require_csrf" option ' - 'instead or see "Checking CSRF Tokens Automatically" in the ' - '"Sessions" chapter of the documentation for more ' - 'information.' + 'deprecated as of Pyramid 1.7. Use the "require_csrf" ' + 'option instead or see "Checking CSRF Tokens ' + 'Automatically" in the "Sessions" chapter of the ' + 'documentation for more information.' ), DeprecationWarning, stacklevel=4, @@ -842,9 +842,10 @@ class ViewsConfiguratorMixin(object): warnings.warn( ( 'Passing a media range to the "accept" argument of ' - 'Configurator.add_view is deprecated as of Pyramid 1.10. ' - 'Use explicit media types to avoid ambiguities in ' - 'content negotiation that may impact your users.' + 'Configurator.add_view is deprecated as of ' + 'Pyramid 1.10. Use explicit media types to avoid ' + 'ambiguities in content negotiation that may impact ' + 'your users.' ), DeprecationWarning, stacklevel=4, @@ -1804,7 +1805,8 @@ class ViewsConfiguratorMixin(object): config.add_notfound_view(append_slash=HTTPMovedPermanently) The above means that a redirect to a slash-appended route will be - attempted, but instead of :class:`~pyramid.httpexceptions.HTTPTemporaryRedirect` + attempted, but instead of + :class:`~pyramid.httpexceptions.HTTPTemporaryRedirect` being used, :class:`~pyramid.httpexceptions.HTTPMovedPermanently will be used` for the redirect response if a slash-appended route is found. @@ -1827,7 +1829,8 @@ class ViewsConfiguratorMixin(object): .. versionchanged: 1.10 - Default response was changed from :class:`~pyramid.httpexceptions.HTTPFound` + Default response was changed from + :class:`~pyramid.httpexceptions.HTTPFound` to :class:`~pyramid.httpexceptions.HTTPTemporaryRedirect`. """ diff --git a/src/pyramid/csrf.py b/src/pyramid/csrf.py index 582d6a641..fba5d9baa 100644 --- a/src/pyramid/csrf.py +++ b/src/pyramid/csrf.py @@ -247,8 +247,8 @@ def check_csrf_origin(request, trusted_origins=None, raises=True): Check the ``Origin`` of the request to see if it is a cross site request or not. - If the value supplied by the ``Origin`` or ``Referer`` header isn't one of the - trusted origins and ``raises`` is ``True``, this function will raise a + If the value supplied by the ``Origin`` or ``Referer`` header isn't one of + the trusted origins and ``raises`` is ``True``, this function will raise a :exc:`pyramid.exceptions.BadCSRFOrigin` exception, but if ``raises`` is ``False``, this function will return ``False`` instead. If the CSRF origin checks are successful this function will return ``True`` unconditionally. diff --git a/src/pyramid/httpexceptions.py b/src/pyramid/httpexceptions.py index 359601399..959a45f37 100644 --- a/src/pyramid/httpexceptions.py +++ b/src/pyramid/httpexceptions.py @@ -158,8 +158,7 @@ def _no_escape(value): @implementer(IExceptionResponse) class HTTPException(Response, Exception): - - ## You should set in subclasses: + # You should set in subclasses: # code = 200 # title = 'OK' # explanation = 'why this happens' @@ -187,7 +186,8 @@ class HTTPException(Response, Exception): # implies that this class' ``exception`` property always returns # ``self`` (it exists only for bw compat at this point). # - # - documentation improvements (Pyramid-specific docstrings where necessary) + # - documentation improvements (Pyramid-specific docstrings where + # necessary) # code = 520 title = 'Unknown Error' @@ -220,7 +220,7 @@ ${body}''' </html>''' ) - ## Set this to True for responses that should have no request body + # Set this to True for responses that should have no request body empty_body = False def __init__( @@ -381,7 +381,7 @@ class HTTPSuccessful(HTTPException): ############################################################ -## 2xx success +# 2xx success ############################################################ @@ -488,10 +488,10 @@ class HTTPPartialContent(HTTPSuccessful): title = 'Partial Content' -## FIXME: add 207 Multi-Status (but it's complicated) +# FIXME: add 207 Multi-Status (but it's complicated) ############################################################ -## 3xx redirection +# 3xx redirection ############################################################ @@ -675,7 +675,7 @@ class HTTPPermanentRedirect(_HTTPMove): ############################################################ -## 4xx client error +# 4xx client error ############################################################ @@ -1067,7 +1067,7 @@ class HTTPUnprocessableEntity(HTTPClientError): code: 422, title: Unprocessable Entity """ - ## Note: from WebDAV + # Note: from WebDAV code = 422 title = 'Unprocessable Entity' explanation = 'Unable to process the contained instructions' @@ -1082,7 +1082,7 @@ class HTTPLocked(HTTPClientError): code: 423, title: Locked """ - ## Note: from WebDAV + # Note: from WebDAV code = 423 title = 'Locked' explanation = 'The resource is locked' @@ -1098,7 +1098,7 @@ class HTTPFailedDependency(HTTPClientError): code: 424, title: Failed Dependency """ - ## Note: from WebDAV + # Note: from WebDAV code = 424 title = 'Failed Dependency' explanation = ( @@ -1169,7 +1169,7 @@ class HTTPRequestHeaderFieldsTooLarge(HTTPClientError): ############################################################ -## 5xx Server Error +# 5xx Server Error ############################################################ # Response status codes beginning with the digit "5" indicate cases in # which the server is aware that it has erred or is incapable of diff --git a/src/pyramid/i18n.py b/src/pyramid/i18n.py index 9f5f898be..e99a29aab 100644 --- a/src/pyramid/i18n.py +++ b/src/pyramid/i18n.py @@ -82,13 +82,13 @@ class Localizer(object): and ``plural`` objects should be unicode strings. There is no reason to use translation string objects as arguments as all metadata is ignored. - + ``n`` represents the number of elements. ``domain`` is the translation domain to use to do the pluralization, and ``mapping`` is the interpolation mapping that should be used on the result. If the ``domain`` is not supplied, a default domain is used (usually ``messages``). - + Example:: num = 1 @@ -110,7 +110,7 @@ class Localizer(object): num, mapping={'num':num}) - + """ if self.pluralizer is None: self.pluralizer = Pluralizer(self.translations) @@ -127,7 +127,7 @@ def default_locale_negotiator(request): the request object (possibly set by a view or a listener for an :term:`event`). If the attribute exists and it is not ``None``, its value will be used. - + - Then it looks for the ``request.params['_LOCALE_']`` value. - Then it looks for the ``request.cookies['_LOCALE_']`` value. @@ -176,7 +176,7 @@ def get_locale_name(request): def make_localizer(current_locale_name, translation_directories): """ Create a :class:`pyramid.i18n.Localizer` object - corresponding to the provided locale name from the + corresponding to the provided locale name from the translations found in the list of translation directories.""" translations = Translations() translations._catalog = {} @@ -344,7 +344,7 @@ class Translations(gettext.GNUTranslations, object): return self._domains.get(domain, self).gettext(message) def ldgettext(self, domain, message): - """Like ``lgettext()``, but look the message up in the specified + """Like ``lgettext()``, but look the message up in the specified domain. """ return self._domains.get(domain, self).lgettext(message) diff --git a/src/pyramid/interfaces.py b/src/pyramid/interfaces.py index 26a9d7025..e2e211b67 100644 --- a/src/pyramid/interfaces.py +++ b/src/pyramid/interfaces.py @@ -1341,7 +1341,7 @@ class IIntrospectable(Interface): method = getattr(introspector, methodname) method((i.category_name, i.discriminator), (category_name, discriminator)) - """ + """ # noqa: E501 def __hash__(): @@ -1354,7 +1354,8 @@ class IIntrospectable(Interface): class IActionInfo(Interface): """ Class which provides code introspection capability associated with an - action. The ParserInfo class used by ZCML implements the same interface.""" + action. The ParserInfo class used by ZCML implements the same interface. + """ file = Attribute('Filename of action-invoking code as a string') line = Attribute( diff --git a/src/pyramid/location.py b/src/pyramid/location.py index b8542d1b9..d90aed0d1 100644 --- a/src/pyramid/location.py +++ b/src/pyramid/location.py @@ -48,7 +48,7 @@ def lineage(resource): Calling ``lineage(thing2)`` will return a generator. When we turn it into a list, we will get:: - + list(lineage(thing2)) [ <Thing object at thing2>, <Thing object at thing1> ] """ diff --git a/src/pyramid/paster.py b/src/pyramid/paster.py index eda479476..22c09e41a 100644 --- a/src/pyramid/paster.py +++ b/src/pyramid/paster.py @@ -87,7 +87,7 @@ def bootstrap(config_uri, request=None, options=None): for you if none is provided. You can mutate the request's ``environ`` later to setup a specific host/port/scheme/etc. - ``options`` Is passed to get_app for use as variable assignments like + ``options`` Is passed to get_app for use as variable assignments like {'http_port': 8080} and then use %(http_port)s in the config file. diff --git a/src/pyramid/resource.py b/src/pyramid/resource.py index 1454114fd..8ddf4c447 100644 --- a/src/pyramid/resource.py +++ b/src/pyramid/resource.py @@ -1,6 +1,6 @@ """ Backwards compatibility shim module (forever). """ -from pyramid.asset import * # b/w compat +from pyramid.asset import * # noqa b/w compat -resolve_resource_spec = resolve_asset_spec -resource_spec_from_abspath = asset_spec_from_abspath -abspath_from_resource_spec = abspath_from_asset_spec +resolve_resource_spec = resolve_asset_spec # noqa +resource_spec_from_abspath = asset_spec_from_abspath # noqa +abspath_from_resource_spec = abspath_from_asset_spec # noqa diff --git a/src/pyramid/scaffolds/__init__.py b/src/pyramid/scaffolds/__init__.py index 95c51a2d8..eff71d204 100644 --- a/src/pyramid/scaffolds/__init__.py +++ b/src/pyramid/scaffolds/__init__.py @@ -44,7 +44,7 @@ class PyramidTemplate(Template): Welcome to Pyramid. Sorry for the convenience. %(separator)s - """ + """ # noqa: E501 % {'separator': separator} ) diff --git a/src/pyramid/security.py b/src/pyramid/security.py index 9e256f73c..2e3896976 100644 --- a/src/pyramid/security.py +++ b/src/pyramid/security.py @@ -54,7 +54,7 @@ def has_permission(permission, context, request): """ A function that calls :meth:`pyramid.request.Request.has_permission` and returns its result. - + .. deprecated:: 1.5 Use :meth:`pyramid.request.Request.has_permission` instead. @@ -77,7 +77,7 @@ def authenticated_userid(request): """ A function that returns the value of the property :attr:`pyramid.request.Request.authenticated_userid`. - + .. deprecated:: 1.5 Use :attr:`pyramid.request.Request.authenticated_userid` instead. """ @@ -93,10 +93,10 @@ deprecated( def unauthenticated_userid(request): - """ + """ A function that returns the value of the property :attr:`pyramid.request.Request.unauthenticated_userid`. - + .. deprecated:: 1.5 Use :attr:`pyramid.request.Request.unauthenticated_userid` instead. """ @@ -115,7 +115,7 @@ def effective_principals(request): """ A function that returns the value of the property :attr:`pyramid.request.Request.effective_principals`. - + .. deprecated:: 1.5 Use :attr:`pyramid.request.Request.effective_principals` instead. """ diff --git a/src/pyramid/traversal.py b/src/pyramid/traversal.py index 322f57ed6..338b49083 100644 --- a/src/pyramid/traversal.py +++ b/src/pyramid/traversal.py @@ -369,8 +369,8 @@ def resource_path_tuple(resource, *elements): The :term:`root` resource *must* have a ``__name__`` attribute with a value of either ``None`` or the empty string for path tuples to be generated properly. If the root resource has a non-null ``__name__`` - attribute, its name will be the first element in the generated path tuple - rather than the empty string. + attribute, its name will be the first element in the generated path + tuple rather than the empty string. """ return tuple(_resource_path_list(resource, *elements)) @@ -379,7 +379,8 @@ model_path_tuple = resource_path_tuple # b/w compat (forever) def _resource_path_list(resource, *elements): - """ Implementation detail shared by resource_path and resource_path_tuple""" + """ Implementation detail shared by resource_path and + resource_path_tuple""" path = [loc.__name__ or '' for loc in lineage(resource)] path.reverse() path.extend(elements) @@ -516,11 +517,11 @@ def traversal_path_info(path): This function does not generate the same type of tuples that :func:`pyramid.traversal.resource_path_tuple` does. In particular, the - leading empty string is not present in the tuple it returns, unlike tuples - returned by :func:`pyramid.traversal.resource_path_tuple`. As a result, - tuples generated by ``traversal_path`` are not resolveable by the - :func:`pyramid.traversal.find_resource` API. ``traversal_path`` is a - function mostly used by the internals of :app:`Pyramid` and by people + leading empty string is not present in the tuple it returns, unlike + tuples returned by :func:`pyramid.traversal.resource_path_tuple`. As a + result, tuples generated by ``traversal_path`` are not resolveable by + the :func:`pyramid.traversal.find_resource` API. ``traversal_path`` is + a function mostly used by the internals of :app:`Pyramid` and by people writing their own traversal machinery, as opposed to users writing applications in :app:`Pyramid`. """ diff --git a/src/pyramid/url.py b/src/pyramid/url.py index c6cf3da7f..00dd13bfe 100644 --- a/src/pyramid/url.py +++ b/src/pyramid/url.py @@ -172,10 +172,10 @@ class URLMethodsMixin(object): Python data structures that are passed as ``_query`` which are sequences or dictionaries are turned into a string under the same - rules as when run through :func:`urllib.urlencode` with the ``doseq`` - argument equal to ``True``. This means that sequences can be passed - as values, and a k=v pair will be placed into the query string for - each value. + rules as when run through :func:`urllib.urlencode` with the + ``doseq`` argument equal to ``True``. This means that sequences can + be passed as values, and a k=v pair will be placed into the query + string for each value. If a keyword argument ``_anchor`` is present, its string representation will be quoted per :rfc:`3986#section-3.5` and used as @@ -200,7 +200,7 @@ class URLMethodsMixin(object): ``_host='foo.com'``, and the URL that would have been generated without the host replacement is ``http://example.com/a``, the result will be ``http://foo.com/a``. - + Note that if ``_scheme`` is passed as ``https``, and ``_port`` is not passed, the ``_port`` value is assumed to have been passed as ``443``. Likewise, if ``_scheme`` is passed as ``http`` and @@ -363,10 +363,10 @@ class URLMethodsMixin(object): Python data structures that are passed as ``query`` which are sequences or dictionaries are turned into a string under the same - rules as when run through :func:`urllib.urlencode` with the ``doseq`` - argument equal to ``True``. This means that sequences can be passed - as values, and a k=v pair will be placed into the query string for - each value. + rules as when run through :func:`urllib.urlencode` with the + ``doseq`` argument equal to ``True``. This means that sequences can + be passed as values, and a k=v pair will be placed into the query + string for each value. If a keyword argument ``anchor`` is present, its string representation will be used as a named anchor in the generated URL @@ -390,7 +390,7 @@ class URLMethodsMixin(object): ``host='foo.com'``, and the URL that would have been generated without the host replacement is ``http://example.com/a``, the result will be ``http://foo.com/a``. - + If ``scheme`` is passed as ``https``, and an explicit ``port`` is not passed, the ``port`` value is assumed to have been passed as ``443``. Likewise, if ``scheme`` is passed as ``http`` and ``port`` is not @@ -415,11 +415,11 @@ class URLMethodsMixin(object): If the ``resource`` passed in has a ``__resource_url__`` method, it will be used to generate the URL (scheme, host, port, path) for the base resource which is operated upon by this function. - + .. seealso:: See also :ref:`overriding_resource_url_generation`. - + If ``route_name`` is passed, this function will delegate its URL production to the ``route_url`` function. Calling ``resource_url(someresource, 'element1', 'element2', query={'a':1}, @@ -472,21 +472,21 @@ class URLMethodsMixin(object): is passed, the ``__resource_url__`` method of the resource passed is ignored unconditionally. This feature is incompatible with resources which generate their own URLs. - + .. note:: - If the :term:`resource` used is the result of a :term:`traversal`, it - must be :term:`location`-aware. The resource can also be the context - of a :term:`URL dispatch`; contexts found this way do not need to be - location-aware. + If the :term:`resource` used is the result of a :term:`traversal`, + it must be :term:`location`-aware. The resource can also be the + context of a :term:`URL dispatch`; contexts found this way do not + need to be location-aware. .. note:: If a 'virtual root path' is present in the request environment (the value of the WSGI environ key ``HTTP_X_VHM_ROOT``), and the resource - was obtained via :term:`traversal`, the URL path will not include the - virtual root prefix (it will be stripped off the left hand side of - the generated URL). + was obtained via :term:`traversal`, the URL path will not include + the virtual root prefix (it will be stripped off the left hand side + of the generated URL). .. note:: diff --git a/src/pyramid/view.py b/src/pyramid/view.py index c45b976bb..9f58e72ae 100644 --- a/src/pyramid/view.py +++ b/src/pyramid/view.py @@ -198,14 +198,14 @@ class view_config(object): See the :py:func:`venusian.attach` function in Venusian for more information about the ``_depth`` and ``_category`` arguments. - + .. seealso:: - + See also :ref:`mapping_views_using_a_decorator_section` for details about using :class:`pyramid.view.view_config`. .. warning:: - + ``view_config`` will work ONLY on module top level members because of the limitation of ``venusian.Scanner.scan``. @@ -402,7 +402,8 @@ class notfound_view_config(object): return HTTPNotFound('not found') The above means that a redirect to a slash-appended route will be - attempted, but instead of :class:`~pyramid.httpexceptions.HTTPTemporaryRedirect` + attempted, but instead of + :class:`~pyramid.httpexceptions.HTTPTemporaryRedirect` being used, :class:`~pyramid.httpexceptions.HTTPMovedPermanently will be used` for the redirect response if a slash-appended route is found. diff --git a/src/pyramid/viewderivers.py b/src/pyramid/viewderivers.py index 0b4758554..fbe0c252c 100644 --- a/src/pyramid/viewderivers.py +++ b/src/pyramid/viewderivers.py @@ -48,8 +48,8 @@ class DefaultViewMapper(object): if is_unbound_method(view) and self.attr is None: raise ConfigurationError( ( - 'Unbound method calls are not supported, please set the class ' - 'as your `view` and the method as your `attr`' + 'Unbound method calls are not supported, please set the ' + 'class as your `view` and the method as your `attr`' ) ) |
