Ignore:
Timestamp:
16 Apr 2012, 20:56:59 (13 years ago)
Author:
Henrik Bettermann
Message:

Part 1: Add tzinfo to all persistent datetime objects.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/accommodation.py

    r7811 r8182  
    2121from datetime import datetime
    2222import grok
     23from zope.component import getUtility
    2324from zope.component.interfaces import IFactory
    2425from zope.interface import implementedBy
    25 from waeup.kofa.interfaces import academic_sessions_vocab
     26from waeup.kofa.interfaces import academic_sessions_vocab, IKofaUtils
    2627from waeup.kofa.students.interfaces import (
    2728    IStudentAccommodation, IStudentNavigation, IBedTicket)
     
    6162    def __init__(self):
    6263        super(BedTicket, self).__init__()
    63         self.booking_date = datetime.now()
     64        tz = getUtility(IKofaUtils).tzinfo
     65        self.booking_date = datetime.now(tz)
    6466        self.bed = None
    6567        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r8176 r8182  
    11451145        self.context.r_code = u'00'
    11461146        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)
    11481149        if self.context.p_category == 'clearance':
    11491150            # Create CLR access code
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r8176 r8182  
    379379        )
    380380
     381    def addCourseTicket(courseticket):
     382        """Add a course ticket object.
     383        """
     384
     385    def getStudent():
     386        """Return student
     387        """
     388
    381389class ICourseTicket(IKofaObject):
    382390    """A course ticket.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r8119 r8182  
    2626import grok
    2727from zope.event import notify
    28 from zope.component import createObject, queryUtility
     28from zope.component import createObject, queryUtility, getUtility
    2929from zope.component.hooks import setSite, clearSite
    3030from zope.catalog.interfaces import ICatalog
     
    4040from waeup.kofa.university.faculty import Faculty
    4141from waeup.kofa.university.department import Department
    42 from waeup.kofa.interfaces import IUserAccount
     42from waeup.kofa.interfaces import IUserAccount, IKofaUtils
    4343from waeup.kofa.authentication import LocalRoleSetEvent
    4444from waeup.kofa.hostels.hostel import Hostel, Bed, NOT_OCCUPIED
     
    121121        # Create 5 access codes with prefix'PWD'
    122122        pin_container = self.app['accesscodes']
     123        tz = getUtility(IKofaUtils).tzinfo
    123124        pin_container.createBatch(
    124             datetime.now(), 'some_userid', 'PWD', 9.99, 5)
     125            datetime.now(tz), 'some_userid', 'PWD', 9.99, 5)
    125126        pins = pin_container['PWD-1'].values()
    126127        self.pwdpins = [x.representation for x in pins]
Note: See TracChangeset for help on using the changeset viewer.