From cdae6f04e963d6a7cd531786b0066a1e33d21b40 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Tue, 26 Jul 2011 09:02:21 +0200 Subject: [PATCH] Small pep8 related typo fixes --- radicale.py | 4 ++-- radicale/__init__.py | 8 ++++---- radicale/acl/LDAP.py | 5 +++-- radicale/acl/htpasswd.py | 2 +- radicale/log.py | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/radicale.py b/radicale.py index ed88a4a..34e693f 100755 --- a/radicale.py +++ b/radicale.py @@ -22,7 +22,7 @@ # This file is just a script, allow [a-z0-9]* variable names # pylint: disable-msg=C0103 -# ``import radicale`` refers to the ``radicale`` module, not ``radicale.py`` +# ``import radicale`` refers to the ``radicale`` module, not ``radicale.py`` # pylint: disable-msg=W0406 """ @@ -163,7 +163,7 @@ finally: radicale.log.LOGGER.info("Stopping Radicale") - for server in servers: + for server in servers: radicale.log.LOGGER.debug( "Closing server listening to %s port %s" % ( server.server_name, server.server_port)) diff --git a/radicale/__init__.py b/radicale/__init__.py index ca39ac6..1b75a9f 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -110,7 +110,7 @@ class Application(object): # pylint: disable=E0202 @staticmethod def headers_log(environ): - """Remove environment variables from the headers for logging purpose.""" + """Remove environment variables from the headers for logging.""" request_environ = dict(environ) for shell_variable in os.environ: del request_environ[shell_variable] @@ -315,7 +315,8 @@ class Application(object): def move(self, environ, calendars, content, user): """Manage MOVE request.""" from_calendar = calendars[0] - from_name = xmlutils.name_from_path(environ["PATH_INFO"], from_calendar) + from_name = xmlutils.name_from_path( + environ["PATH_INFO"], from_calendar) if from_name: item = from_calendar.get_item(from_name) if item: @@ -337,7 +338,6 @@ class Application(object): # Moving calendars, not supported return client.FORBIDDEN, {}, None - def options(self, environ, calendars, content, user): """Manage OPTIONS request.""" headers = { @@ -386,7 +386,7 @@ class Application(object): def report(self, environ, calendars, content, user): """Manage REPORT request.""" - # TODO: support multiple calendars here + # TODO: support multiple calendars here calendar = calendars[0] headers = {'Content-Type': 'text/xml'} answer = xmlutils.report(environ["PATH_INFO"], content, calendar) diff --git a/radicale/acl/LDAP.py b/radicale/acl/LDAP.py index dfde79f..fe5c8fc 100644 --- a/radicale/acl/LDAP.py +++ b/radicale/acl/LDAP.py @@ -47,7 +47,8 @@ def has_right(owner, user, password): CONNEXION.simple_bind_s(BINDDN, PASSWORD) distinguished_name = "%s=%s" % (ATTRIBUTE, ldap.dn.escape_dn_chars(user)) - log.LOGGER.debug("LDAP bind for %s in base %s" % (distinguished_name, BASE)) + log.LOGGER.debug( + "LDAP bind for %s in base %s" % (distinguished_name, BASE)) users = CONNEXION.search_s(BASE, ldap.SCOPE_ONELEVEL, distinguished_name) if users: @@ -61,6 +62,6 @@ def has_right(owner, user, password): return True else: log.LOGGER.debug("User %s not found" % user) - + log.LOGGER.debug("LDAP bind failed") return False diff --git a/radicale/acl/htpasswd.py b/radicale/acl/htpasswd.py index e624e91..95487a6 100644 --- a/radicale/acl/htpasswd.py +++ b/radicale/acl/htpasswd.py @@ -53,7 +53,7 @@ def _sha1(hash_value, password): """Check if ``hash_value`` and ``password`` match using sha1 method.""" hash_value = hash_value.replace("{SHA}", "").encode("ascii") password = password.encode(config.get("htpasswd_encoding", "stock")) - sha1 = hashlib.sha1() # pylint: disable=E1101 + sha1 = hashlib.sha1() # pylint: disable=E1101 sha1.update(password) return sha1.digest() == base64.b64decode(hash_value) diff --git a/radicale/log.py b/radicale/log.py index 19ec046..8075c40 100644 --- a/radicale/log.py +++ b/radicale/log.py @@ -35,9 +35,9 @@ from radicale import config LOGGER = logging.getLogger() FILENAME = os.path.expanduser(config.get("logging", "config")) + def start(): """Start the logging according to the configuration.""" - if os.path.exists(FILENAME): # Configuration taken from file logging.config.fileConfig(FILENAME)