Show More
@@ -8,6 +8,7 b' from pylons.middleware import ErrorHandl' | |||
|
8 | 8 | from pylons.wsgiapp import PylonsApp |
|
9 | 9 | from routes.middleware import RoutesMiddleware |
|
10 | 10 | from rhodecode.lib.middleware.simplehg import SimpleHg |
|
11 | from rhodecode.lib.middleware.simplegit import SimpleGit | |
|
11 | 12 | from rhodecode.lib.middleware.https_fixup import HttpsFixup |
|
12 | 13 | from rhodecode.config.environment import load_environment |
|
13 | 14 | |
@@ -35,15 +36,16 b' def make_app(global_conf, full_stack=Tru' | |||
|
35 | 36 | |
|
36 | 37 | # The Pylons WSGI app |
|
37 | 38 | app = PylonsApp(config=config) |
|
38 | ||
|
39 | ||
|
39 | 40 | # Routing/Session/Cache Middleware |
|
40 | 41 | app = RoutesMiddleware(app, config['routes.map']) |
|
41 | 42 | app = SessionMiddleware(app, config) |
|
42 | ||
|
43 | ||
|
43 | 44 | # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) |
|
44 | ||
|
45 | ||
|
45 | 46 | app = SimpleHg(app, config) |
|
46 | ||
|
47 | app = SimpleGit(app, config) | |
|
48 | ||
|
47 | 49 | if asbool(full_stack): |
|
48 | 50 | # Handle Python exceptions |
|
49 | 51 | app = ErrorHandler(app, global_conf, **config['pylons.errorware']) |
@@ -54,10 +56,10 b' def make_app(global_conf, full_stack=Tru' | |||
|
54 | 56 | app = StatusCodeRedirect(app) |
|
55 | 57 | else: |
|
56 | 58 | app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) |
|
57 | ||
|
59 | ||
|
58 | 60 | #enable https redirets based on HTTP_X_URL_SCHEME set by proxy |
|
59 | 61 | app = HttpsFixup(app) |
|
60 | ||
|
62 | ||
|
61 | 63 | # Establish the Registry for this application |
|
62 | 64 | app = RegistryManager(app) |
|
63 | 65 | |
@@ -65,7 +67,7 b' def make_app(global_conf, full_stack=Tru' | |||
|
65 | 67 | # Serve static files |
|
66 | 68 | static_app = StaticURLParser(config['pylons.paths']['static_files']) |
|
67 | 69 | app = Cascade([static_app, app]) |
|
68 | ||
|
70 | ||
|
69 | 71 | app.config = config |
|
70 | 72 | |
|
71 | 73 | return app |
@@ -101,7 +101,7 b' def get_commits_stats(repo_name, ts_min_' | |||
|
101 | 101 | commits_by_day_aggregate = {} |
|
102 | 102 | repos_path = get_hg_ui_settings()['paths_root_path'] |
|
103 | 103 | p = os.path.join(repos_path, repo_name) |
|
104 |
repo = get_repo( |
|
|
104 | repo = get_repo(p) | |
|
105 | 105 | |
|
106 | 106 | skip_date_limit = True |
|
107 | 107 | parse_limit = 250 #limit for single task changeset parsing optimal for |
@@ -312,10 +312,8 b' def __get_codes_stats(repo_name):' | |||
|
312 | 312 | |
|
313 | 313 | repos_path = get_hg_ui_settings()['paths_root_path'] |
|
314 | 314 | p = os.path.join(repos_path, repo_name) |
|
315 |
repo = get_repo( |
|
|
316 | ||
|
315 | repo = get_repo(p) | |
|
317 | 316 | tip = repo.get_changeset() |
|
318 | ||
|
319 | 317 | code_stats = {} |
|
320 | 318 | |
|
321 | 319 | def aggregate(cs): |
@@ -23,6 +23,7 b' from webhelpers.pylonslib.secure_form im' | |||
|
23 | 23 | from webhelpers.text import chop_at, collapse, convert_accented_entities, \ |
|
24 | 24 | convert_misc_entities, lchop, plural, rchop, remove_formatting, \ |
|
25 | 25 | replace_whitespace, urlify, truncate, wrap_paragraphs |
|
26 | from webhelpers.date import time_ago_in_words | |
|
26 | 27 | |
|
27 | 28 | #Custom helpers here :) |
|
28 | 29 | class _Link(object): |
@@ -317,37 +318,50 b' def get_changeset_safe(repo, rev):' | |||
|
317 | 318 | flash = _Flash() |
|
318 | 319 | |
|
319 | 320 | |
|
320 |
#============================================================================== |
|
|
321 | #============================================================================== | |
|
321 | 322 | # MERCURIAL FILTERS available via h. |
|
322 |
#============================================================================== |
|
|
323 | #============================================================================== | |
|
323 | 324 | from mercurial import util |
|
324 |
from mercurial.templatefilters import |
|
|
325 | from mercurial.templatefilters import person as _person | |
|
326 | ||
|
327 | ||
|
328 | ||
|
329 | def _age(curdate): | |
|
330 | """turns a datetime into an age string.""" | |
|
325 | 331 | |
|
326 | age = lambda x:x | |
|
332 | from datetime import timedelta, datetime | |
|
333 | agescales = [("year", 3600 * 24 * 365), | |
|
334 | ("month", 3600 * 24 * 30), | |
|
335 | #("week", 3600 * 24 * 7), | |
|
336 | ("day", 3600 * 24), | |
|
337 | ("hour", 3600), | |
|
338 | ("minute", 60), | |
|
339 | ("second", 1)] | |
|
340 | ||
|
341 | age = datetime.now() - curdate | |
|
342 | age_seconds = (age.days * agescales[2][1]) + age.seconds | |
|
343 | ||
|
344 | pos = 1 | |
|
345 | for scale in agescales: | |
|
346 | if scale[1] <= age_seconds: | |
|
347 | return time_ago_in_words(curdate, agescales[pos][0]) | |
|
348 | pos += 1 | |
|
349 | ||
|
350 | age = lambda x:_age(x) | |
|
327 | 351 | capitalize = lambda x: x.capitalize() |
|
328 | date = lambda x: util.datestr(x) | |
|
329 | 352 | email = util.email |
|
330 | 353 | email_or_none = lambda x: util.email(x) if util.email(x) != x else None |
|
331 | 354 | person = lambda x: _person(x) |
|
332 | hgdate = lambda x: "%d %d" % x | |
|
333 | isodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M %1%2') | |
|
334 | isodatesec = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2') | |
|
335 | localdate = lambda x: (x[0], util.makedate()[1]) | |
|
336 | rfc822date = lambda x: x#util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2") | |
|
337 | rfc822date_notz = lambda x: x#util.datestr(x, "%a, %d %b %Y %H:%M:%S") | |
|
338 | rfc3339date = lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2") | |
|
339 | time_ago = lambda x: util.datestr(_age(x), "%a, %d %b %Y %H:%M:%S %1%2") | |
|
340 | 355 | |
|
341 | ||
|
342 | #=============================================================================== | |
|
356 | #============================================================================== | |
|
343 | 357 | # PERMS |
|
344 |
#============================================================================== |
|
|
358 | #============================================================================== | |
|
345 | 359 | from rhodecode.lib.auth import HasPermissionAny, HasPermissionAll, \ |
|
346 | 360 | HasRepoPermissionAny, HasRepoPermissionAll |
|
347 | 361 | |
|
348 |
#============================================================================== |
|
|
362 | #============================================================================== | |
|
349 | 363 | # GRAVATAR URL |
|
350 |
#============================================================================== |
|
|
364 | #============================================================================== | |
|
351 | 365 | import hashlib |
|
352 | 366 | import urllib |
|
353 | 367 | from pylons import request |
@@ -17,6 +17,14 b'' | |||
|
17 | 17 | # along with this program; if not, write to the Free Software |
|
18 | 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 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 | 28 | from dulwich import server as dulserver |
|
21 | 29 | |
|
22 | 30 | class SimpleGitUploadPackHandler(dulserver.UploadPackHandler): |
@@ -54,22 +62,14 b' from dulwich.repo import Repo' | |||
|
54 | 62 | from dulwich.web import HTTPGitApplication |
|
55 | 63 | from paste.auth.basic import AuthBasicAuthenticator |
|
56 | 64 | from paste.httpheaders import REMOTE_USER, AUTH_TYPE |
|
57 |
from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware |
|
|
58 | get_user_cached | |
|
65 | from rhodecode.lib.auth import authfunc, HasPermissionAnyMiddleware | |
|
59 | 66 | from rhodecode.lib.utils import action_logger, is_git, invalidate_cache, \ |
|
60 | 67 | check_repo_fast |
|
68 | from rhodecode.model.user import UserModel | |
|
61 | 69 | from webob.exc import HTTPNotFound, HTTPForbidden, HTTPInternalServerError |
|
62 | 70 | import logging |
|
63 | 71 | import os |
|
64 | 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 | 75 | log = logging.getLogger(__name__) |
@@ -175,7 +175,7 b' class SimpleGit(object):' | |||
|
175 | 175 | return environ.get('REMOTE_USER') |
|
176 | 176 | |
|
177 | 177 | def __get_user(self, username): |
|
178 |
return |
|
|
178 | return UserModel().get_by_username(username, cache=True) | |
|
179 | 179 | |
|
180 | 180 | def __get_action(self, environ): |
|
181 | 181 | """ |
@@ -1010,7 +1010,7 b' padding:0;' | |||
|
1010 | 1010 | #content div.box table th { |
|
1011 | 1011 | background:#eee; |
|
1012 | 1012 | border-bottom:1px solid #ddd; |
|
1013 |
padding: |
|
|
1013 | padding:5px 0px 5px 5px; | |
|
1014 | 1014 | } |
|
1015 | 1015 | |
|
1016 | 1016 | #content div.box table th.left { |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -55,6 +55,14 b'' | |||
|
55 | 55 | %if h.HasRepoPermissionAny('repository.write','repository.read','repository.admin')(repo['name'],'main page check'): |
|
56 | 56 | <tr class="parity${cnt%2}"> |
|
57 | 57 | <td> |
|
58 | %if repo['repo'].dbrepo.repo_type =='hg': | |
|
59 | <img class="icon" alt="${_('Mercurial repository')}" src="/images/icons/hgicon.png"/> | |
|
60 | %elif repo['repo'].dbrepo.repo_type =='git': | |
|
61 | <img class="icon" alt="${_('Git repository')}" src="/images/icons/giticon.png"/> | |
|
62 | %else: | |
|
63 | ||
|
64 | %endif | |
|
65 | ||
|
58 | 66 | %if repo['repo'].dbrepo.private: |
|
59 | 67 | <img class="icon" alt="${_('private')}" src="/images/icons/lock.png"/> |
|
60 | 68 | %else: |
@@ -70,7 +78,8 b'' | |||
|
70 | 78 | %endif |
|
71 | 79 | </td> |
|
72 | 80 | <td title="${repo['description']}">${h.truncate(repo['description'],60)}</td> |
|
73 |
<td> |
|
|
81 | <td><span class="tooltip" tooltip_title="${repo['last_change']}"> | |
|
82 | ${h.age(repo['last_change'])} </span></td> | |
|
74 | 83 | <td> |
|
75 | 84 | %if repo['rev']>=0: |
|
76 | 85 | ${h.link_to('r%s:%s' % (repo['rev'],repo['tip']), |
@@ -13,7 +13,7 b'' | |||
|
13 | 13 | </tr> |
|
14 | 14 | %for cnt,cs in enumerate(c.repo_changesets): |
|
15 | 15 | <tr class="parity${cnt%2}"> |
|
16 |
<td>${h.age(cs.date)} - ${ |
|
|
16 | <td>${h.age(cs.date)} - ${cs.date} </td> | |
|
17 | 17 | <td title="${cs.author}">${h.person(cs.author)}</td> |
|
18 | 18 | <td>r${cs.revision}:${cs.short_id}</td> |
|
19 | 19 | <td> |
@@ -92,7 +92,7 b' E.onDOMReady(function(e){' | |||
|
92 | 92 | <label>${_('Last change')}:</label> |
|
93 | 93 | </div> |
|
94 | 94 | <div class="input-short"> |
|
95 |
${h.age(c.repo_info.last_change)} - ${ |
|
|
95 | ${h.age(c.repo_info.last_change)} - ${c.repo_info.last_change} | |
|
96 | 96 | ${_('by')} ${h.get_changeset_safe(c.repo_info,'tip').author} |
|
97 | 97 | |
|
98 | 98 | </div> |
@@ -4,13 +4,13 b' py_version = sys.version_info' | |||
|
4 | 4 | |
|
5 | 5 | requirements = [ |
|
6 | 6 | "Pylons>=1.0.0", |
|
7 | "SQLAlchemy>=0.6", | |
|
8 |
"Mako>=0.3. |
|
|
9 |
"vcs==0.1. |
|
|
7 | "SQLAlchemy>=0.6.4", | |
|
8 | "Mako>=0.3.5", | |
|
9 | "vcs==0.1.10", | |
|
10 | 10 | "pygments>=1.3.0", |
|
11 |
"mercurial |
|
|
12 |
"whoosh==1. |
|
|
13 |
"celery |
|
|
11 | "mercurial==1.6.4", | |
|
12 | "whoosh==1.1.0", | |
|
13 | "celery==2.1.1", | |
|
14 | 14 | "py-bcrypt", |
|
15 | 15 | "babel", |
|
16 | 16 | ] |
General Comments 0
You need to be logged in to leave comments.
Login now