Changeset 8182 for main/waeup.kofa/trunk/src/waeup/kofa/accesscodes
- Timestamp:
- 16 Apr 2012, 20:56:59 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/accesscodes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py
r7819 r8182 31 31 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 32 32 from random import SystemRandom as random 33 from waeup.kofa.interfaces import IKofaPluggable, IObjectHistory 33 from zope.component import getUtility 34 from waeup.kofa.interfaces import IKofaUtils, IKofaPluggable, IObjectHistory 34 35 from waeup.kofa.utils.logger import Logger 35 36 from waeup.kofa.accesscodes.interfaces import ( … … 353 354 if batch_name in self.keys(): 354 355 raise KeyError('Batch already exists: %s' % batch_name) 356 tz = getUtility(IKofaUtils).tzinfo 355 357 batch = AccessCodeBatch( 356 datetime.now( ), creator, prefix, cost, 0, num=num)358 datetime.now(tz), creator, prefix, cost, 0, num=num) 357 359 num_entries = 0 358 360 self[batch_name] = batch … … 426 428 creator = 'system' 427 429 entry_num = 0 428 creation_date = datetime.now() 430 tz = getUtility(IKofaUtils).tzinfo 431 creation_date = datetime.now(tz) 429 432 basecontainer.createBatch(creation_date, creator, 430 433 'SFE', cost, entry_num) -
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser.py
r7819 r8182 20 20 import grok 21 21 from datetime import datetime 22 from zope.component import getUtility 22 23 from hurry.workflow.interfaces import InvalidTransitionError 23 24 from waeup.kofa.browser.resources import datatable … … 26 27 from waeup.kofa.browser.viewlets import ( 27 28 AdminTask, AddActionButton, SearchActionButton, BatchOpButton, ManageLink) 28 from waeup.kofa.interfaces import IKofaObject 29 from waeup.kofa.interfaces import IKofaObject, IKofaUtils 29 30 from waeup.kofa.interfaces import MessageFactory as _ 30 31 from waeup.kofa.accesscodes.interfaces import ( … … 84 85 def createBatch(self, **data): 85 86 creator = self.request.principal.id 86 creation_date = datetime.now() 87 tz = getUtility(IKofaUtils).tzinfo 88 creation_date = datetime.now(tz) 87 89 data.update(creation_date=creation_date, creator=creator) 88 90 batch = self.context.createBatch(**data) -
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_accesscode.py
r7819 r8182 25 25 from datetime import datetime 26 26 from hurry.workflow.interfaces import InvalidTransitionError, IWorkflowState 27 from zope.component import getUtility 27 28 from zope.component.hooks import setSite, clearSite 28 29 from zope.interface.verify import verifyObject, verifyClass 29 30 from zope.testing import renormalizing 30 31 from waeup.kofa.app import University 31 from waeup.kofa.interfaces import IObjectHistory, IKofaPluggable 32 from waeup.kofa.interfaces import IObjectHistory, IKofaPluggable, IKofaUtils 32 33 from waeup.kofa.testing import ( 33 34 FunctionalLayer, FunctionalTestCase, setUp, tearDown, getRootFolder) … … 258 259 self.app = self.getRootFolder()['app'] 259 260 261 tz = getUtility(IKofaUtils).tzinfo 260 262 batch = AccessCodeBatch( # create batch with zero entries 261 datetime.now( ), 'testuser', 'FOO', 9.99, 0)263 datetime.now(tz), 'testuser', 'FOO', 9.99, 0) 262 264 self.app['accesscodes'].addBatch(batch) 263 265
Note: See TracChangeset for help on using the changeset viewer.