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