Show More
@@ -1,119 +1,127 b'' | |||
|
1 | 1 | ################################################################################ |
|
2 | 2 | ################################################################################ |
|
3 | 3 | # pylons_app - Pylons environment configuration # |
|
4 | 4 | # # |
|
5 | 5 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
6 | 6 | ################################################################################ |
|
7 | 7 | |
|
8 | 8 | [DEFAULT] |
|
9 | 9 | debug = true |
|
10 | 10 | ############################################ |
|
11 | 11 | ## Uncomment and replace with the address ## |
|
12 | 12 | ## which should receive any error reports ## |
|
13 | 13 | ############################################ |
|
14 | 14 | #email_to = marcin.kuzminski@etelko.pl |
|
15 | 15 | #smtp_server = mail.etelko.pl |
|
16 | 16 | #error_email_from = paste_error@localhost |
|
17 | 17 | #smtp_username = |
|
18 | 18 | #smtp_password = |
|
19 | 19 | #error_message = 'mercurial crash !' |
|
20 | 20 | |
|
21 | 21 | [server:main] |
|
22 | ##nr of threads to spawn | |
|
22 | 23 | threadpool_workers = 5 |
|
24 | ||
|
25 | ##max request before | |
|
26 | threadpool_max_requests = 2 | |
|
27 | ||
|
28 | ##option to use threads of process | |
|
29 | use_threadpool = true | |
|
30 | ||
|
23 | 31 | use = egg:Paste#http |
|
24 | 32 | host = 127.0.0.1 |
|
25 | 33 | port = 5000 |
|
26 | 34 | |
|
27 | 35 | [app:main] |
|
28 | 36 | use = egg:pylons_app |
|
29 | 37 | full_stack = true |
|
30 | 38 | static_files = true |
|
31 | 39 | lang=en |
|
32 | 40 | cache_dir = %(here)s/data |
|
33 | 41 | repos_name = Python-works |
|
34 | 42 | |
|
35 | 43 | #################################### |
|
36 | 44 | ### BEAKER CACHE #### |
|
37 | 45 | #################################### |
|
38 | 46 | beaker.cache.data_dir=/tmp/cache/data |
|
39 | 47 | beaker.cache.lock_dir=/tmp/cache/lock |
|
40 | 48 | beaker.cache.regions=short_term |
|
41 | 49 | beaker.cache.short_term.type=memory |
|
42 | 50 | beaker.cache.short_term.expire=3600 |
|
43 | 51 | |
|
44 | 52 | ################################################################################ |
|
45 | 53 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
46 | 54 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
47 | 55 | ## execute malicious code after an exception is raised. ## |
|
48 | 56 | ################################################################################ |
|
49 | 57 | #set debug = false |
|
50 | 58 | |
|
51 | 59 | ################################## |
|
52 | 60 | ### LOGVIEW CONFIG ### |
|
53 | 61 | ################################## |
|
54 | 62 | logview.sqlalchemy = #faa |
|
55 | 63 | logview.pylons.templating = #bfb |
|
56 | 64 | logview.pylons.util = #eee |
|
57 | 65 | |
|
58 | 66 | ######################################################### |
|
59 | 67 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
60 | 68 | ######################################################### |
|
61 | 69 | sqlalchemy.db1.url = sqlite:///%(here)s/hg_app.db |
|
62 | 70 | #sqlalchemy.db1.echo = True |
|
63 | 71 | #sqlalchemy.db1.pool_recycle = 3600 |
|
64 | 72 | sqlalchemy.convert_unicode = true |
|
65 | 73 | |
|
66 | 74 | ################################ |
|
67 | 75 | ### LOGGING CONFIGURATION #### |
|
68 | 76 | ################################ |
|
69 | 77 | [loggers] |
|
70 | 78 | keys = root, routes, pylons_app, sqlalchemy |
|
71 | 79 | |
|
72 | 80 | [handlers] |
|
73 | 81 | keys = console |
|
74 | 82 | |
|
75 | 83 | [formatters] |
|
76 | 84 | keys = generic |
|
77 | 85 | |
|
78 | 86 | ############# |
|
79 | 87 | ## LOGGERS ## |
|
80 | 88 | ############# |
|
81 | 89 | [logger_root] |
|
82 | 90 | level = NOTSET |
|
83 | 91 | handlers = console |
|
84 | 92 | |
|
85 | 93 | [logger_routes] |
|
86 | 94 | level = DEBUG |
|
87 | 95 | handlers = console |
|
88 | 96 | qualname = routes.middleware |
|
89 | 97 | # "level = DEBUG" logs the route matched and routing variables. |
|
90 | 98 | |
|
91 | 99 | [logger_pylons_app] |
|
92 | 100 | level = DEBUG |
|
93 | 101 | handlers = console |
|
94 | 102 | qualname = pylons_app |
|
95 | 103 | |
|
96 | 104 | |
|
97 | 105 | [logger_sqlalchemy] |
|
98 | 106 | level = DEBUG |
|
99 | 107 | handlers = console |
|
100 | 108 | qualname = sqlalchemy.engine |
|
101 | 109 | |
|
102 | 110 | ############## |
|
103 | 111 | ## HANDLERS ## |
|
104 | 112 | ############## |
|
105 | 113 | |
|
106 | 114 | [handler_console] |
|
107 | 115 | class = StreamHandler |
|
108 | 116 | args = (sys.stderr,) |
|
109 | 117 | level = NOTSET |
|
110 | 118 | formatter = generic |
|
111 | 119 | |
|
112 | 120 | ################ |
|
113 | 121 | ## FORMATTERS ## |
|
114 | 122 | ################ |
|
115 | 123 | |
|
116 | 124 | [formatter_generic] |
|
117 | 125 | format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
118 | 126 | datefmt = %Y-%m-%d %H:%M:%S |
|
119 | 127 |
@@ -1,119 +1,127 b'' | |||
|
1 | 1 | ################################################################################ |
|
2 | 2 | ################################################################################ |
|
3 | 3 | # pylons_app - Pylons environment configuration # |
|
4 | 4 | # # |
|
5 | 5 | # The %(here)s variable will be replaced with the parent directory of this file# |
|
6 | 6 | ################################################################################ |
|
7 | 7 | |
|
8 | 8 | [DEFAULT] |
|
9 | 9 | debug = true |
|
10 | 10 | ############################################ |
|
11 | 11 | ## Uncomment and replace with the address ## |
|
12 | 12 | ## which should receive any error reports ## |
|
13 | 13 | ############################################ |
|
14 | 14 | #email_to = marcin.kuzminski@etelko.pl |
|
15 | 15 | #smtp_server = mail.etelko.pl |
|
16 | 16 | #error_email_from = paste_error@localhost |
|
17 | 17 | #smtp_username = |
|
18 | 18 | #smtp_password = |
|
19 | 19 | #error_message = 'mercurial crash !' |
|
20 | 20 | |
|
21 | 21 | [server:main] |
|
22 | threadpool_workers = 10 | |
|
22 | ##nr of threads to spawn | |
|
23 | threadpool_workers = 5 | |
|
24 | ||
|
25 | ##max request before | |
|
26 | threadpool_max_requests = 2 | |
|
27 | ||
|
28 | ##option to use threads of process | |
|
29 | use_threadpool = true | |
|
30 | ||
|
23 | 31 | use = egg:Paste#http |
|
24 | 32 | host = 127.0.0.1 |
|
25 | 33 | port = 8001 |
|
26 | 34 | |
|
27 | 35 | [app:main] |
|
28 | 36 | use = egg:pylons_app |
|
29 | 37 | full_stack = true |
|
30 | 38 | static_files = true |
|
31 | 39 | lang=en |
|
32 | 40 | cache_dir = %(here)s/data |
|
33 | 41 | repos_name = Python-works |
|
34 | 42 | |
|
35 | 43 | #################################### |
|
36 | 44 | ### BEAKER CACHE #### |
|
37 | 45 | #################################### |
|
38 | 46 | beaker.cache.data_dir=/tmp/cache/data |
|
39 | 47 | beaker.cache.lock_dir=/tmp/cache/lock |
|
40 | 48 | beaker.cache.regions=short_term |
|
41 | 49 | beaker.cache.short_term.type=memory |
|
42 | 50 | beaker.cache.short_term.expire=3600 |
|
43 | 51 | |
|
44 | 52 | ################################################################################ |
|
45 | 53 | ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ## |
|
46 | 54 | ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ## |
|
47 | 55 | ## execute malicious code after an exception is raised. ## |
|
48 | 56 | ################################################################################ |
|
49 | 57 | set debug = false |
|
50 | 58 | |
|
51 | 59 | ################################## |
|
52 | 60 | ### LOGVIEW CONFIG ### |
|
53 | 61 | ################################## |
|
54 | 62 | logview.sqlalchemy = #faa |
|
55 | 63 | logview.pylons.templating = #bfb |
|
56 | 64 | logview.pylons.util = #eee |
|
57 | 65 | |
|
58 | 66 | ######################################################### |
|
59 | 67 | ### DB CONFIGS - EACH DB WILL HAVE IT'S OWN CONFIG ### |
|
60 | 68 | ######################################################### |
|
61 | 69 | sqlalchemy.db1.url = sqlite:///%(here)s/hg_app.db |
|
62 | 70 | #sqlalchemy.db1.echo = True |
|
63 | 71 | #sqlalchemy.db1.pool_recycle = 3600 |
|
64 | 72 | sqlalchemy.convert_unicode = true |
|
65 | 73 | |
|
66 | 74 | ################################ |
|
67 | 75 | ### LOGGING CONFIGURATION #### |
|
68 | 76 | ################################ |
|
69 | 77 | [loggers] |
|
70 | 78 | keys = root, routes, pylons_app, sqlalchemy |
|
71 | 79 | |
|
72 | 80 | [handlers] |
|
73 | 81 | keys = console |
|
74 | 82 | |
|
75 | 83 | [formatters] |
|
76 | 84 | keys = generic |
|
77 | 85 | |
|
78 | 86 | ############# |
|
79 | 87 | ## LOGGERS ## |
|
80 | 88 | ############# |
|
81 | 89 | [logger_root] |
|
82 | 90 | level = INFO |
|
83 | 91 | handlers = console |
|
84 | 92 | |
|
85 | 93 | [logger_routes] |
|
86 | 94 | level = INFO |
|
87 | 95 | handlers = console |
|
88 | 96 | qualname = routes.middleware |
|
89 | 97 | # "level = DEBUG" logs the route matched and routing variables. |
|
90 | 98 | |
|
91 | 99 | [logger_pylons_app] |
|
92 | 100 | level = DEBUG |
|
93 | 101 | handlers = console |
|
94 | 102 | qualname = pylons_app |
|
95 | 103 | |
|
96 | 104 | |
|
97 | 105 | [logger_sqlalchemy] |
|
98 | 106 | level = DEBUG |
|
99 | 107 | handlers = console |
|
100 | 108 | qualname = sqlalchemy.engine |
|
101 | 109 | |
|
102 | 110 | ############## |
|
103 | 111 | ## HANDLERS ## |
|
104 | 112 | ############## |
|
105 | 113 | |
|
106 | 114 | [handler_console] |
|
107 | 115 | class = StreamHandler |
|
108 | 116 | args = (sys.stderr,) |
|
109 | 117 | level = NOTSET |
|
110 | 118 | formatter = generic |
|
111 | 119 | |
|
112 | 120 | ################ |
|
113 | 121 | ## FORMATTERS ## |
|
114 | 122 | ################ |
|
115 | 123 | |
|
116 | 124 | [formatter_generic] |
|
117 | 125 | format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s |
|
118 | 126 | datefmt = %Y-%m-%d %H:%M:%S |
|
119 | 127 |
@@ -1,70 +1,69 b'' | |||
|
1 | 1 | """Pylons middleware initialization""" |
|
2 | 2 | from beaker.middleware import SessionMiddleware |
|
3 | 3 | from paste.cascade import Cascade |
|
4 | 4 | from paste.registry import RegistryManager |
|
5 | 5 | from paste.urlparser import StaticURLParser |
|
6 | 6 | from paste.deploy.converters import asbool |
|
7 | 7 | from pylons.middleware import ErrorHandler, StatusCodeRedirect |
|
8 | 8 | from pylons.wsgiapp import PylonsApp |
|
9 | 9 | from routes.middleware import RoutesMiddleware |
|
10 | 10 | from paste.auth.basic import AuthBasicHandler |
|
11 | 11 | from pylons_app.config.environment import load_environment |
|
12 | 12 | from pylons_app.lib.auth import authfunc |
|
13 | 13 | |
|
14 | 14 | def make_app(global_conf, full_stack=True, static_files=True, **app_conf): |
|
15 | 15 | """Create a Pylons WSGI application and return it |
|
16 | 16 | |
|
17 | 17 | ``global_conf`` |
|
18 | 18 | The inherited configuration for this application. Normally from |
|
19 | 19 | the [DEFAULT] section of the Paste ini file. |
|
20 | 20 | |
|
21 | 21 | ``full_stack`` |
|
22 | 22 | Whether or not this application provides a full WSGI stack (by |
|
23 | 23 | default, meaning it handles its own exceptions and errors). |
|
24 | 24 | Disable full_stack when this application is "managed" by |
|
25 | 25 | another WSGI middleware. |
|
26 | 26 | |
|
27 | 27 | ``app_conf`` |
|
28 | 28 | The application's local configuration. Normally specified in |
|
29 | 29 | the [app:<name>] section of the Paste ini file (where <name> |
|
30 | 30 | defaults to main). |
|
31 | 31 | |
|
32 | 32 | """ |
|
33 | 33 | # Configure the Pylons environment |
|
34 | 34 | config = load_environment(global_conf, app_conf) |
|
35 | 35 | |
|
36 | 36 | |
|
37 | 37 | # The Pylons WSGI app |
|
38 | 38 | app = PylonsApp(config=config) |
|
39 | 39 | |
|
40 | 40 | # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) |
|
41 | 41 | |
|
42 | 42 | # Routing/Session/Cache Middleware |
|
43 | 43 | app = RoutesMiddleware(app, config['routes.map']) |
|
44 | 44 | app = SessionMiddleware(app, config) |
|
45 | 45 | app = AuthBasicHandler(app, config['repos_name'] + ' mercurial repository', authfunc) |
|
46 | 46 | |
|
47 | 47 | if asbool(full_stack): |
|
48 | 48 | # Handle Python exceptions |
|
49 | 49 | app = ErrorHandler(app, global_conf, **config['pylons.errorware']) |
|
50 | 50 | |
|
51 | 51 | # Display error documents for 401, 403, 404 status codes (and |
|
52 | 52 | # 500 when debug is disabled) |
|
53 | 53 | if asbool(config['debug']): |
|
54 | #don't handle 404, since mercurial does it for us. | |
|
55 | app = StatusCodeRedirect(app, [400, 401, 403]) | |
|
54 | app = StatusCodeRedirect(app) | |
|
56 | 55 | else: |
|
57 | app = StatusCodeRedirect(app, [400, 401, 403, 500]) | |
|
56 | app = StatusCodeRedirect(app, [400, 401, 403, 404, 500]) | |
|
58 | 57 | |
|
59 | 58 | # Establish the Registry for this application |
|
60 | 59 | app = RegistryManager(app) |
|
61 | 60 | |
|
62 | 61 | if asbool(static_files): |
|
63 | 62 | # Serve static files |
|
64 | 63 | static_app = StaticURLParser(config['pylons.paths']['static_files']) |
|
65 | 64 | app = Cascade([static_app, app]) |
|
66 | 65 | |
|
67 | 66 | app.config = config |
|
68 | 67 | |
|
69 | 68 | return app |
|
70 | 69 |
@@ -1,35 +1,34 b'' | |||
|
1 | 1 | import logging |
|
2 | 2 | |
|
3 | 3 | from pylons import tmpl_context as c, app_globals as g, session, request, config, url |
|
4 | 4 | from pylons.controllers.util import abort, redirect |
|
5 | 5 | |
|
6 | 6 | from pylons_app.lib.base import BaseController, render |
|
7 | 7 | from pylons_app.lib.utils import get_repo_slug |
|
8 | 8 | from pylons_app.model.hg_model import HgModel |
|
9 | 9 | from webhelpers.paginate import Page |
|
10 | ||
|
10 | 11 | log = logging.getLogger(__name__) |
|
11 | 12 | |
|
12 | 13 | class ShortlogController(BaseController): |
|
13 | 14 | def __before__(self): |
|
14 | 15 | c.repos_prefix = config['repos_name'] |
|
15 | 16 | c.staticurl = g.statics |
|
16 | 17 | c.repo_name = get_repo_slug(request) |
|
17 | 18 | |
|
18 | 19 | |
|
19 | 20 | def index(self): |
|
20 | 21 | hg_model = HgModel() |
|
21 | 22 | lim = 20 |
|
22 | 23 | p = int(request.params.get('page', 1)) |
|
23 | 24 | repo = hg_model.get_repo(c.repo_name) |
|
24 | 25 | cnt = repo.revisions[-1] |
|
25 | 26 | gen = repo.get_changesets(None) |
|
26 | 27 | repo_changesets = list(gen) |
|
27 | repo_changesets2 = list(gen) | |
|
28 | repo_changesets3 = list(gen) | |
|
29 | repo_changesets4 = list(gen) | |
|
30 | 28 | |
|
31 | 29 | c.repo_changesets = Page(repo_changesets, page=p, item_count=cnt, items_per_page=lim) |
|
32 | 30 | c.shortlog_data = render('shortlog_data.html') |
|
33 | 31 | if request.params.get('partial'): |
|
34 | 32 | return c.shortlog_data |
|
35 |
r |
|
|
33 | r = render('/shortlog.html') | |
|
34 | return r |
General Comments 0
You need to be logged in to leave comments.
Login now