Changeset 4170

Show
Ignore:
Timestamp:
02/29/08 18:28:01 (9 months ago)
Author:
chrisz
Message:

Merging r4105 and r4117 from 1.0 to 1.1 and from quickstart to quickstartbig.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/turbogears/qstemplates/quickstartbig/+package+/controllers/root.py_tmpl

    r3840 r4170  
     1import turbogears as tg 
    12from turbogears import controllers, expose, flash 
    23# from ${package} import model 
     
    4849    def login(self, forward_url=None, previous_url=None, *args, **kw): 
    4950 
    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)) 
    5454 
    55         forward_url=None 
    56         previous_url= request.path 
     55        forward_url = None 
     56        previous_url = request.path 
    5757 
    5858        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 " 
    6060                   "did not grant access to this resource.") 
    6161        elif identity.get_identity_errors(): 
    62             msg=_("You must provide your credentials before accessing " 
     62            msg = _("You must provide your credentials before accessing " 
    6363                   "this resource.") 
    6464        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", "/") 
    6767 
    68         response.status=403 
     68        response.status = 403 
    6969        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) 
    7271 
    7372    ${b}expose()${e} 
  • branches/1.0/turbogears/qstemplates/quickstart/+package+/controllers.py_tmpl

    r4117 r4170  
     1import turbogears as tg 
    12from turbogears import controllers, expose, flash 
    2 import turbogears as tg 
    33# from ${package} import model 
    44#if $sqlobject == 'True' 
     
    5050 
    5151        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)) 
    6154 
    6255        forward_url = None 
     
    6457 
    6558        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 " 
    6760                   "did not grant access to this resource.") 
    6861        elif identity.get_identity_errors(): 
    69             msg=_("You must provide your credentials before accessing " 
     62            msg = _("You must provide your credentials before accessing " 
    7063                   "this resource.") 
    7164        else: 
    72             msg=_("Please log in.") 
     65            msg = _("Please log in.") 
     66            forward_url = request.headers.get("Referer", "/") 
    7367 
    7468        response.status = 403 
    7569        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) 
    7871 
    7972    ${b}expose()${e} 
  • branches/1.1/turbogears/qstemplates/quickstartbig/+package+/controllers/root.py_tmpl

    r4050 r4170  
     1import turbogears as tg 
    12from turbogears import controllers, expose, flash 
    23# from ${package} import model 
     
    4849    def login(self, forward_url=None, previous_url=None, *args, **kw): 
    4950 
    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)) 
    5454 
    55         forward_url=None 
    56         previous_url= request.path 
     55        forward_url = None 
     56        previous_url = request.path 
    5757 
    5858        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 " 
    6060                   "did not grant access to this resource.") 
    6161        elif identity.get_identity_errors(): 
    62             msg=_("You must provide your credentials before accessing " 
     62            msg = _("You must provide your credentials before accessing " 
    6363                   "this resource.") 
    6464        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", "/") 
    6767 
    68         response.status=403 
     68        response.status = 403 
    6969        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) 
    7271 
    7372    ${b}expose()${e} 
  • branches/1.1/turbogears/qstemplates/quickstart/+package+/controllers.py_tmpl

    r4050 r4170  
     1import turbogears as tg 
    12from turbogears import controllers, expose, flash 
    23# from ${package} import model 
     
    4849    def login(self, forward_url=None, previous_url=None, *args, **kw): 
    4950 
    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)) 
    5454 
    55         forward_url=None 
    56         previous_url= request.path 
     55        forward_url = None 
     56        previous_url = request.path 
    5757 
    5858        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 " 
    6060                   "did not grant access to this resource.") 
    6161        elif identity.get_identity_errors(): 
    62             msg=_("You must provide your credentials before accessing " 
     62            msg = _("You must provide your credentials before accessing " 
    6363                   "this resource.") 
    6464        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", "/") 
    6767 
    68         response.status=403 
     68        response.status = 403 
    6969        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) 
    7271 
    7372    ${b}expose()${e}