Ignore:
Timestamp:
14 Sep 2011, 14:20:40 (13 years ago)
Author:
Henrik Bettermann
Message:

Turn list of lists into single list with Uli's technique.

Do not log changes made by students. During clearance this would be too much.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
3 edited

Legend:

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

    r6770 r6771  
    4444    ob_class = view.__implemented__.__name__.replace('waeup.sirp.','')
    4545    changed_fields = view.applyData(view.context, **data)
    46     changed_fields = changed_fields.values()
    47     fields_string = '+'.join(' + '.join(str(i) for i in b) for b in changed_fields)
     46    # Turn list of lists into single list
     47    if changed_fields:
     48        changed_fields = reduce(lambda x,y: x+y, changed_fields.values())
     49    fields_string = ' + '.join(changed_fields)
    4850    view.context._p_changed = True
    4951    view.flash('Form has been saved.')
     
    335337            IUserAccount(self.context).setPassword(form['password'])
    336338            self.context.loggerInfo(ob_class, 'password changed')
     339        # Turn list of lists into single list
    337340        changed_fields = self.applyData(self.context, **data)
    338         changed_fields = changed_fields.values()
    339         fields_string = '+'.join(' + '.join(str(i) for i in b) for b in changed_fields)
     341        if changed_fields:
     342            changed_fields = reduce(lambda x,y: x+y, changed_fields.values())
     343            changed_fields = [x for x in changed_fields
     344                              if not x.startswith('password')]
     345        fields_string = ' + '.join(changed_fields)
    340346        self.context._p_changed = True
    341347        if form.has_key('transition') and form['transition']:
     
    587593    @grok.action('Save', failure=onFailure)
    588594    def save(self, **data):
    589         form = self.request.form
    590         ob_class = self.__implemented__.__name__.replace('waeup.sirp.','')
    591         changed_fields = self.applyData(self.context, **data)
    592         # Turn list of lists into single list
    593         changed_fields = reduce(lambda x,y: x+y, changed_fields.values())
    594         changed_fields = [x for x in changed_fields
    595                           if not x.startswith('password')]
    596         if form.get('form.password', u'') != u'':
    597             self.context.loggerInfo(ob_class, 'password changed')
    598             self.flash('Form has been saved.')
    599         fields_string = ' + '.join(changed_fields)
    600         if fields_string:
    601             self.context.loggerInfo(ob_class, 'saved: % s' % fields_string)
     595        self.applyData(self.context, **data)
     596        self.flash('Form has been saved.')
    602597        return
    603598
     
    652647            self.context.clr_code = pin
    653648        IWorkflowInfo(self.context).fireTransition('start_clearance')
    654         self.flash('Clearance process is started.')
     649        self.flash('Clearance process has been started.')
    655650        self.redirect(self.url(self.context,'cedit'))
    656651        return
     
    698693    def save(self, **data):
    699694        self.applyData(self.context, **data)
    700         self.flash('Form has been saved.')
     695        self.flash('Clearance form has been saved.')
    701696        return
    702697
     
    708703        #    self.flash(self.dataNotComplete())
    709704        #    return
     705        self.flash('Clearance form has been saved.')
    710706        self.redirect(self.url(self.context,'request_clearance'))
    711707        return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py

    r6769 r6771  
    122122
    123123    adm_code = schema.TextLine(
    124         title = u'PWD access code',
     124        title = u'PWD Access Code',
    125125        default = u'',
    126126        required = False,
     
    143143
    144144    clr_code = schema.TextLine(
    145         title = u'CLR access code',
     145        title = u'CLR Access Code',
    146146        default = u'',
    147147        required = False,
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6769 r6771  
    402402        self.browser.getControl(name="ac_number").value = self.existing_clrnumber
    403403        self.browser.getControl("Start clearance now").click()
    404         self.assertMatches('...Clearance process is started...',
     404        self.assertMatches('...Clearance process has been started...',
    405405                           self.browser.contents)
    406406        self.browser.getControl(name="form.date_of_birth").value = '09/10/1961'
Note: See TracChangeset for help on using the changeset viewer.