Show More
@@ -1,19 +1,18 b'' | |||||
1 | This file is for you to describe the pylons_app application. Typically |
|
1 | Pylons based replacement for hgwebdir. Fully customizable, | |
2 | you would include information such as the information below: |
|
2 | with authentication, permissions. Based on vcs library. | |
3 |
|
3 | - has it's own middleware to handle mercurial protocol request each request can | ||
4 | Installation and Setup |
|
4 | be logged and authenticated +threaded performance unlikely to hgweb | |
5 | ====================== |
|
5 | - mako templates let's you cusmotize look and feel of appplication. | |
6 |
|
6 | - diffs annotations and source code all colored by pygments. | ||
7 | Install ``pylons_app`` using easy_install:: |
|
7 | - admin interface for performing user/permission managments as well as repository | |
8 |
|
8 | managment | ||
9 | easy_install pylons_app |
|
9 | - added cache with invalidation on push/repo managment for high performance and | |
|
10 | always upto date data. | |||
|
11 | - rss /atom feed customizable | |||
|
12 | - future support for git | |||
|
13 | - based on pylons 1.0 / sqlalchemy 0.6 | |||
10 |
|
14 | |||
11 | Make a config file as follows:: |
|
15 | === | |
12 |
|
16 | This software is still in beta mode. I don't guarantee that it'll work. | ||
13 | paster make-config pylons_app config.ini |
|
17 | I started this project since i was tired of sad looks, and zero controll over | |
14 |
|
18 | our company regular hgwebdir. | ||
15 | Tweak the config file as appropriate and then setup the application:: |
|
|||
16 |
|
||||
17 | paster setup-app config.ini |
|
|||
18 |
|
||||
19 | Then you are ready to go. |
|
@@ -1,41 +1,41 b'' | |||||
1 | """The base Controller API |
|
1 | """The base Controller API | |
2 |
|
2 | |||
3 | Provides the BaseController class for subclassing. |
|
3 | Provides the BaseController class for subclassing. | |
4 | """ |
|
4 | """ | |
5 | from beaker.cache import cache_region |
|
5 | from beaker.cache import cache_region | |
6 | from pylons import config, tmpl_context as c, request, session |
|
6 | from pylons import config, tmpl_context as c, request, session | |
7 | from pylons.controllers import WSGIController |
|
7 | from pylons.controllers import WSGIController | |
8 | from pylons.templating import render_mako as render |
|
8 | from pylons.templating import render_mako as render | |
9 | from pylons_app.lib.auth import LoginRequired, AuthUser |
|
9 | from pylons_app.lib.auth import LoginRequired, AuthUser | |
10 | from pylons_app.lib.utils import get_repo_slug |
|
10 | from pylons_app.lib.utils import get_repo_slug | |
11 | from pylons_app.model import meta |
|
11 | from pylons_app.model import meta | |
12 | from pylons_app.model.hg_model import HgModel |
|
12 | from pylons_app.model.hg_model import HgModel | |
13 |
from pylons_app import |
|
13 | from pylons_app import __version__ | |
14 |
|
14 | |||
15 | @cache_region('long_term', 'cached_repo_list') |
|
15 | @cache_region('long_term', 'cached_repo_list') | |
16 | def _get_repos_cached(): |
|
16 | def _get_repos_cached(): | |
17 | return [rep for rep in HgModel().get_repos()] |
|
17 | return [rep for rep in HgModel().get_repos()] | |
18 |
|
18 | |||
19 | @cache_region('long_term', 'full_changelog') |
|
19 | @cache_region('long_term', 'full_changelog') | |
20 | def _full_changelog_cached(repo_name): |
|
20 | def _full_changelog_cached(repo_name): | |
21 | return list(reversed(list(HgModel().get_repo(repo_name)))) |
|
21 | return list(reversed(list(HgModel().get_repo(repo_name)))) | |
22 |
|
22 | |||
23 | class BaseController(WSGIController): |
|
23 | class BaseController(WSGIController): | |
24 |
|
24 | |||
25 | def __before__(self): |
|
25 | def __before__(self): | |
26 |
c.hg_app_version = |
|
26 | c.hg_app_version = __version__ | |
27 | c.repos_prefix = config['hg_app_name'] |
|
27 | c.repos_prefix = config['hg_app_name'] | |
28 | c.repo_name = get_repo_slug(request) |
|
28 | c.repo_name = get_repo_slug(request) | |
29 | c.hg_app_user = session.get('hg_app_user', AuthUser()) |
|
29 | c.hg_app_user = session.get('hg_app_user', AuthUser()) | |
30 | c.cached_repo_list = _get_repos_cached() |
|
30 | c.cached_repo_list = _get_repos_cached() | |
31 | self.sa = meta.Session |
|
31 | self.sa = meta.Session | |
32 |
|
32 | |||
33 | def __call__(self, environ, start_response): |
|
33 | def __call__(self, environ, start_response): | |
34 | """Invoke the Controller""" |
|
34 | """Invoke the Controller""" | |
35 | # WSGIController.__call__ dispatches to the Controller method |
|
35 | # WSGIController.__call__ dispatches to the Controller method | |
36 | # the request is routed to. This routing information is |
|
36 | # the request is routed to. This routing information is | |
37 | # available in environ['pylons.routes_dict'] |
|
37 | # available in environ['pylons.routes_dict'] | |
38 | try: |
|
38 | try: | |
39 | return WSGIController.__call__(self, environ, start_response) |
|
39 | return WSGIController.__call__(self, environ, start_response) | |
40 | finally: |
|
40 | finally: | |
41 | meta.Session.remove() |
|
41 | meta.Session.remove() |
General Comments 0
You need to be logged in to leave comments.
Login now