Пример #1
0
 def update_(self):
     'Update account'
     # Initialize
     personID = h.getPersonID()
     # If the user is trying to update SMS information,
     if 'smsAddressID' in request.POST:
         # Load
         action = request.POST.get('action')
         smsAddressID = request.POST['smsAddressID']
         smsAddress = Session.query(model.SMSAddress).filter((model.SMSAddress.id==smsAddressID) & (model.SMSAddress.owner_id==personID)).first()
         if not smsAddress:
             return dict(isOk=0, message='Could not find smsAddressID=%s corresponding to personID=%s' % (smsAddressID, personID))
         # If the user is trying to activate an SMS address,
         elif action == 'activate':
             smsAddress.is_active = True
         # If the user is trying to deactivate an SMS address,
         elif action == 'deactivate':
             smsAddress.is_active = False
         # If the user is trying to remove an SMS address,
         elif action == 'remove':
             Session.delete(smsAddress)
         # Otherwise,
         else:
             return dict(isOk=0, message='Command not recognized')
         # Commit and return
         Session.commit()
         return dict(isOk=1)
     # If the user is trying to update account information,
     else:
         # Send update confirmation email
         return changePerson(dict(request.POST), 'update', Session.query(model.Person).get(personID))
Пример #2
0
 def update(self):
     'Show account update page'
     # Render
     person = Session.query(model.Person).options(
         orm.eagerload(model.Person.sms_addresses)).get(h.getPersonID())
     c.isNew = False
     c.smsAddresses = person.sms_addresses
     # Return
     return formencode.htmlfill.render(
         render('/people/change.mako'), {
             'username': person.username,
             'nickname': person.nickname,
             'email': person.email,
             'key': person.key,
         })
Пример #3
0
 def update_(self):
     'Update account'
     # Initialize
     personID = h.getPersonID()
     # If the user is trying to update SMS information,
     if 'smsAddressID' in request.POST:
         # Load
         action = request.POST.get('action')
         smsAddressID = request.POST['smsAddressID']
         smsAddress = Session.query(model.SMSAddress).filter(
             (model.SMSAddress.id == smsAddressID)
             & (model.SMSAddress.owner_id == personID)).first()
         if not smsAddress:
             return dict(
                 isOk=0,
                 message=
                 'Could not find smsAddressID=%s corresponding to personID=%s'
                 % (smsAddressID, personID))
         # If the user is trying to activate an SMS address,
         elif action == 'activate':
             smsAddress.is_active = True
         # If the user is trying to deactivate an SMS address,
         elif action == 'deactivate':
             smsAddress.is_active = False
         # If the user is trying to remove an SMS address,
         elif action == 'remove':
             Session.delete(smsAddress)
         # Otherwise,
         else:
             return dict(isOk=0, message='Command not recognized')
         # Commit and return
         Session.commit()
         return dict(isOk=1)
     # If the user is trying to update account information,
     else:
         # Send update confirmation email
         return changePerson(dict(request.POST), 'update',
                             Session.query(model.Person).get(personID))
Пример #4
0
 def update(self):
     'Show account update page'
     # Render
     person = Session.query(model.Person).options(orm.eagerload(model.Person.sms_addresses)).get(h.getPersonID())
     c.isNew = False
     c.smsAddresses = person.sms_addresses
     # Return
     return formencode.htmlfill.render(render('/people/change.mako'), {
         'username': person.username,
         'nickname': person.nickname,
         'email': person.email,
         'key': person.key,
     })