2 Calculate the current state of the books
7 from bluechips.lib.base import *
10 from sqlalchemy import orm
12 from pylons import request
13 from pylons.decorators import validate
14 from pylons.decorators.secure import authenticate_form
16 from formencode import validators, Schema
18 log = logging.getLogger(__name__)
21 class EmailSchema(Schema):
22 "Validate email updates."
23 allow_extra_fields = False
24 new_email = validators.Email()
27 class UserController(BaseController):
29 c.title = 'User Settings'
30 return render('/user/index.mako')
33 @validate(schema=EmailSchema(), form='index')
35 new_email = self.form_result['new_email']
36 request.environ['user'].email = new_email
39 h.flash("Removed email address.")
41 h.flash("Updated email address to '%s'." % new_email)
42 return h.redirect_to('/')