Added pylint and cleanup from last commit

This commit is contained in:
Ziad Sawalha 2011-05-15 01:44:08 -05:00
parent d0447d4aba
commit 4992d0082d
8 changed files with 53 additions and 25 deletions

View File

@ -17,8 +17,8 @@
# limitations under the License.
"""
Helper script for starting/stopping/reloading Glance server programs.
Thanks for some of the code, Swifties ;)
Helper script for starting/stopping/reloading OpenStack server programs.
Code copied from swift. Should eventually come from common.
"""
from __future__ import with_statement

View File

@ -8,10 +8,10 @@ debug = False
[app:server]
paste.app_factory = keystone.server:app_factory
# Which backend store should Keystone use by default is not specified
# in a request to add a new image to Glance? Default: 'file'
# Available choices are 'file', 'swift', and 's3'
default_store = file
# Which backend store should Keystone use by default.
# Default: 'sqlite'
# Available choices are 'sqlite' [future will include LDAP, PAM, etc]
default_store = sqlite
# Address to bind the API server
bind_host = 0.0.0.0
@ -19,12 +19,6 @@ bind_host = 0.0.0.0
# Port the bind the API server to
bind_port = 8080
# Address to find the registry server
registry_host = 0.0.0.0
# Port the registry server is listening on
registry_port = 9191
# Log to this file. Make sure you do not set the same log
# file for both the API and registry servers!
#

View File

@ -478,6 +478,7 @@ def token_for_user_tenant(user_id, tenant_id, session=None):
user_id=user_id, tenant_id=tenant_id).order_by("expires desc").first()
return result
def user_tenant_create(values):
user_tenant_ref = models.UserTenantAssociation()
user_tenant_ref.update(values)

View File

@ -158,7 +158,6 @@ class IDMService(object):
if not isinstance(tenant, tenants.Tenant):
raise fault.BadRequestFault("Expecting a Tenant")
True
dtenant = db_api.tenant_get(tenant_id)
if dtenant == None:
@ -212,9 +211,9 @@ class IDMService(object):
db_api.tenant_group_create(dtenant)
return tenants.Group(dtenant.id, dtenant.desc, dtenant.tenant_id)
def get_tenant_groups(self, admin_token, tenantId, marker, limit, url):
def get_tenant_groups(self, admin_token, tenant_id, marker, limit, url):
self.__validate_token(admin_token)
if tenantId == None:
if tenant_id == None:
raise fault.BadRequestFault("Expecting a Tenant Id")
dtenant = db_api.tenant_get(tenantId)
@ -269,11 +268,11 @@ class IDMService(object):
raise fault.ItemNotFoundFault("The tenant group not found")
if group_id != group.group_id:
raise fault.BadRequestFault("Wrong Data Provided,\
raise fault.BadRequestFault("Wrong Data Provided,\
Group id not matching")
if str(tenant_id) != str(group.tenant_id):
raise fault.BadRequestFault("Wrong Data Provided,\
raise fault.BadRequestFault("Wrong Data Provided,\
Tenant id not matching ")
values = {'desc': group.description}

View File

@ -27,8 +27,6 @@ overwrites the Accept header in the request, if present.
"""
import bottle
from bottle import Request
# Does this need to be configurable?
DEFAULT_EXTS = {'xml': 'application/xml', 'json': 'application/json'}

View File

@ -72,11 +72,10 @@ VERSION_DATE = "2011-04-23T00:00:00Z"
service = serv.IDMService()
"""
General Functions for the server.py use
"""
#
# General Functions for the server.py use
#
def is_xml_response(req):
if not "Accept" in req.headers:
return False
@ -738,7 +737,7 @@ class KeystoneAPI(wsgi.Router):
def app_factory(global_conf, **local_conf):
"""paste.deploy app factory for creating Glance API server apps"""
"""paste.deploy app factory for creating OpenStack API server apps"""
try:
conf = global_conf.copy()
conf.update(local_conf)

View File

@ -1,4 +1,3 @@
bottle #still used in queryext
eventlet
lxml
paste

38
pylintrc Normal file
View File

@ -0,0 +1,38 @@
# The format of this file isn't really documented; just use --generate-rcfile
[Messages Control]
# NOTE(justinsb): We might want to have a 2nd strict pylintrc in future
# C0111: Don't require docstrings on every method
# W0511: TODOs in code comments are fine.
# W0142: *args and **kwargs are fine.
# W0622: Redefining id is fine.
disable=C0111,W0511,W0142,W0622
[Basic]
# Variable names can be 1 to 31 characters long, with lowercase and underscores
variable-rgx=[a-z_][a-z0-9_]{0,30}$
# Argument names can be 2 to 31 characters long, with lowercase and underscores
argument-rgx=[a-z_][a-z0-9_]{1,30}$
# Method names should be at least 3 characters long
# and be lowecased with underscores
method-rgx=([a-z_][a-z0-9_]{2,50}|setUp|tearDown)$
# Module names matching nova-* are ok (files in bin/)
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(nova-[a-z0-9_-]+))$
# Don't require docstrings on tests.
no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$
[Design]
max-public-methods=100
min-public-methods=0
max-args=6
[Variables]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
# _ is used by our localization
additional-builtins=_