[Twisted-web] Newov Login Forward

noema mailinglists at shechen.at
Tue Feb 22 01:00:46 MST 2005


I think an answer to the following issue could be useful for many 
people: (1) When I have a login page resource like the one listed here 
how can I return another page than the root one? (2) How can I return a 
certain page resource depending on the username?

hoping somebody knows that,
#noema

PS: Will post an article to the wiki if someone enlightens me


class LoginPage(rend.Page):
   def __init__(self, name):
     rend.Page.__init__(self)
     self.name = name

   docFactory = loaders.stan(
     tags.html[
     tags.head[tags.title["Not Logged In"]],
     tags.body[
     tags.form(action=url.root.child(guard.LOGIN_AVATAR), method='post')[
       tags.table[
         tags.tr[
           tags.td[ "Username:" ],
           tags.td[ tags.input(type='text',name='username') ],
         ],
         tags.tr[
           tags.td[ "Password:" ],
           tags.td[ tags.input(type='password',name='password') ],
         ]
       ],
     tags.input(type='submit')
   ]
   ]
   ]
   )



More information about the Twisted-web mailing list