comparison rhodecode/lib/middleware/simplegit.py @ 635:fd63782c4426 beta

Fixed age, for new vcs implementation. Removed all obsolete date formatters Added simplegit middleware. fixed deps added scm type icon to main page
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 25 Oct 2010 03:19:01 +0200
parents d5372213db98
children 9dc1d92d82ed
comparison
equal deleted inserted replaced
634:0d18cf02278a 635:fd63782c4426
15 # 15 #
16 # You should have received a copy of the GNU General Public License 16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software 17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 # MA 02110-1301, USA. 19 # MA 02110-1301, USA.
20 """
21 Created on 2010-04-28
22
23 @author: marcink
24 SimpleGit middleware for handling git protocol request (push/clone etc.)
25 It's implemented with basic auth function
26 """
27
20 from dulwich import server as dulserver 28 from dulwich import server as dulserver
21 29
22 class SimpleGitUploadPackHandler(dulserver.UploadPackHandler): 30 class SimpleGitUploadPackHandler(dulserver.UploadPackHandler):
23 31
24 def handle(self): 32 def handle(self):
52 60
53 from dulwich.repo import Repo 61 from dulwich.repo import Repo
54 from dulwich.web import HTTPGitApplication 62 from dulwich.web import HTTPGitApplication
55 from paste.auth.basic import AuthBasicAuthenticator 63 from paste.auth.basic import AuthBasicAuthenticator
56 from paste.httpheaders import REMOTE_USER, AUTH_TYPE 64 from paste.httpheaders import REMOTE_USER, AUTH_TYPE
57 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware, \ 65 from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware
58 get_user_cached
59 from rhodecode.lib.utils import action_logger, is_git, invalidate_cache, \ 66 from rhodecode.lib.utils import action_logger, is_git, invalidate_cache, \
60 check_repo_fast 67 check_repo_fast
68 from rhodecode.model.user import UserModel
61 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError 69 from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError
62 import logging 70 import logging
63 import os 71 import os
64 import traceback 72 import traceback
65 """
66 Created on 2010-04-28
67
68 @author: marcink
69 SimpleGit middleware for handling git protocol request (push/clone etc.)
70 It's implemented with basic auth function
71 """
72
73 73
74 74
75 log = logging.getLogger(__name__) 75 log = logging.getLogger(__name__)
76 76
77 class SimpleGit(object): 77 class SimpleGit(object):
173 173
174 def __get_environ_user(self, environ): 174 def __get_environ_user(self, environ):
175 return environ.get('REMOTE_USER') 175 return environ.get('REMOTE_USER')
176 176
177 def __get_user(self, username): 177 def __get_user(self, username):
178 return get_user_cached(username) 178 return UserModel().get_by_username(username, cache=True)
179 179
180 def __get_action(self, environ): 180 def __get_action(self, environ):
181 """ 181 """
182 Maps git request commands into a pull or push command. 182 Maps git request commands into a pull or push command.
183 :param environ: 183 :param environ: