comparison pylons_app/model/forms.py @ 355:5bbcc0cac389

added session remove in forms, and added name and lastname to auth user
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 21 Jul 2010 22:57:36 +0200
parents 664a5b8c551a
children b0715a788432
comparison
equal deleted inserted replaced
354:7a086a83f00b 355:5bbcc0cac389
95 auth_user = AuthUser() 95 auth_user = AuthUser()
96 auth_user.username = username 96 auth_user.username = username
97 auth_user.is_authenticated = True 97 auth_user.is_authenticated = True
98 auth_user.is_admin = user.admin 98 auth_user.is_admin = user.admin
99 auth_user.user_id = user.user_id 99 auth_user.user_id = user.user_id
100 auth_user.name = user.name
101 auth_user.lastname = user.lastname
100 session['hg_app_user'] = auth_user 102 session['hg_app_user'] = auth_user
101 session.save() 103 session.save()
102 log.info('user %s is now authenticated', username) 104 log.info('user %s is now authenticated', username)
103 105
104 try: 106 try:
120 raise formencode.Invalid(self.message('disabled_account', 122 raise formencode.Invalid(self.message('disabled_account',
121 state=State_obj), 123 state=State_obj),
122 value, state, 124 value, state,
123 error_dict=self.e_dict_disable) 125 error_dict=self.e_dict_disable)
124 126
125 127 meta.Session.remove()
126 class ValidRepoUser(formencode.validators.FancyValidator): 128 class ValidRepoUser(formencode.validators.FancyValidator):
127 129
128 def to_python(self, value, state): 130 def to_python(self, value, state):
129 sa = meta.Session 131 sa = meta.Session
130 try: 132 try: