Ignore:
Timestamp:
28 Aug 2011, 20:05:42 (13 years ago)
Author:
Henrik Bettermann
Message:

Don't add log message when no attribute has been changed, but log all transitions.

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
5 edited

Legend:

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

    r6622 r6644  
    762762        self.flash('Form has been saved.')
    763763        ob_class = self.__implemented__.__name__.replace('waeup.sirp.','')
    764         self.context.loggerInfo(ob_class, 'saved: % s' % fields_string)
     764        if fields_string:
     765            self.context.loggerInfo(ob_class, 'saved: % s' % fields_string)
    765766        return
    766767
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/workflow.py

    r6471 r6644  
    88from waeup.sirp.interfaces import IObjectHistory, IWAeUPWorkflowInfo
    99from waeup.sirp.workflow import WAeUPWorkflow, WAeUPWorkflowInfo
     10from waeup.sirp.utils.helpers import get_current_principal
    1011
    1112INITIALIZED = 'initialized'
     
    124125    history = IObjectHistory(obj)
    125126    history.addMessage(msg)
     127    # In some tests we don't have a an applicants root or a user
     128    try:
     129        user = get_current_principal()
     130        applicants_root = grok.getSite()['applicants']
     131        applicants_root.logger.info('%s - %s - %s' % (user.id,obj.access_code,msg))
     132    except (TypeError, AttributeError):
     133        pass
    126134    return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6642 r6644  
    309309        self.flash('Form has been saved.')
    310310        ob_class = self.__implemented__.__name__.replace('waeup.sirp.','')
    311         self.context.loggerInfo(ob_class, 'saved: % s' % fields_string)
     311        if fields_string:
     312            self.context.loggerInfo(ob_class, 'saved: % s' % fields_string)
    312313        return
    313314
  • main/waeup.sirp/trunk/src/waeup/sirp/students/container.py

    r6642 r6644  
    5858    logger_filename = 'students.log'
    5959
    60     def logger_info(self, target, ob_class, comment=None):
     60    def logger_info(self, ob_class, target, comment=None):
    6161        """Get the logger's info method.
    6262        """
     
    6767            user = user.id
    6868        self.logger.info('%s - %s - %s - %s' % (
    69                 user, target, ob_class, comment))
     69                user, ob_class, target, comment))
    7070        return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/workflow.py

    r6638 r6644  
    88from waeup.sirp.interfaces import IObjectHistory, IWAeUPWorkflowInfo
    99from waeup.sirp.workflow import WAeUPWorkflow, WAeUPWorkflowInfo
     10from waeup.sirp.utils.helpers import get_current_principal
    1011
    1112CREATED = 'created'
     
    5960@grok.subscribe(IStudent, IWorkflowTransitionEvent)
    6061def handle_student_transition_event(obj, event):
    61     """Append message to student history when transition happened.
     62    """Append message to student history and log file when transition happened.
    6263    """
    6364    msg = '%s' % event.transition.user_data['msg']
    6465    history = IObjectHistory(obj)
    6566    history.addMessage(msg)
     67    # In some tests we don't have a students container or a user
     68    try:
     69        user = get_current_principal()
     70        students_container = grok.getSite()['students']
     71        students_container.logger.info('%s - %s - %s' % (user.id,obj.student_id,msg))
     72    except (TypeError, AttributeError):
     73        pass
    6674    return
Note: See TracChangeset for help on using the changeset viewer.