summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-02-23 20:00:07 +0000
committerGerrit Code Review <review@openstack.org>2015-02-23 20:00:07 +0000
commit5e76814f4fca4d4aedc9cff7de689514186c67c2 (patch)
treefaa0b8741d4b928a8008aa5023d8d53bb5a13f33
parentf6d0e4627ec0d570d5a31afc063e56e672fe16ee (diff)
parent5801b07da63d4f2a7096eb4d1cb3ea6f36a1e663 (diff)
downloaddjango_openstack_auth-5e76814f4fca4d4aedc9cff7de689514186c67c2.tar.gz
Merge "Fix H405 docstring issue"
-rw-r--r--openstack_auth/backend.py18
-rw-r--r--openstack_auth/user.py10
-rw-r--r--openstack_auth/utils.py7
-rw-r--r--tox.ini2
4 files changed, 21 insertions, 16 deletions
diff --git a/openstack_auth/backend.py b/openstack_auth/backend.py
index 1f112a9..ef91448 100644
--- a/openstack_auth/backend.py
+++ b/openstack_auth/backend.py
@@ -31,9 +31,7 @@ KEYSTONE_CLIENT_ATTR = "_keystoneclient"
class KeystoneBackend(object):
- """Django authentication backend class for use with
- ``django.contrib.auth``.
- """
+ """Django authentication backend for use with ``django.contrib.auth``."""
def check_auth_expiry(self, auth_ref, margin=None):
if not utils.is_token_valid(auth_ref, margin):
@@ -47,7 +45,9 @@ class KeystoneBackend(object):
return True
def get_user(self, user_id):
- """Returns the current user (if authenticated) based on the user ID
+ """Returns the current user from the session data.
+
+ If authenticated, this return the user object based on the user ID
and session data.
Note: this required monkey-patching the ``contrib.auth`` middleware
@@ -188,10 +188,12 @@ class KeystoneBackend(object):
return set()
def get_all_permissions(self, user, obj=None):
- """Returns a set of permission strings that this user has through
- his/her Keystone "roles".
+ """Returns a set of permission strings that the user has.
+
+ This permission available to the user is derived from the user's
+ Keystone "roles".
- The permissions are returned as ``"openstack.{{ role.name }}"``.
+ The permissions are returned as ``"openstack.{{ role.name }}"``.
"""
if user.is_anonymous() or obj is not None:
return set()
@@ -215,7 +217,7 @@ class KeystoneBackend(object):
def has_module_perms(self, user, app_label):
"""Returns True if user has any permissions in the given app_label.
- Currently this matches for the app_label ``"openstack"``.
+ Currently this matches for the app_label ``"openstack"``.
"""
if not user.is_active:
return False
diff --git a/openstack_auth/user.py b/openstack_auth/user.py
index 364410e..947f725 100644
--- a/openstack_auth/user.py
+++ b/openstack_auth/user.py
@@ -57,11 +57,13 @@ def create_user_from_token(request, token, endpoint, services_region=None):
class Token(object):
- """Token object that encapsulates the auth_ref (AccessInfo)from keystone
- client.
+ """Encapsulates the AccessInfo object from keystoneclient.
- Added for maintaining backward compatibility with horizon that expects
- Token object in the user object.
+ Token object provides a consistent interface for accessing the keystone
+ token information and service catalog.
+
+ Added for maintaining backward compatibility with horizon that expects
+ Token object in the user object.
"""
def __init__(self, auth_ref):
# User-related attributes
diff --git a/openstack_auth/utils.py b/openstack_auth/utils.py
index 2e16f60..fb00b8e 100644
--- a/openstack_auth/utils.py
+++ b/openstack_auth/utils.py
@@ -285,9 +285,12 @@ def default_services_region(service_catalog, request=None):
def set_response_cookie(response, cookie_name, cookie_value):
- """a common policy of setting cookies for last used project
+ """Common function for setting the cookie in the response.
+
+ Provides a common policy of setting cookies for last used project
and region, can be reused in other locations.
- this method will set the cookie to expire in 365 days.
+
+ This method will set the cookie to expire in 365 days.
"""
now = timezone.now()
expire_date = now + datetime.timedelta(days=365)
diff --git a/tox.ini b/tox.ini
index f0e41fa..3f597e3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -41,8 +41,6 @@ downloadcache = ~/cache/pip
[flake8]
builtins = _
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py
-# H405 multi line docstring summary not separated with an empty line
-ignore = H405
[hacking]
import_exceptions = django.conf.settings,