##// END OF EJS Templates
code docs, updates
marcink -
r903:04c9bb9c beta
parent child Browse files
Show More
@@ -1,7 +1,7 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 package.rhodecode.lib.celerylib.__init__
4 ~~~~~~~~~~~~~~
3 rhodecode.lib.celerylib.__init__
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 celery libs for RhodeCode
7 7
@@ -1,3 +1,30 b''
1 # -*- coding: utf-8 -*-
2 """
3 rhodecode.lib.celerylib.tasks
4 ~~~~~~~~~~~~~~
5
6 RhodeCode task modules, containing all task that suppose to be run
7 by celery daemon
8
9 :created_on: Oct 6, 2010
10 :author: marcink
11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details.
13 """
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; version 2
17 # of the License or (at your opinion) any later version of the license.
18 #
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27 # MA 02110-1301, USA.
1 28 from celery.decorators import task
2 29
3 30 import os
@@ -1,3 +1,29 b''
1 # -*- coding: utf-8 -*-
2 """
3 rhodecode.lib.indexers.__init__
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
6 Whoosh indexing module for RhodeCode
7
8 :created_on: Aug 17, 2010
9 :author: marcink
10 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
12 """
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation; version 2
16 # of the License or (at your opinion) any later version of the license.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 # MA 02110-1301, USA.
1 27 import os
2 28 import sys
3 29 import traceback
@@ -1,8 +1,15 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # middleware to handle https correctly
4 # Copyright (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
5
1 # -*- coding: utf-8 -*-
2 """
3 rhodecode.lib.middleware.https_fixup
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
6 middleware to handle https correctly
7
8 :created_on: May 23, 2010
9 :author: marcink
10 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
11 :license: GPLv3, see COPYING for more details.
12 """
6 13 # This program is free software; you can redistribute it and/or
7 14 # modify it under the terms of the GNU General Public License
8 15 # as published by the Free Software Foundation; version 2
@@ -18,28 +25,22 b''
18 25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 26 # MA 02110-1301, USA.
20 27
21 """
22 Created on May 23, 2010
23
24 @author: marcink
25 """
26
27 28 class HttpsFixup(object):
28 29 def __init__(self, app):
29 30 self.application = app
30
31
31 32 def __call__(self, environ, start_response):
32 33 self.__fixup(environ)
33 34 return self.application(environ, start_response)
34
35
35
36
36 37 def __fixup(self, environ):
37 38 """Function to fixup the environ as needed. In order to use this
38 39 middleware you should set this header inside your
39 40 proxy ie. nginx, apache etc.
40 41 """
41 42 proto = environ.get('HTTP_X_URL_SCHEME')
42
43
43 44 if proto == 'https':
44 45 environ['wsgi.url_scheme'] = proto
45 46 else:
@@ -1,8 +1,16 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # middleware to handle git api calls
4 # Copyright (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
5 #
1 # -*- coding: utf-8 -*-
2 """
3 rhodecode.lib.middleware.simplegit
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
6 SimpleGit middleware for handling git protocol request (push/clone etc.)
7 It's implemented with basic auth function
8
9 :created_on: Apr 28, 2010
10 :author: marcink
11 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details.
13 """
6 14 # This program is free software; you can redistribute it and/or
7 15 # modify it under the terms of the GNU General Public License
8 16 # as published by the Free Software Foundation; version 2
@@ -17,13 +25,10 b''
17 25 # along with this program; if not, write to the Free Software
18 26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 27 # MA 02110-1301, USA.
20 """
21 Created on 2010-04-28
22 28
23 @author: marcink
24 SimpleGit middleware for handling git protocol request (push/clone etc.)
25 It's implemented with basic auth function
26 """
29 import os
30 import logging
31 import traceback
27 32
28 33 from dulwich import server as dulserver
29 34
@@ -60,21 +65,20 b' dulserver.DEFAULT_HANDLERS = {'
60 65
61 66 from dulwich.repo import Repo
62 67 from dulwich.web import HTTPGitApplication
68
63 69 from paste.auth.basic import AuthBasicAuthenticator
64 70 from paste.httpheaders import REMOTE_USER, AUTH_TYPE
71
65 72 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
66 73 from rhodecode.lib.utils import invalidate_cache, check_repo_fast
67 74 from rhodecode.model.user import UserModel
75
68 76 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
69 import logging
70 import os
71 import traceback
72 77
73 78 log = logging.getLogger(__name__)
74 79
75 80 def is_git(environ):
76 """
77 Returns True if request's target is git server. ``HTTP_USER_AGENT`` would
81 """Returns True if request's target is git server. ``HTTP_USER_AGENT`` would
78 82 then have git client version given.
79 83
80 84 :param environ:
@@ -200,8 +204,8 b' class SimpleGit(object):'
200 204 return UserModel().get_by_username(username, cache=True)
201 205
202 206 def __get_action(self, environ):
203 """
204 Maps git request commands into a pull or push command.
207 """Maps git request commands into a pull or push command.
208
205 209 :param environ:
206 210 """
207 211 service = environ['QUERY_STRING'].split('=')
@@ -1,8 +1,16 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # middleware to handle mercurial api calls
4 # Copyright (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
5 #
1 # -*- coding: utf-8 -*-
2 """
3 rhodecode.lib.middleware.simplehg
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
6 SimpleHG middleware for handling mercurial protocol request
7 (push/clone etc.). It's implemented with basic auth function
8
9 :created_on: Apr 28, 2010
10 :author: marcink
11 :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
12 :license: GPLv3, see COPYING for more details.
13 """
6 14 # This program is free software; you can redistribute it and/or
7 15 # modify it under the terms of the GNU General Public License
8 16 # as published by the Free Software Foundation; version 2
@@ -17,13 +25,7 b''
17 25 # along with this program; if not, write to the Free Software
18 26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 27 # MA 02110-1301, USA.
20 """
21 Created on 2010-04-28
22 28
23 @author: marcink
24 SimpleHG middleware for handling mercurial protocol request (push/clone etc.)
25 It's implemented with basic auth function
26 """
27 29 from mercurial.error import RepoError
28 30 from mercurial.hgweb import hgweb
29 31 from mercurial.hgweb.request import wsgiapplication
@@ -41,8 +43,7 b' import traceback'
41 43 log = logging.getLogger(__name__)
42 44
43 45 def is_mercurial(environ):
44 """
45 Returns True if request's target is mercurial server - header
46 """Returns True if request's target is mercurial server - header
46 47 ``HTTP_ACCEPT`` of such request would start with ``application/mercurial``.
47 48 """
48 49 http_accept = environ.get('HTTP_ACCEPT')
@@ -168,8 +169,7 b' class SimpleHg(object):'
168 169 return UserModel().get_by_username(username, cache=True)
169 170
170 171 def __get_action(self, environ):
171 """
172 Maps mercurial request commands into a clone,pull or push command.
172 """Maps mercurial request commands into a clone,pull or push command.
173 173 This should always return a valid command string
174 174 :param environ:
175 175 """
@@ -214,17 +214,3 b' class SimpleHg(object):'
214 214 hgserve.repo.ui.setconfig(section, k, v)
215 215
216 216 return hgserve
217
218
219
220
221
222
223
224
225
226
227
228
229
230
General Comments 0
You need to be logged in to leave comments. Login now