Changeset 7747
- Timestamp:
- 2 Mar 2012, 08:08:31 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/accesscodes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscode.py
r7689 r7747 32 32 from random import SystemRandom as random 33 33 from waeup.sirp.interfaces import ISIRPPluggable, IObjectHistory 34 from waeup.sirp.utils.logger import Logger 34 35 from waeup.sirp.accesscodes.interfaces import ( 35 36 IAccessCode, IAccessCodeBatch, IAccessCodeBatchContainer … … 276 277 277 278 278 class AccessCodeBatchContainer(grok.Container ):279 class AccessCodeBatchContainer(grok.Container, Logger): 279 280 grok.implements(IAccessCodeBatchContainer) 280 281 … … 400 401 return 401 402 reenable_accesscode(ac_id, comment) 403 return 404 405 logger_name = 'waeup.sirp.${sitename}.accesscodes' 406 logger_filename = 'accesscodes.log' 407 408 def logger_info(self, ob_class, comment=None): 409 """Get the logger's info method. 410 """ 411 self.logger.info('%s - %s' % ( 412 ob_class, comment)) 402 413 return 403 414 -
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/browser.py
r7745 r7747 55 55 if isinstance(batches, basestring): 56 56 batches = [batches] 57 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','') 57 58 for name in batches: 58 59 batch = self.context[name] … … 60 61 self.flash(_('Archived ${a} (${b})', 61 62 mapping = {'a':name, 'b':csv_file})) 63 message = 'archived: %s (%s)' % (name,csv_file) 64 self.context.logger_info(ob_class, message) 62 65 if delete is None: 63 66 continue 64 67 del self.context[name] 65 68 self.flash(_('Deleted batch ${a}', mapping = {'a':name})) 69 message = 'deleted: %s' % name 70 self.context.logger_info(ob_class, message) 66 71 67 72 class AddBatchPage(SIRPAddFormPage): … … 87 92 mapping = {'a':data['entry_num']})) 88 93 self.flash(_('Data written to ${a}', mapping = {'a':csv_file})) 94 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','') 95 message = 'created: %s (%d, %f)' % ( 96 csv_file, data['entry_num'], data['cost']) 97 self.context.logger_info(ob_class, message) 89 98 self.redirect(self.url(self.context)) 90 99 … … 130 139 self.flash(_('Successfully reimported: ${a}', 131 140 mapping = {'a':filename})) 141 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','') 142 message = 'reimported: %s' % filename 143 self.context.logger_info(ob_class, message) 132 144 self.redirect(self.url(self.context)) 133 145 … … 162 174 if isinstance(entries, basestring): 163 175 entries = [entries] 176 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','') 164 177 for entry in entries: 165 178 if 'disable' in form: … … 168 181 self.context.disable(entry, comment) 169 182 self.flash(_('${a} disabled.', mapping = {'a':entry})) 183 message = 'disabled: %s' % entry 184 self.context.logger_info(ob_class, message) 170 185 except InvalidTransitionError: 171 186 self.flash(_('${a}: Disable transition not allowed.', … … 176 191 self.context.enable(entry, comment) 177 192 self.flash(_('${a} (re-)enabled.', mapping = {'a':entry})) 193 message = '(re-)enabled: %s' % entry 194 self.context.logger_info(ob_class, message) 178 195 except InvalidTransitionError: 179 196 self.flash(_('${a}: Re-enable transition not allowed.', mapping = {'a':entry}))
Note: See TracChangeset for help on using the changeset viewer.