Ignore:
Timestamp:
18 Jun 2012, 06:28:41 (13 years ago)
Author:
Henrik Bettermann
Message:

Simplify logging. Adjust to students.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py

    r8667 r8742  
    6767        return
    6868
    69     def loggerInfo(self, ob_class, comment=None):
    70         target = self.applicant_id
    71         return grok.getSite()['applicants'].logger_info(ob_class,target,comment)
     69    def writeLogMessage(self, view, message):
     70        ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     71        self.__parent__.__parent__.logger.info(
     72            '%s - %s - %s' % (ob_class, self.applicant_id, message))
     73        return
    7274
    7375    @property
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r8684 r8742  
    578578            else:
    579579                ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    580                 self.context.__parent__.logger_info(
    581                     ob_class,result.applicant_id,msg)
     580                self.context.__parent__.logger.info(
     581                    '%s - %s - %s' % (ob_class, result.applicant_id, msg))
    582582        if len(created):
    583583            self.flash(_('${a} students successfully created.',
     
    653653        success, msg, log = self.context.approveApplicantPayment()
    654654        if log is not None:
    655             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    656             self.context.__parent__.loggerInfo(ob_class, log)
     655            self.context.__parent__.writeLogMessage(self, log)
    657656        self.flash(msg)
    658657        return
     
    824823            self.wf_info.fireTransition(trans_id)
    825824        self.flash(_('Form has been saved.'))
    826         ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    827825        if fields_string:
    828             self.context.loggerInfo(ob_class, 'saved: % s' % fields_string)
     826            self.context.writeLogMessage(self, 'saved: % s' % fields_string)
    829827        return
    830828
     
    856854            self.flash(_('Successfully removed: ${a}',
    857855                mapping = {'a':', '.join(deleted)}))
    858             ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    859             self.context.loggerInfo(
    860                 ob_class, 'removed: % s' % ', '.join(deleted))
     856            self.context.writeLogMessage(
     857                self, 'removed: % s' % ', '.join(deleted))
    861858        return
    862859
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r8613 r8742  
    438438    """
    439439
    440     def loggerInfo(ob_class, comment):
     440    def writeLogMessage(view, comment):
    441441        """Adds an INFO message to the log file
    442442        """
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/root.py

    r8412 r8742  
    4242    logger_name = 'waeup.kofa.${sitename}.applicants'
    4343    logger_filename = 'applicants.log'
    44 
    45     def logger_info(self, target, ob_class, comment=None):
    46         """Get the logger's info method.
    47         """
    48         self.logger.info('%s - %s - %s' % (
    49                 target, ob_class, comment))
    50         return
    5144
    5245ApplicantsRoot = attrs_to_fields(ApplicantsRoot)
Note: See TracChangeset for help on using the changeset viewer.