Mercurial > kallithea
diff rhodecode/lib/middleware/simplegit.py @ 903:04c9bb9ca6d6 beta
code docs, updates
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 31 Dec 2010 19:58:43 +0100 |
parents | 07a6e8c65526 |
children | b2d5868cc4b8 |
line wrap: on
line diff
--- a/rhodecode/lib/middleware/simplegit.py Fri Dec 31 19:46:56 2010 +0100 +++ b/rhodecode/lib/middleware/simplegit.py Fri Dec 31 19:58:43 2010 +0100 @@ -1,8 +1,16 @@ -#!/usr/bin/env python -# encoding: utf-8 -# middleware to handle git api calls -# Copyright (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> -# +# -*- coding: utf-8 -*- +""" + rhodecode.lib.middleware.simplegit + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + SimpleGit middleware for handling git protocol request (push/clone etc.) + It's implemented with basic auth function + + :created_on: Apr 28, 2010 + :author: marcink + :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> + :license: GPLv3, see COPYING for more details. +""" # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; version 2 @@ -17,13 +25,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. -""" -Created on 2010-04-28 -@author: marcink -SimpleGit middleware for handling git protocol request (push/clone etc.) -It's implemented with basic auth function -""" +import os +import logging +import traceback from dulwich import server as dulserver @@ -60,21 +65,20 @@ from dulwich.repo import Repo from dulwich.web import HTTPGitApplication + from paste.auth.basic import AuthBasicAuthenticator from paste.httpheaders import REMOTE_USER, AUTH_TYPE + from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware from rhodecode.lib.utils import invalidate_cache, check_repo_fast from rhodecode.model.user import UserModel + from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError -import logging -import os -import traceback log = logging.getLogger(__name__) def is_git(environ): - """ - Returns True if request's target is git server. ``HTTP_USER_AGENT`` would + """Returns True if request's target is git server. ``HTTP_USER_AGENT`` would then have git client version given. :param environ: @@ -200,8 +204,8 @@ return UserModel().get_by_username(username, cache=True) def __get_action(self, environ): - """ - Maps git request commands into a pull or push command. + """Maps git request commands into a pull or push command. + :param environ: """ service = environ['QUERY_STRING'].split('=')