Changeset 4170
- Timestamp:
- 02/29/08 18:28:01 (9 months ago)
- Files:
-
- branches/1.0/turbogears/qstemplates/quickstartbig/+package+/controllers/root.py_tmpl (modified) (2 diffs)
- branches/1.0/turbogears/qstemplates/quickstart/+package+/controllers.py_tmpl (modified) (3 diffs)
- branches/1.1/turbogears/qstemplates/quickstartbig/+package+/controllers/root.py_tmpl (modified) (2 diffs)
- branches/1.1/turbogears/qstemplates/quickstart/+package+/controllers.py_tmpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/turbogears/qstemplates/quickstartbig/+package+/controllers/root.py_tmpl
r3840 r4170 1 import turbogears as tg 1 2 from turbogears import controllers, expose, flash 2 3 # from ${package} import model … … 48 49 def login(self, forward_url=None, previous_url=None, *args, **kw): 49 50 50 if not identity.current.anonymous \ 51 and identity.was_login_attempted() \ 52 and not identity.get_identity_errors(): 53 raise redirect(forward_url) 51 if not identity.current.anonymous and identity.was_login_attempted() \ 52 and not identity.get_identity_errors(): 53 raise redirect(tg.url(forward_url or previous_url or '/', kw)) 54 54 55 forward_url =None56 previous_url = request.path55 forward_url = None 56 previous_url = request.path 57 57 58 58 if identity.was_login_attempted(): 59 msg =_("The credentials you supplied were not correct or "59 msg = _("The credentials you supplied were not correct or " 60 60 "did not grant access to this resource.") 61 61 elif identity.get_identity_errors(): 62 msg =_("You must provide your credentials before accessing "62 msg = _("You must provide your credentials before accessing " 63 63 "this resource.") 64 64 else: 65 msg =_("Please log in.")66 forward_url = request.headers.get("Referer", "/")65 msg = _("Please log in.") 66 forward_url = request.headers.get("Referer", "/") 67 67 68 response.status =40368 response.status = 403 69 69 return dict(message=msg, previous_url=previous_url, logging_in=True, 70 original_parameters=request.params, 71 forward_url=forward_url) 70 original_parameters=request.params, forward_url=forward_url) 72 71 73 72 ${b}expose()${e} branches/1.0/turbogears/qstemplates/quickstart/+package+/controllers.py_tmpl
r4117 r4170 1 import turbogears as tg 1 2 from turbogears import controllers, expose, flash 2 import turbogears as tg3 3 # from ${package} import model 4 4 #if $sqlobject == 'True' … … 50 50 51 51 if not identity.current.anonymous and identity.was_login_attempted() \ 52 and not identity.get_identity_errors(): 53 if forward_url: 54 raise redirect(tg.url(forward_url, kw)) 55 56 elif previous_url: 57 raise redirect(tg.url(previous_url, kw)) 58 59 else: 60 raise redirect(tg.url('/')) 52 and not identity.get_identity_errors(): 53 raise redirect(tg.url(forward_url or previous_url or '/', kw)) 61 54 62 55 forward_url = None … … 64 57 65 58 if identity.was_login_attempted(): 66 msg =_("The credentials you supplied were not correct or "59 msg = _("The credentials you supplied were not correct or " 67 60 "did not grant access to this resource.") 68 61 elif identity.get_identity_errors(): 69 msg =_("You must provide your credentials before accessing "62 msg = _("You must provide your credentials before accessing " 70 63 "this resource.") 71 64 else: 72 msg=_("Please log in.") 65 msg = _("Please log in.") 66 forward_url = request.headers.get("Referer", "/") 73 67 74 68 response.status = 403 75 69 return dict(message=msg, previous_url=previous_url, logging_in=True, 76 original_parameters=request.params, 77 forward_url=forward_url) 70 original_parameters=request.params, forward_url=forward_url) 78 71 79 72 ${b}expose()${e} branches/1.1/turbogears/qstemplates/quickstartbig/+package+/controllers/root.py_tmpl
r4050 r4170 1 import turbogears as tg 1 2 from turbogears import controllers, expose, flash 2 3 # from ${package} import model … … 48 49 def login(self, forward_url=None, previous_url=None, *args, **kw): 49 50 50 if not identity.current.anonymous \ 51 and identity.was_login_attempted() \ 52 and not identity.get_identity_errors(): 53 raise redirect(forward_url) 51 if not identity.current.anonymous and identity.was_login_attempted() \ 52 and not identity.get_identity_errors(): 53 raise redirect(tg.url(forward_url or previous_url or '/', kw)) 54 54 55 forward_url =None56 previous_url = request.path55 forward_url = None 56 previous_url = request.path 57 57 58 58 if identity.was_login_attempted(): 59 msg =_("The credentials you supplied were not correct or "59 msg = _("The credentials you supplied were not correct or " 60 60 "did not grant access to this resource.") 61 61 elif identity.get_identity_errors(): 62 msg =_("You must provide your credentials before accessing "62 msg = _("You must provide your credentials before accessing " 63 63 "this resource.") 64 64 else: 65 msg =_("Please log in.")66 forward_url = request.headers.get("Referer", "/")65 msg = _("Please log in.") 66 forward_url = request.headers.get("Referer", "/") 67 67 68 response.status =40368 response.status = 403 69 69 return dict(message=msg, previous_url=previous_url, logging_in=True, 70 original_parameters=request.params, 71 forward_url=forward_url) 70 original_parameters=request.params, forward_url=forward_url) 72 71 73 72 ${b}expose()${e} branches/1.1/turbogears/qstemplates/quickstart/+package+/controllers.py_tmpl
r4050 r4170 1 import turbogears as tg 1 2 from turbogears import controllers, expose, flash 2 3 # from ${package} import model … … 48 49 def login(self, forward_url=None, previous_url=None, *args, **kw): 49 50 50 if not identity.current.anonymous \ 51 and identity.was_login_attempted() \ 52 and not identity.get_identity_errors(): 53 raise redirect(forward_url) 51 if not identity.current.anonymous and identity.was_login_attempted() \ 52 and not identity.get_identity_errors(): 53 raise redirect(tg.url(forward_url or previous_url or '/', kw)) 54 54 55 forward_url =None56 previous_url = request.path55 forward_url = None 56 previous_url = request.path 57 57 58 58 if identity.was_login_attempted(): 59 msg =_("The credentials you supplied were not correct or "59 msg = _("The credentials you supplied were not correct or " 60 60 "did not grant access to this resource.") 61 61 elif identity.get_identity_errors(): 62 msg =_("You must provide your credentials before accessing "62 msg = _("You must provide your credentials before accessing " 63 63 "this resource.") 64 64 else: 65 msg =_("Please log in.")66 forward_url = request.headers.get("Referer", "/")65 msg = _("Please log in.") 66 forward_url = request.headers.get("Referer", "/") 67 67 68 response.status =40368 response.status = 403 69 69 return dict(message=msg, previous_url=previous_url, logging_in=True, 70 original_parameters=request.params, 71 forward_url=forward_url) 70 original_parameters=request.params, forward_url=forward_url) 72 71 73 72 ${b}expose()${e}