Author: david.michon
Date: Wed May 27 06:49:29 2009
New Revision: 536
Modified:
branches/electron/pages/utils.py
branches/electron/pages/views.py
Log:
Modified: branches/electron/pages/utils.py
==============================================================================
--- branches/electron/pages/utils.py (original)
+++ branches/electron/pages/utils.py Wed May 27 06:49:29 2009
@@ -92,16 +92,22 @@
def _dec(request, *args, **kwargs):
template_override = kwargs.pop('template_name', None)
only_context = kwargs.pop('only_context', False)
+
if only_context:
# return only context dictionary
response = func(request, *args, **kwargs)
- if isinstance(response, HttpResponse):
+ if isinstance(response, HttpResponse) or isinstance(response,
HttpResponseRedirect) or isinstance(response,
HttpResponsePermanentRedirect):
raise AutoRenderHttpError
(template_name, context) = response
return context
+
response = func(request, *args, **kwargs)
- if isinstance(response, HttpResponse):
+ if isinstance(response, HttpResponse) or isinstance(response,
HttpResponseRedirect) or isinstance(response,
HttpResponsePermanentRedirect):
return response
+
+ if response[1].get('http_redirect', False):
+ return response[1].get('http_redirect')
+
(template_name, context) = response
t = context['template_name'] = template_override or template_name
return render_to_response(t, context,
context_instance=RequestContext(request))
Modified: branches/electron/pages/views.py
==============================================================================
--- branches/electron/pages/views.py (original)
+++ branches/electron/pages/views.py Wed May 27 06:49:29 2009
@@ -46,6 +46,10 @@
if not lang:
lang = get_language_from_request(request, current_page)
+ if current_page.redirect_to_url:
+ # return this object if you want to activate redirections
+ http_redirect =
HttpResponsePermanentRedirect(current_page.redirect_to_url)
+
if current_page.redirect_to:
# return this object if you want to activate redirections
http_redirect = HttpResponsePermanentRedirect(
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---