src/ztfy/myams/login.py
changeset 98 eaa18e1a6cab
parent 89 46a5924b4229
equal deleted inserted replaced
97:0f1415f3d46a 98:eaa18e1a6cab
     9 # import Zope3 interfaces
     9 # import Zope3 interfaces
    10 from z3c.form.interfaces import HIDDEN_MODE, IErrorViewSnippet
    10 from z3c.form.interfaces import HIDDEN_MODE, IErrorViewSnippet
    11 from z3c.json.interfaces import IJSONWriter
    11 from z3c.json.interfaces import IJSONWriter
    12 from zope.authentication.interfaces import IAuthentication
    12 from zope.authentication.interfaces import IAuthentication
    13 from zope.component.interfaces import ISite
    13 from zope.component.interfaces import ISite
    14 from zope.publisher.browser import BrowserPage
       
    15 from zope.security.interfaces import IUnauthorized
    14 from zope.security.interfaces import IUnauthorized
    16 from zope.session.interfaces import ISession
    15 from zope.session.interfaces import ISession
    17 
    16 
    18 # import local interfaces
    17 # import local interfaces
    19 from ztfy.baseskin.interfaces import IDefaultView, IDialog
    18 from ztfy.baseskin.interfaces import IDefaultView, IDialog
    20 from ztfy.baseskin.viewlet import ContentProviderBase
       
    21 from ztfy.myams.interfaces import IModalFullPage
    19 from ztfy.myams.interfaces import IModalFullPage
    22 
    20 
    23 # import Zope3 packages
    21 # import Zope3 packages
    24 from z3c.form import field, button
    22 from z3c.form import field, button
    25 from z3c.formjs import ajax
    23 from z3c.formjs import ajax
    26 from zope.component import adapts, getUtility, getUtilitiesFor, getMultiAdapter, queryMultiAdapter
    24 from zope.component import adapts, getUtility, getUtilitiesFor, getMultiAdapter, queryMultiAdapter
    27 from zope.interface import implements, Interface, Invalid
    25 from zope.interface import implements, Interface, Invalid
       
    26 from zope.publisher.browser import BrowserPage
    28 from zope.schema import TextLine, Password
    27 from zope.schema import TextLine, Password
    29 from zope.site import hooks
    28 from zope.site import hooks
    30 from zope.traversing.browser.absoluteurl import absoluteURL
    29 from zope.traversing.browser.absoluteurl import absoluteURL
    31 
    30 
    32 # import local packages
    31 # import local packages
       
    32 from ztfy.baseskin.viewlet import ContentProviderBase
    33 from ztfy.myams.form import AddForm
    33 from ztfy.myams.form import AddForm
    34 from ztfy.myams.layer import MyAMSLayer
    34 from ztfy.myams.layer import MyAMSLayer
    35 from ztfy.utils.traversing import getParent
    35 from ztfy.utils.traversing import getParent
    36 
    36 
    37 from ztfy.myams import _
    37 from ztfy.myams import _
   187                     auth.logout(self.request)
   187                     auth.logout(self.request)
   188             finally:
   188             finally:
   189                 hooks.setSite(old_site)
   189                 hooks.setSite(old_site)
   190             context = getParent(context, ISite, allow_context=False)
   190             context = getParent(context, ISite, allow_context=False)
   191         target = queryMultiAdapter((self.context, self.request, Interface), IDefaultView)
   191         target = queryMultiAdapter((self.context, self.request, Interface), IDefaultView)
   192         self.request.response.redirect(target.viewname if target is not None else '@@index.html')
   192         self.request.response.redirect('%s/%s' % (absoluteURL(self.context, self.request),
       
   193                                                   target.viewname if target is not None else '@@index.html'))
   193         return u''
   194         return u''