Fix H405 docstring issue

Change-Id: I39bb85f3c313b8e5065c07aef5c05f7a44f16c98
This commit is contained in:
lin-hua-cheng 2015-02-18 22:32:06 -08:00
parent 3b5029aeab
commit 5801b07da6
4 changed files with 21 additions and 16 deletions

View File

@ -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.
The permissions are returned as ``"openstack.{{ role.name }}"``.
This permission available to the user is derived from the user's
Keystone "roles".
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

View File

@ -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

View File

@ -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)

View File

@ -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,