Ignore:
Timestamp:
17 Apr 2012, 11:40:06 (13 years ago)
Author:
Henrik Bettermann
Message:

Store utc without tzinfo in persistent datetime objects. Localisation will be done in views only.

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

    r8186 r8194  
    356356        if batch_name in self.keys():
    357357            raise KeyError('Batch already exists: %s' % batch_name)
    358         tz = getUtility(IKofaUtils).tzinfo
    359358        batch = AccessCodeBatch(
    360             datetime.now(tz), creator, prefix, cost, 0, num=num)
     359            datetime.utcnow(), creator, prefix, cost, 0, num=num)
    361360        num_entries = 0
    362361        self[batch_name] = batch
     
    430429        creator = 'system'
    431430        entry_num = 0
    432         tz = getUtility(IKofaUtils).tzinfo
    433         creation_date = datetime.now(tz)
     431        creation_date = datetime.utcnow()
    434432        basecontainer.createBatch(creation_date, creator,
    435433            'SFE', cost, entry_num)
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser.py

    r8182 r8194  
    8585    def createBatch(self, **data):
    8686        creator = self.request.principal.id
    87         tz = getUtility(IKofaUtils).tzinfo
    88         creation_date = datetime.now(tz)
     87        creation_date = datetime.utcnow()
    8988        data.update(creation_date=creation_date, creator=creator)
    9089        batch = self.context.createBatch(**data)
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_accesscode.py

    r8186 r8194  
    259259        self.app = self.getRootFolder()['app']
    260260
    261         tz = getUtility(IKofaUtils).tzinfo
    262261        batch = AccessCodeBatch(    # create batch with zero entries
    263             datetime.now(tz), 'testuser', 'FOO', 9.99, 0)
     262            datetime.utcnow(), 'testuser', 'FOO', 9.99, 0)
    264263        self.app['accesscodes'].addBatch(batch)
    265264
Note: See TracChangeset for help on using the changeset viewer.