Ignore:
Timestamp:
17 Apr 2012, 00:31:10 (13 years ago)
Author:
uli
Message:

Use new helper functions to compute pytz timezones correctly.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/hostels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py

    r8183 r8186  
    2929from waeup.kofa.interfaces import IKofaUtils
    3030from waeup.kofa.interfaces import MessageFactory as _
     31from waeup.kofa.utils.helpers import now
    3132
    3233class Hostel(grok.Container):
     
    164165
    165166            # Comment of Martijn:
    166             # If you have a non-Persistent subobject (like a list) and you change it,
    167             # you need to manually flag the persistence machinery on the object that
    168             # its subobject changed, with _p_changed. This is only necessary if some
    169             # of the objects are not sublclasses of Persistent. For common built-in
    170             # collections in Python such as list and dictionary there are replacements
    171             # (PersistentList, PersistentMapping), and more advanced building blocks
     167            # If you have a non-Persistent subobject (like a list) and
     168            # you change it, you need to manually flag the persistence
     169            # machinery on the object that its subobject changed, with
     170            # _p_changed. This is only necessary if some of the
     171            # objects are not sublclasses of Persistent. For common
     172            # built-in collections in Python such as list and
     173            # dictionary there are replacements (PersistentList,
     174            # PersistentMapping), and more advanced building blocks
    172175            # for indexes (BTrees), that don't have this issue.
    173176            #hostel._p_changed = True
     
    207210            bedticket.bed = None
    208211            tz = getUtility(IKofaUtils).tzinfo
    209             timestamp = datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
    210             bedticket.bed_coordinates = u'-- booking cancelled on %s --' % timestamp
     212            timestamp = now(tz).strftime("%Y-%m-%d %H:%M:%S %z %Z")
     213            bedticket.bed_coordinates = u'-- booking cancelled on %s --' % (
     214                timestamp,)
    211215            return old_owner
    212216
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py

    r7811 r8186  
    284284          self.browser.contents)
    285285        self.assertMatches(bedticket.bed_coordinates,
    286           u' -- booking cancelled on <YYYY-MM-DD hh:mm:ss> --')
     286          u' -- booking cancelled on <YYYY-MM-DD hh:mm:ss TZ> --')
    287287        # If we release a free be, nothing will happen
    288288        ctrl = self.browser.getControl(name='val_id')
Note: See TracChangeset for help on using the changeset viewer.