##// END OF EJS Templates
templateContext: allow for flexible way to communicate additional info for client code from controllers
ergo -
r394:c560756c default
parent child Browse files
Show More
@@ -640,6 +640,9 b' class PullrequestsController(BaseRepoCon'
640 pull_request_id = safe_int(pull_request_id)
640 pull_request_id = safe_int(pull_request_id)
641 c.pull_request = PullRequest.get_or_404(pull_request_id)
641 c.pull_request = PullRequest.get_or_404(pull_request_id)
642
642
643 if hasattr(c, 'pylons_dispatch_info'):
644 c.pylons_dispatch_info['extra']['pull_request'] = pull_request_id
645
643 # pull_requests repo_name we opened it against
646 # pull_requests repo_name we opened it against
644 # ie. target_repo must match
647 # ie. target_repo must match
645 if repo_name != c.pull_request.target_repo.repo_name:
648 if repo_name != c.pull_request.target_repo.repo_name:
@@ -425,6 +425,12 b' class BaseController(WSGIController):'
425 _route_name = '.'.join([environ['pylons.routes_dict']['controller'],
425 _route_name = '.'.join([environ['pylons.routes_dict']['controller'],
426 environ['pylons.routes_dict']['action']])
426 environ['pylons.routes_dict']['action']])
427
427
428 c.pylons_dispatch_info = {
429 'controller': environ['pylons.routes_dict']['controller'],
430 'action': environ['pylons.routes_dict']['action'],
431 'extra': {'plugins': {}}
432 }
433
428 self.rc_config = SettingsModel().get_all_settings(cache=True)
434 self.rc_config = SettingsModel().get_all_settings(cache=True)
429 self.ip_addr = get_ip_addr(environ)
435 self.ip_addr = get_ip_addr(environ)
430
436
@@ -69,6 +69,7 b' from webhelpers2.number import format_by'
69
69
70 from rhodecode.lib.annotate import annotate_highlight
70 from rhodecode.lib.annotate import annotate_highlight
71 from rhodecode.lib.action_parser import action_parser
71 from rhodecode.lib.action_parser import action_parser
72 from rhodecode.lib.ext_json import json
72 from rhodecode.lib.utils import repo_name_slug, get_custom_lexer
73 from rhodecode.lib.utils import repo_name_slug, get_custom_lexer
73 from rhodecode.lib.utils2 import str2bool, safe_unicode, safe_str, \
74 from rhodecode.lib.utils2 import str2bool, safe_unicode, safe_str, \
74 get_commit_safe, datetime_to_time, time_to_datetime, time_to_utcdatetime, \
75 get_commit_safe, datetime_to_time, time_to_datetime, time_to_utcdatetime, \
@@ -45,7 +45,8 b''
45 timeago: {
45 timeago: {
46 refresh_time: ${120 * 1000},
46 refresh_time: ${120 * 1000},
47 cutoff_limit: ${1000*60*60*24*7}
47 cutoff_limit: ${1000*60*60*24*7}
48 }
48 },
49 dispatch_info: ${h.json.dumps(getattr(c, 'pylons_dispatch_info', {}))|n}
49 }
50 }
50
51
51 </%def>
52 </%def>
General Comments 0
You need to be logged in to leave comments. Login now