Changeset 8183 for main/waeup.kofa/trunk


Ignore:
Timestamp:
16 Apr 2012, 21:07:28 (13 years ago)
Author:
Henrik Bettermann
Message:

Part 2: Consider time zone when creating datetime strings for histories, filenames etc.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py

    r8182 r8183  
    246246        """
    247247        ac_storage = self._getStoragePath()
    248         now = datetime.now()
     248        tz = getUtility(IKofaUtils).tzinfo
     249        now = datetime.now(tz)
    249250        timestamp = now.strftime('%Y_%m_%d_%H_%M_%S')
    250251        csv_path = os.path.join(
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r8182 r8183  
    828828            return
    829829        IWorkflowInfo(self.context).fireTransition('submit')
    830         self.context.application_date = datetime.now()
     830        tz = getUtility(IKofaUtils).tzinfo
     831        self.context.application_date = datetime.now(tz)
    831832        self.context.locked = True
    832833        self.flash(_('Form has been submitted.'))
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py

    r8159 r8183  
    3232from zope.i18n import translate
    3333from zope.publisher.browser import TestRequest
     34from zope.component import getUtility
    3435from waeup.kofa.browser.interfaces import IPDFCreator
     36from waeup.kofa.interfaces import IKofaUtils
    3537from waeup.kofa.interfaces import MessageFactory as _
    3638
     
    328330        canvas.setFont("Helvetica", 9)
    329331        if not getattr(doc, 'kofa_nodate', False):
    330             today = datetime.now().strftime('%d/%m/%Y %H:%M:%S')
     332            tz = getUtility(IKofaUtils).tzinfo
     333            today = datetime.now(tz).strftime('%d/%m/%Y %H:%M:%S')
    331334            canvas.drawString(2.2*cm, 0.5 * inch,
    332335                translate(_(u'Date: ${a}', mapping = {'a': today})))
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py

    r7811 r8183  
    2121import grok
    2222from zope.event import notify
     23from zope.component import getUtility
    2324from datetime import datetime
    2425from waeup.kofa.utils.helpers import attrs_to_fields
     
    2627from waeup.kofa.hostels.interfaces import IHostel, IBed, IBedAllocateStudent
    2728from waeup.kofa.students.interfaces import IBedTicket
     29from waeup.kofa.interfaces import IKofaUtils
    2830from waeup.kofa.interfaces import MessageFactory as _
    2931
     
    204206                return '%s without bed ticket' % old_owner
    205207            bedticket.bed = None
    206             timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     208            tz = getUtility(IKofaUtils).tzinfo
     209            timestamp = datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
    207210            bedticket.bed_coordinates = u'-- booking cancelled on %s --' % timestamp
    208211            return old_owner
  • main/waeup.kofa/trunk/src/waeup/kofa/objecthistory.py

    r7959 r8183  
    6060        """
    6161        msgs = self._getMessages()
    62         timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     62        tz = getUtility(IKofaUtils).tzinfo
     63        timestamp = datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
    6364        user = get_current_principal()
    6465        if user is None:
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r8180 r8183  
    207207      story = []
    208208      frame_footer = Frame(1*cm,0,width-(2*cm),1*cm)
    209       timestamp = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
     209      tz = getUtility(IKofaUtils).tzinfo
     210      timestamp = datetime.now(tz).strftime("%d/%m/%Y %H:%M:%S")
    210211      left_text = '<font size=10>%s</font>' % timestamp
    211212      story.append(Paragraph(left_text, style["Normal"]))
Note: See TracChangeset for help on using the changeset viewer.