Ignore:
Timestamp:
17 Jun 2012, 07:32:08 (13 years ago)
Author:
Henrik Bettermann
Message:

Use different msave method in students and in university.

Simplify logging. We don't need the logger_info method.

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

Legend:

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

    r8736 r8737  
    6262from waeup.kofa.browser.resources import toggleall
    6363from waeup.kofa.hostels.hostel import NOT_OCCUPIED
    64 from waeup.kofa.utils.helpers import get_current_principal, to_timezone, msave
     64from waeup.kofa.utils.helpers import get_current_principal, to_timezone
     65
     66# Save function used for save methods in pages
     67def msave(view, **data):
     68    changed_fields = view.applyData(view.context, **data)
     69    # Turn list of lists into single list
     70    if changed_fields:
     71        changed_fields = reduce(lambda x,y: x+y, changed_fields.values())
     72    # Inform catalog if certificate has changed
     73    # (applyData does this only for the context)
     74    if 'certificate' in changed_fields:
     75        notify(grok.ObjectModifiedEvent(view.context.student))
     76    fields_string = ' + '.join(changed_fields)
     77    view.flash(_('Form has been saved.'))
     78    if fields_string:
     79        view.context.writeLogMessage(view, 'saved: %s' % fields_string)
     80    return
    6581
    6682def emit_lock_message(view):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/container.py

    r8410 r8737  
    3939    _curr_stud_id = 10 ** 6
    4040
     41    logger_name = 'waeup.kofa.${sitename}.students'
     42    logger_filename = 'students.log'
     43
    4144    @property
    4245    def unique_student_id(self):
     
    7780        return
    7881
    79     logger_name = 'waeup.kofa.${sitename}.students'
    80     logger_filename = 'students.log'
    81 
    82     def logger_info(self, ob_class, target, comment=None):
    83         """Get the logger's info method.
    84         """
    85         self.logger.info('%s - %s - %s' % (
    86                 ob_class, target, comment))
    87         return
    88 
    8982StudentsContainer = attrs_to_fields(StudentsContainer)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/student.py

    r8736 r8737  
    6363    def writeLogMessage(self, view, message):
    6464        ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
    65         return self.__parent__.logger_info(ob_class,self.__name__,comment=None)
     65        self.__parent__.logger.info(
     66            '%s - %s - %s' % (ob_class, self.__name__, message))
     67        return
    6668
    6769    @property
Note: See TracChangeset for help on using the changeset viewer.