Ignore:
Timestamp:
17 Jun 2012, 17:51:12 (13 years ago)
Author:
Henrik Bettermann
Message:

Improve logging (part 2).

File:
1 edited

Legend:

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

    r8739 r8740  
    8080    role_manager.assignRoleToPrincipal(localrole, user)
    8181    notify(LocalRoleSetEvent(view.context, localrole, user, granted=True))
     82    ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     83    grok.getSite().logger.info(
     84        '%s - added: %s|%s' % (ob_class, user, localrole))
    8285    view.redirect(view.url(view.context, u'@@manage')+'?tab%s' % tab)
    8386    return
     
    13391342            self.url(self.context, 'export.csv') + '?exporter=%s' % exporter)
    13401343        return
     1344
     1345class ExportCSVView(grok.View):
     1346    grok.context(IDataCenter)
     1347    grok.name('export.csv')
     1348    grok.require('waeup.manageDataCenter')
     1349
     1350    def render(self, exporter=None):
     1351        if exporter is None:
     1352            return
    13411353        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    13421354        self.context.logger.info(
     
    13491361        return csv_data
    13501362
    1351 class ExportCSVView(grok.View):
    1352     grok.context(IDataCenter)
    1353     grok.name('export.csv')
    1354     grok.require('waeup.manageDataCenter')
    1355 
    1356     def render(self, exporter=None):
    1357         if exporter is None:
    1358             return
    1359         exporter = getUtility(ICSVExporter, name=exporter)
    1360         csv_data = exporter.export_all(grok.getSite())
    1361         #csv_data.seek(0)
    1362         self.response.setHeader(
    1363             'Content-Type', 'text/csv; charset=UTF-8')
    1364         return csv_data
    1365 
    13661363class ExportXMLPage(grok.View):
    13671364    """Deliver an XML representation of the context.
     
    14771474            self.flash(_('The faculty code chosen already exists.'))
    14781475            return
     1476        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1477        self.context.__parent__.logger.info(
     1478            '%s - added: %s' % (ob_class, faculty.code))
    14791479        self.redirect(self.url(self.context, u'@@manage')+'?tab1')
     1480        return
    14801481
    14811482    @action(_('Cancel'), validator=NullValidator)
     
    15911592        self.status = self.flash(
    15921593            _("Department ${a} added.", mapping = {'a':data['code']}))
     1594        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1595        self.context.__parent__.__parent__.logger.info(
     1596            '%s - added: %s' % (ob_class, data['code']))
    15931597        self.redirect(self.url(self.context, u'@@manage')+'?tab2')
     1598        return
    15941599
    15951600    @action(_('Cancel'), validator=NullValidator)
    15961601    def cancel(self, **data):
    15971602        self.redirect(self.url(self.context))
     1603        return
    15981604
    15991605#
     
    17941800        message = _(u'Course ${a} successfully created.', mapping = {'a':course.code})
    17951801        self.flash(message)
     1802        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1803        self.context.__parent__.__parent__.__parent__.logger.info(
     1804            '%s - added: %s' % (ob_class, data['code']))
    17961805        self.redirect(self.url(self.context, u'@@manage')+'?tab2')
     1806        return
    17971807
    17981808    @action(_('Cancel'), validator=NullValidator)
     
    18311841        message = _(u'Certificate ${a} successfully created.', mapping = {'a':certificate.code})
    18321842        self.flash(message)
     1843        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1844        self.context.__parent__.__parent__.__parent__.logger.info(
     1845            '%s - added: %s' % (ob_class, data['code']))
    18331846        self.redirect(self.url(self.context, u'@@manage')+'?tab3')
    18341847        return
     
    19932006            _("Course referrer ${a}_${b} added.",
    19942007            mapping = {'a': data['course'].code, 'b': data['level']}))
     2008        code = "%s_%s" % (data['course'].code, data['level'])
     2009        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     2010        grok.getSite().logger.info('%s - added: %s' % (ob_class, code))
    19952011        self.redirect(self.url(self.context, u'@@manage')+'?tab2')
     2012        return
    19962013
    19972014    @action(_('Cancel'), validator=NullValidator)
     
    20442061            parent.delCourseRef(data['course'].code, level=old_level)
    20452062            self.flash(_('Form has been saved.'))
     2063            old_code = "%s_%s" % (data['course'].code, old_level)
     2064            new_code = "%s_%s" % (data['course'].code, data['level'])
     2065            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     2066            grok.getSite().logger.info(
     2067                '%s - renamed: %s to %s' % (ob_class, old_code, new_code))
    20462068        self.redirect(self.url(parent))
    20472069        return
     
    21232145        else:
    21242146            self.flash(_('An smtp server error occurred.'))
    2125         return
     2147        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     2148        self.context.logger.info(
     2149            '%s - %s - %s' % (ob_class, data['identifier'], data['email']))
     2150        return
Note: See TracChangeset for help on using the changeset viewer.