##// END OF EJS Templates
exc-tracker: make context attribute behave like in API case...
marcink -
r4277:0d8d4107 default
parent child Browse files
Show More
@@ -283,7 +283,7 b' def get_current_lang(request):'
283 return getattr(request, '_LOCALE_', request.locale_name)
283 return getattr(request, '_LOCALE_', request.locale_name)
284
284
285
285
286 def attach_context_attributes(context, request, user_id=None):
286 def attach_context_attributes(context, request, user_id=None, is_api=None):
287 """
287 """
288 Attach variables into template context called `c`.
288 Attach variables into template context called `c`.
289 """
289 """
@@ -379,6 +379,7 b' def attach_context_attributes(context, r'
379 "sideside": "sideside"
379 "sideside": "sideside"
380 }.get(request.GET.get('diffmode'))
380 }.get(request.GET.get('diffmode'))
381
381
382 if is_api is not None:
382 is_api = hasattr(request, 'rpc_user')
383 is_api = hasattr(request, 'rpc_user')
383 session_attrs = {
384 session_attrs = {
384 # defaults
385 # defaults
@@ -119,7 +119,10 b' def send_exc_email(exc_id, exc_type_name'
119 log.debug('Sending Email exception to: `%s`', recipients or 'all super admins')
119 log.debug('Sending Email exception to: `%s`', recipients or 'all super admins')
120
120
121 # NOTE(marcink): needed for email template rendering
121 # NOTE(marcink): needed for email template rendering
122 attach_context_attributes(TemplateArgs(), request, request.user.user_id)
122 user_id = None
123 if request:
124 user_id = request.user.user_id
125 attach_context_attributes(TemplateArgs(), request, user_id=user_id, is_api=True)
123
126
124 email_kwargs = {
127 email_kwargs = {
125 'email_prefix': app.CONFIG.get('exception_tracker.email_prefix', '') or '[RHODECODE ERROR]',
128 'email_prefix': app.CONFIG.get('exception_tracker.email_prefix', '') or '[RHODECODE ERROR]',
General Comments 0
You need to be logged in to leave comments. Login now