Changeset 7141 for main


Ignore:
Timestamp:
19 Nov 2011, 14:32:24 (13 years ago)
Author:
uli
Message:

Flatten failure method of password view a bit and check for empty
passwords in save action.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r7136 r7141  
    15451545    def update(self):
    15461546        super(StudentPasswordFormPage, self).update()
    1547         #self.wf_info = IWorkflowInfo(self.context)
    15481547        return
    15491548
     
    15541553            msg = getattr(error, 'message', '')
    15551554            if isinstance(msg, basestring) and msg != '':
     1555                # invariant error
    15561556                new_status.append(msg)
    15571557            else:
    1558                 other_errors = True
    1559         if other_errors:
    1560             if new_status:
    1561                 new_status.append('see below for further errors')
    1562             else:
    1563                 new_status.append('See below for details.')
    1564         if new_status:
    1565             self.status = u'There were errors: %s' % ', '.join(new_status)
     1558                # field error
     1559                new_status.append('see below for details')
     1560                continue
     1561        self.status = u'Error: %s' % ', '.join(new_status)
    15661562        return
    15671563
    15681564    @grok.action('Save', failure=onFailure)
    15691565    def save(self, **data):
     1566        if not isinstance(data.get('password', None), basestring):
     1567            self.flash('Password unchanged.')
     1568            return
    15701569        self.applyData(self.context, **data)
    1571         self.flash('Form has been saved.')
     1570        self.flash('Password has been set.')
    15721571        return
    15731572
Note: See TracChangeset for help on using the changeset viewer.