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
15 from formencode import validators, Schema
17 log = logging.getLogger(__name__)
20 class EmailSchema(Schema):
21 "Validate email updates."
22 allow_extra_fields = False
23 new_email = validators.Email()
26 class UserController(BaseController):
28 c.title = 'User Settings'
29 return render('/user/index.mako')
31 @validate(schema=EmailSchema(), form='index')
33 new_email = self.form_result['new_email']
34 request.environ['user'].email = new_email
37 h.flash("Removed email address.")
39 h.flash("Updated email address to '%s'." % new_email)
40 return h.redirect_to('/')