redirect(...,type='auto')

This commit is contained in:
mdipierro
2012-08-08 12:17:54 -05:00
parent c1ac4f4b8b
commit 1c2ad3b331
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.00.0 (2012-08-08 10:23:01) dev
Version 2.00.0 (2012-08-08 12:17:50) dev
+4 -3
View File
@@ -119,9 +119,10 @@ class HTTP(BaseException):
return self.message
def redirect(location, how=303, type=None):
from gluon import current
type = type or ('client' if current.request.ajax else 'http')
def redirect(location, how=303, type='http'):
if type=='auto':
from gluon import current
type = 'client' if current.request.ajax else 'http'
if not location:
return
location = location.replace('\r', '%0D').replace('\n', '%0A')