From 2b93e3b5dfa6bfd32e32acdcb852a99352a64640 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 15 Dec 2007 06:05:23 -0800 Subject: Pylint cleanup. --- gitosis/serve.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/gitosis/serve.py b/gitosis/serve.py index 0f9cb5c..805268d 100644 --- a/gitosis/serve.py +++ b/gitosis/serve.py @@ -15,7 +15,9 @@ from gitosis import gitdaemon from gitosis import app from gitosis import util -ALLOW_RE = re.compile("^'(?P[a-zA-Z0-9][a-zA-Z0-9@._-]*(/[a-zA-Z0-9][a-zA-Z0-9@._-]*)*)'$") +ALLOW_RE = re.compile( + "^'(?P[a-zA-Z0-9][a-zA-Z0-9@._-]*(/[a-zA-Z0-9][a-zA-Z0-9@._-]*)*)'$" + ) COMMANDS_READONLY = [ 'git-upload-pack', @@ -49,11 +51,8 @@ class WriteAccessDenied(AccessDenied): class ReadAccessDenied(AccessDenied): """Repository read access denied""" -def serve( - cfg, - user, - command, - ): +def serve(cfg, user, command): + """Check the git command for sanity, and then run the git command.""" if '\n' in command: raise CommandMayNotContainNewlineError() @@ -108,10 +107,10 @@ def serve( # authorized to do that: create the repository on the fly # create leading directories - p = topdir + path = topdir for segment in repopath.split(os.sep)[:-1]: - p = os.path.join(p, segment) - util.mkdir(p, 0750) + path = os.path.join(path, segment) + util.mkdir(path, 0750) repository.init(path=fullpath) gitweb.set_descriptions( @@ -134,7 +133,13 @@ def serve( return newcmd class Main(app.App): + """gitosis-serve program.""" + # W0613 - They also might ignore arguments here, where the descendant + # methods won't. + # pylint: disable-msg=W0613 + def create_parser(self): + """Declare the input for this program.""" parser = super(Main, self).create_parser() parser.set_usage('%prog [OPTS] USER') parser.set_description( @@ -142,6 +147,7 @@ class Main(app.App): return parser def handle_args(self, parser, cfg, options, args): + """Parse the input for this program.""" try: (user,) = args except ValueError: @@ -167,8 +173,8 @@ class Main(app.App): user=user, command=cmd, ) - except ServingError, e: - log.error('%s', e) + except ServingError, ex: + log.error('%s', ex) sys.exit(1) log.debug('Serving %s', newcmd) -- cgit v1.2.3