# HG changeset patch # User Marcin Kuzminski # Date 1293821923 -3600 # Node ID 04c9bb9ca6d60c8923e59bb7be0bfd778f82b2c7 # Parent 07a6e8c655260a67b1b67e2365424af5eae8516a code docs, updates diff -r 07a6e8c65526 -r 04c9bb9ca6d6 rhodecode/lib/celerylib/__init__.py --- a/rhodecode/lib/celerylib/__init__.py Fri Dec 31 19:46:56 2010 +0100 +++ b/rhodecode/lib/celerylib/__init__.py Fri Dec 31 19:58:43 2010 +0100 @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ - package.rhodecode.lib.celerylib.__init__ - ~~~~~~~~~~~~~~ + rhodecode.lib.celerylib.__init__ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ celery libs for RhodeCode diff -r 07a6e8c65526 -r 04c9bb9ca6d6 rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py Fri Dec 31 19:46:56 2010 +0100 +++ b/rhodecode/lib/celerylib/tasks.py Fri Dec 31 19:58:43 2010 +0100 @@ -1,3 +1,30 @@ +# -*- coding: utf-8 -*- +""" + rhodecode.lib.celerylib.tasks + ~~~~~~~~~~~~~~ + + RhodeCode task modules, containing all task that suppose to be run + by celery daemon + + :created_on: Oct 6, 2010 + :author: marcink + :copyright: (C) 2009-2011 Marcin Kuzminski + :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 +# of the License or (at your opinion) any later version of the license. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. from celery.decorators import task import os diff -r 07a6e8c65526 -r 04c9bb9ca6d6 rhodecode/lib/indexers/__init__.py --- a/rhodecode/lib/indexers/__init__.py Fri Dec 31 19:46:56 2010 +0100 +++ b/rhodecode/lib/indexers/__init__.py Fri Dec 31 19:58:43 2010 +0100 @@ -1,3 +1,29 @@ +# -*- coding: utf-8 -*- +""" + rhodecode.lib.indexers.__init__ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Whoosh indexing module for RhodeCode + + :created_on: Aug 17, 2010 + :author: marcink + :copyright: (C) 2009-2010 Marcin Kuzminski + :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 +# of the License or (at your opinion) any later version of the license. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. import os import sys import traceback diff -r 07a6e8c65526 -r 04c9bb9ca6d6 rhodecode/lib/middleware/https_fixup.py --- a/rhodecode/lib/middleware/https_fixup.py Fri Dec 31 19:46:56 2010 +0100 +++ b/rhodecode/lib/middleware/https_fixup.py Fri Dec 31 19:58:43 2010 +0100 @@ -1,8 +1,15 @@ -#!/usr/bin/env python -# encoding: utf-8 -# middleware to handle https correctly -# Copyright (C) 2009-2011 Marcin Kuzminski - +# -*- coding: utf-8 -*- +""" + rhodecode.lib.middleware.https_fixup + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + middleware to handle https correctly + + :created_on: May 23, 2010 + :author: marcink + :copyright: (C) 2009-2011 Marcin Kuzminski + :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 @@ -18,28 +25,22 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. -""" -Created on May 23, 2010 - -@author: marcink -""" - class HttpsFixup(object): def __init__(self, app): self.application = app - + def __call__(self, environ, start_response): self.__fixup(environ) return self.application(environ, start_response) - - + + def __fixup(self, environ): """Function to fixup the environ as needed. In order to use this middleware you should set this header inside your proxy ie. nginx, apache etc. """ proto = environ.get('HTTP_X_URL_SCHEME') - + if proto == 'https': environ['wsgi.url_scheme'] = proto else: diff -r 07a6e8c65526 -r 04c9bb9ca6d6 rhodecode/lib/middleware/simplegit.py --- 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 -# +# -*- 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 + :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('=') diff -r 07a6e8c65526 -r 04c9bb9ca6d6 rhodecode/lib/middleware/simplehg.py --- a/rhodecode/lib/middleware/simplehg.py Fri Dec 31 19:46:56 2010 +0100 +++ b/rhodecode/lib/middleware/simplehg.py Fri Dec 31 19:58:43 2010 +0100 @@ -1,8 +1,16 @@ -#!/usr/bin/env python -# encoding: utf-8 -# middleware to handle mercurial api calls -# Copyright (C) 2009-2011 Marcin Kuzminski -# +# -*- coding: utf-8 -*- +""" + rhodecode.lib.middleware.simplehg + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + SimpleHG middleware for handling mercurial 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 + :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,7 @@ # 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 -SimpleHG middleware for handling mercurial protocol request (push/clone etc.) -It's implemented with basic auth function -""" from mercurial.error import RepoError from mercurial.hgweb import hgweb from mercurial.hgweb.request import wsgiapplication @@ -41,8 +43,7 @@ log = logging.getLogger(__name__) def is_mercurial(environ): - """ - Returns True if request's target is mercurial server - header + """Returns True if request's target is mercurial server - header ``HTTP_ACCEPT`` of such request would start with ``application/mercurial``. """ http_accept = environ.get('HTTP_ACCEPT') @@ -168,8 +169,7 @@ return UserModel().get_by_username(username, cache=True) def __get_action(self, environ): - """ - Maps mercurial request commands into a clone,pull or push command. + """Maps mercurial request commands into a clone,pull or push command. This should always return a valid command string :param environ: """ @@ -214,17 +214,3 @@ hgserve.repo.ui.setconfig(section, k, v) return hgserve - - - - - - - - - - - - - -