Changeset 8739 for main/waeup.kofa


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

Improve logging (part 1).

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

Legend:

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

    r8372 r8739  
    114114  >>> print browser.contents
    115115  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    116   ...Settings have been saved...
     116  ...Form has been saved...
    117117  ...
    118118
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r8651 r8739  
    6565from waeup.kofa.widgets.htmlwidget import HTMLDisplayWidget
    6666from waeup.kofa.authentication import get_principal_role_manager
    67 from waeup.kofa.utils.helpers import get_user_account
     67from waeup.kofa.utils.helpers import get_user_account, msave
    6868
    6969grok.context(IKofaObject)
     
    108108            _('Local role successfully removed: ${a}',
    109109            mapping = {'a':', '.join(deleted)}))
     110        ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     111        grok.getSite().logger.info(
     112            '%s - removed: %s' % (ob_class, ', '.join(deleted)))
    110113    view.redirect(view.url(view.context, u'@@manage')+'?tab%s' % tab)
    111114    return
     
    139142        view.flash(_('Successfully removed: ${a}',
    140143            mapping = {'a': ', '.join(deleted)}))
     144        ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
     145        grok.getSite().logger.info(
     146            '%s - removed: %s' % (ob_class, ', '.join(deleted)))
    141147    if tab:
    142148        view.redirect(view.url(view.context, redirect)+'?tab%s' % tab)
     
    414420            self.flash(_('User account ${a} successfully deleted.',
    415421                mapping = {'a':  userid}))
     422            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     423            self.context.__parent__.logger.info(
     424                '%s - removed: %s' % (ob_class, userid))
    416425
    417426    def getLocalRoles(self, account):
     
    471480            self.flash(_('User account ${a} successfully added.',
    472481                mapping = {'a': name}))
     482            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     483            self.context.__parent__.logger.info(
     484                '%s - added: %s' % (ob_class, name))
    473485        except KeyError:
    474486            self.status = self.flash('The userid chosen already exists '
     
    517529        fields_string = ' + '.join(changed_fields)
    518530        if fields_string:
     531            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    519532            self.context.__parent__.logger.info(
    520                 'User account %s edited: %s' % (self.context.name,fields_string))
     533                '%s - %s edited: %s' % (
     534                ob_class, self.context.name, fields_string))
    521535        self.flash(_('User settings have been saved.'))
    522536        return
     
    675689    @action(_('Save'), style='primary')
    676690    def save(self, **data):
    677         self.applyData(self.context, **data)
     691        msave(self, **data)
    678692        self.context.frontpage_dict = self._frontpage()
    679         self.flash(_('Settings have been saved.'))
    680693        return
    681694
     
    723736        try:
    724737            self.context.addSessionConfiguration(sessionconfiguration)
     738            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     739            self.context.__parent__.logger.info(
     740                '%s - added: %s' % (
     741                ob_class, sessionconfiguration.academic_session))
    725742        except KeyError:
    726743            self.flash(_('The session chosen already exists.'))
     
    751768    @action(_('Save'), style='primary')
    752769    def save(self, **data):
    753         self.applyData(self.context, **data)
    754         self.flash(_('Settings have been saved.'))
     770        msave(self, **data)
    755771        self.redirect(self.url(self.context.__parent__, '@@index')+'?tab2')
    756772        return
     
    800816            self.flash(_('Successfully deleted: ${a}',
    801817                mapping = {'a': ', '.join(deleted)}))
    802             logger.info('%s: Deleted files %s' % (
    803                 self.request.principal.id, ', '.join(deleted)))
     818            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     819            self.context.logger.info(
     820                '%s - deleted: %s' % (ob_class, ', '.join(deleted)))
    804821        return
    805822
     
    832849            os.chmod(target, 0664)
    833850            logger = self.context.logger
    834             logger.info('%s: Uploaded file %s' % (
    835                 self.request.principal.id, target))
     851            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     852            logger.info('%s - uploaded: %s' % (ob_class, target))
    836853        except IOError:
    837854            self.flash('Error while uploading file. Please retry.')
     
    869886
    870887    def render(self):
     888        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     889        self.context.logger.info(
     890            '%s - downloaded: %s' % (ob_class, self.filename))
    871891        self.response.setHeader(
    872892            'Content-Type', 'text/csv; charset=UTF-8')
     
    12631283    grok.name('manage')
    12641284    grok.template('datacentermanagepage')
    1265     grok.require('waeup.manageDataCenter')
     1285    grok.require('waeup.managePortal')
    12661286    label = _('Edit data center settings')
    12671287    pnav = 0
     
    12921312        if newpath:
    12931313            self.flash(_('New storage path succefully set.'))
     1314            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1315            self.context.logger.info(
     1316                '%s - storage path set: %s' % (ob_class, newpath))
    12941317            self.redirect(self.url(self.context))
    12951318        return
     
    13161339            self.url(self.context, 'export.csv') + '?exporter=%s' % exporter)
    13171340        return
     1341        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     1342        self.context.logger.info(
     1343            '%s - exported: %s' % (ob_class, exporter))
    13181344        exporter = getUtility(ICSVExporter, name=exporter)
    13191345        csv_data = exporter.export_all(grok.getSite())
     
    15241550    @action(_('Save'), style='primary')
    15251551    def save(self, **data):
    1526         self.applyData(self.context, **data)
    1527         self.flash(_('Form has been saved.'))
    1528         return
     1552        return msave(self, **data)
    15291553
    15301554    @action(_('Cancel'), validator=NullValidator)
     
    17031727    @action(_('Save'), style='primary')
    17041728    def save(self, **data):
    1705         self.applyData(self.context, **data)
    1706         self.flash('Form has been saved.')
    1707         return
     1729        return msave(self, **data)
    17081730
    17091731    @jsaction(_('Remove selected courses'))
     
    18461868    @action(_('Save'), style='primary')
    18471869    def save(self, **data):
    1848         self.applyData(self.context, **data)
    1849         self.flash(_('Form has been saved.'))
    1850         return
    1851 
    1852     #@action('Save and return')
    1853     #def saveAndReturn(self, **data):
    1854     #    self.applyData(self.context, **data)
    1855     #    self.redirect(self.url(self.context))
    1856     #    return
     1870        return msave(self, **data)
    18571871
    18581872    @action(_('Cancel'), validator=NullValidator)
     
    19181932    @action(_('Save'), style='primary')
    19191933    def save(self, **data):
    1920         self.applyData(self.context, **data)
    1921         self.flash(_('Form has been saved.'))
    1922         return
     1934        return msave(self, **data)
    19231935
    19241936    @jsaction(_('Remove selected course referrers'))
     
    20232035        parent = self.context.__parent__
    20242036        if self.context.level == data['level']:
    2025             self.applyData(self.context, **data)
     2037            msave(self, **data)
    20262038        else:
    20272039            # The level changed. We have to create a new certcourse as
     
    20312043            parent.addCourseRef(**data)
    20322044            parent.delCourseRef(data['course'].code, level=old_level)
    2033         self.flash(_('Form has been saved.'))
     2045            self.flash(_('Form has been saved.'))
    20342046        self.redirect(self.url(parent))
    20352047        return
  • main/waeup.kofa/trunk/src/waeup/kofa/userscontainer.py

    r7819 r8739  
    4343                             description=description,
    4444                             email=email, phone=phone, roles=roles)
    45         self.logger.info('User account %s added.' % name)
     45        #self.logger.info('User account %s added.' % name)
    4646
    4747    def addAccount(self, account):
     
    4949        """
    5050        self[account.name] = account
    51         self.logger.info('User account %s added.' % account.name)
     51        #self.logger.info('User account %s added.' % account.name)
    5252
    5353    def delUser(self, name):
     
    5858        if name in self.keys():
    5959            del self[name]
    60             self.logger.info('User account %s deleted.' % name)
     60            #self.logger.info('User account %s deleted.' % name)
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py

    r8737 r8739  
    692692    fields_string = ' + '.join(changed_fields)
    693693    view.flash(_('Form has been saved.'))
     694    ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
    694695    if fields_string:
    695         view.context.writeLogMessage(view, 'saved: %s' % fields_string)
     696        grok.getSite().logger.info('%s - saved: %s' % (ob_class, fields_string))
    696697    return
Note: See TracChangeset for help on using the changeset viewer.