diff options
| author | Éric Araujo <merwok@netwok.org> | 2020-07-01 18:33:12 -0400 |
|---|---|---|
| committer | Éric Araujo <merwok@netwok.org> | 2020-07-02 13:09:45 -0400 |
| commit | 70a23ba6e872ae03988caa322f8dd2b03770515c (patch) | |
| tree | 06ffd4c5c36b4cb5b3723cb6e3a25d2fbec0572b /src | |
| parent | baa59284e1ee26284ecb68d957d5607e40ed786f (diff) | |
| download | pyramid-70a23ba6e872ae03988caa322f8dd2b03770515c.tar.gz pyramid-70a23ba6e872ae03988caa322f8dd2b03770515c.tar.bz2 pyramid-70a23ba6e872ae03988caa322f8dd2b03770515c.zip | |
add tests and docs
Diffstat (limited to 'src')
| -rw-r--r-- | src/pyramid/config/routes.py | 7 | ||||
| -rw-r--r-- | src/pyramid/config/views.py | 6 | ||||
| -rw-r--r-- | src/pyramid/interfaces.py | 9 | ||||
| -rw-r--r-- | src/pyramid/security.py | 2 |
4 files changed, 18 insertions, 6 deletions
diff --git a/src/pyramid/config/routes.py b/src/pyramid/config/routes.py index 0fbfcca0c..feb28c7a7 100644 --- a/src/pyramid/config/routes.py +++ b/src/pyramid/config/routes.py @@ -270,7 +270,12 @@ class RoutesConfiguratorMixin: is_authenticated - XXX doc doc + This value, if specified, should be either ``True`` or ``False``. + If it is specified and is ``True``, the route will only match if + the request has an authenticated user, as determined by the + :term:`security policy` in use. If it is specified and ``False``, + the route will only match if the request does not have an + authenticated user. .. versionadded:: 2.0 diff --git a/src/pyramid/config/views.py b/src/pyramid/config/views.py index 87f2cbcd7..4a5723a14 100644 --- a/src/pyramid/config/views.py +++ b/src/pyramid/config/views.py @@ -714,7 +714,11 @@ class ViewsConfiguratorMixin: is_authenticated - XXX doc doc + This value, if specified, should be either ``True`` or ``False``. + If it is specified and is ``True``, the request must be for an + authenticated user, as determined by the :term:`security policy` in + use. If it is specified and ``False``, the associated view callable + will match only if the request does not have an authenticated user. ..versionadded:: 2.0 diff --git a/src/pyramid/interfaces.py b/src/pyramid/interfaces.py index 85539c2f2..b8c8d06a9 100644 --- a/src/pyramid/interfaces.py +++ b/src/pyramid/interfaces.py @@ -114,11 +114,13 @@ class IResponse(Interface): serves up only the given start:stop range. """ authenticated_identity = Attribute( - """XXX Doc doc""" + """An object representing the authenticated user, as determined by + the security policy in use, or ``None`` for unauthenticated requests. + The object's class and meaning is defined by the security policy.""" ) authenticated_userid = Attribute( - """XXX Doc doc""" + """A string to identify the authenticated user or ``None``.""" ) body = Attribute( @@ -242,7 +244,8 @@ class IResponse(Interface): headers = Attribute(""" The headers in a dictionary-like object """) is_authenticated = Attribute( - """XXX doc doc""" + """A boolean indicating whether the request has an authenticated + user, as determined by the security policy in use.""" ) last_modified = Attribute( diff --git a/src/pyramid/security.py b/src/pyramid/security.py index 356286407..2a1ef24bd 100644 --- a/src/pyramid/security.py +++ b/src/pyramid/security.py @@ -246,7 +246,7 @@ class SecurityAPIMixin: @property def is_authenticated(self): - """Return True if a user is authenticated for this request.""" + """Return ``True`` if a user is authenticated for this request.""" return self.authenticated_identity is not None def has_permission(self, permission, context=None): |
