Changeset 8182
- Timestamp:
- 16 Apr 2012, 20:56:59 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 9 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 -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r8176 r8182 521 521 self.context.r_code = u'00' 522 522 self.context.p_state = 'paid' 523 self.context.payment_date = datetime.now() 523 tz = getUtility(IKofaUtils).tzinfo 524 self.context.payment_date = datetime.now(tz) 524 525 ob_class = self.__implemented__.__name__.replace('waeup.kofa.','') 525 526 self.context.__parent__.loggerInfo( -
main/waeup.kofa/trunk/src/waeup/kofa/payments/payment.py
r7811 r8182 22 22 from datetime import datetime 23 23 from grok import index 24 from zope.component import getUtility 25 from waeup.kofa.interfaces import IKofaUtils 24 26 from waeup.kofa.payments.interfaces import ( 25 27 IPayment, ISCPayment, IOnlinePayment, … … 36 38 def __init__(self): 37 39 super(Payment, self).__init__() 38 self.creation_date = datetime.now() 40 try: 41 tz = getUtility(IKofaUtils).tzinfo 42 except: 43 #In unit tests KofaUtils is not available. 44 tz = None 45 self.creation_date = datetime.now(tz) 39 46 self.p_id = None 40 47 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/accommodation.py
r7811 r8182 21 21 from datetime import datetime 22 22 import grok 23 from zope.component import getUtility 23 24 from zope.component.interfaces import IFactory 24 25 from zope.interface import implementedBy 25 from waeup.kofa.interfaces import academic_sessions_vocab 26 from waeup.kofa.interfaces import academic_sessions_vocab, IKofaUtils 26 27 from waeup.kofa.students.interfaces import ( 27 28 IStudentAccommodation, IStudentNavigation, IBedTicket) … … 61 62 def __init__(self): 62 63 super(BedTicket, self).__init__() 63 self.booking_date = datetime.now() 64 tz = getUtility(IKofaUtils).tzinfo 65 self.booking_date = datetime.now(tz) 64 66 self.bed = None 65 67 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r8176 r8182 1145 1145 self.context.r_code = u'00' 1146 1146 self.context.p_state = 'paid' 1147 self.context.payment_date = datetime.now() 1147 tz = getUtility(IKofaUtils).tzinfo 1148 self.context.payment_date = datetime.now(tz) 1148 1149 if self.context.p_category == 'clearance': 1149 1150 # Create CLR access code -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r8176 r8182 379 379 ) 380 380 381 def addCourseTicket(courseticket): 382 """Add a course ticket object. 383 """ 384 385 def getStudent(): 386 """Return student 387 """ 388 381 389 class ICourseTicket(IKofaObject): 382 390 """A course ticket. -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r8119 r8182 26 26 import grok 27 27 from zope.event import notify 28 from zope.component import createObject, queryUtility 28 from zope.component import createObject, queryUtility, getUtility 29 29 from zope.component.hooks import setSite, clearSite 30 30 from zope.catalog.interfaces import ICatalog … … 40 40 from waeup.kofa.university.faculty import Faculty 41 41 from waeup.kofa.university.department import Department 42 from waeup.kofa.interfaces import IUserAccount 42 from waeup.kofa.interfaces import IUserAccount, IKofaUtils 43 43 from waeup.kofa.authentication import LocalRoleSetEvent 44 44 from waeup.kofa.hostels.hostel import Hostel, Bed, NOT_OCCUPIED … … 121 121 # Create 5 access codes with prefix'PWD' 122 122 pin_container = self.app['accesscodes'] 123 tz = getUtility(IKofaUtils).tzinfo 123 124 pin_container.createBatch( 124 datetime.now( ), 'some_userid', 'PWD', 9.99, 5)125 datetime.now(tz), 'some_userid', 'PWD', 9.99, 5) 125 126 pins = pin_container['PWD-1'].values() 126 127 self.pwdpins = [x.representation for x in pins]
Note: See TracChangeset for help on using the changeset viewer.