def handle_get(self, session_id, values, wfile): if "next" not in values: values["next"] = Home.path user = self.application.get_user(session_id) templates.header(wfile) templates.title(wfile, "User login") if user: templates.paragraph( wfile, 'Note that you are already logged in as ' '<b>%s</b> with a username of <b>%s</b>.' % (user.name, user.username)) templates.paragraph( wfile, 'To change user, enter a new username and password and click ' 'the "Login" button.') templates.login_form(wfile, self.path, self.application.usernames) else: path = lib.join_url(self.path, values) templates.paragraph( wfile, 'If you have not yet created a user account, ' 'do so now.') templates.possible_actions(wfile, ("adduser", "Create new account")) templates.login_form(wfile, path, self.application.usernames) templates.footer(wfile)
def test_login_form(self): """Check login form""" wfile = self.get_wfile() templates.login_form(wfile, "a path", ["user1", "user2"]) self.assert_(self.is_well_formed(wfile))