1 from zope.interface import implements
2 import os
3 from nevow import rend, loaders, guard, inevow, url
4 from webut.skin import iskin
5 from ldaptor.apps.webui import i18n
6 from ldaptor.apps.webui.i18n import _
7
9 action = current
10 if len(history) == 1:
11 action = action.here()
12 else:
13 for element in history[1:]:
14 action = action.parentdir()
15
16 action = action.child(guard.LOGIN_AVATAR)
17 for element in history:
18 action = action.child(element)
19 return action
20
21 -class LoginPage(rend.Page):
22 """The resource that is returned when you are not logged in"""
23
24 implements(iskin.ISkinnable)
25
26 title = _('Login')
27
28 docFactory = loaders.xmlfile(
29 'login.xhtml',
30 templateDir=os.path.split(os.path.abspath(__file__))[0])
31
32 - def __init__(self, history):
33 self.history = history
34 super(LoginPage, self).__init__()
35
36 - def locateChild(self, request, segments):
37 return LoginPage(self.history + list(segments)), []
38
40 current = url.URL.fromContext(context)
41 action = getActionURL(current, self.history)
42 context.fillSlots('action-url', str(action))
43 return context.tag
44
45 render_i18n = i18n.render()
46