Changeset 8186 for main/waeup.kofa/trunk/src
- Timestamp:
- 17 Apr 2012, 00:31:10 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/accesscode.py
r8183 r8186 33 33 from zope.component import getUtility 34 34 from waeup.kofa.interfaces import IKofaUtils, IKofaPluggable, IObjectHistory 35 from waeup.kofa.utils.helpers import now 35 36 from waeup.kofa.utils.logger import Logger 36 37 from waeup.kofa.accesscodes.interfaces import ( … … 247 248 ac_storage = self._getStoragePath() 248 249 tz = getUtility(IKofaUtils).tzinfo 249 now = datetime.now(tz)250 timestamp = now.strftime('%Y_%m_%d_%H_%M_%S')250 dt_now = now(tz) 251 timestamp = dt_now.strftime('%Y_%m_%d_%H_%M_%S') 251 252 csv_path = os.path.join( 252 253 ac_storage, '%s-%s_archive-%s-%s.csv' % ( -
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_accesscode.py
r8182 r8186 233 233 # Access codes have a history. 234 234 match = re.match( 235 '^....-..-.. ..:..:.. - initialized by system',235 '^....-..-.. ..:..:.. ..... .+ - initialized by system', 236 236 self.ac1.history) 237 237 assert match is not None … … 301 301 "prefix","serial","ac","state","history" 302 302 "FOO","9.99","1","0" 303 "FOO","0","FOO-1-11111111","used","<YYYY-MM-DD hh:mm:ss > - ..."304 "FOO","1","FOO-1-22222222","initialized","<YYYY-MM-DD hh:mm:ss > - ..."305 "FOO","2","FOO-1-33333333","disabled","<YYYY-MM-DD hh:mm:ss > - ..."303 "FOO","0","FOO-1-11111111","used","<YYYY-MM-DD hh:mm:ss TZ> - ..." 304 "FOO","1","FOO-1-22222222","initialized","<YYYY-MM-DD hh:mm:ss TZ> - ..." 305 "FOO","2","FOO-1-33333333","disabled","<YYYY-MM-DD hh:mm:ss TZ> - ..." 306 306 '''[1:] 307 307 contents = open(result_path, 'rb').read() -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r8183 r8186 51 51 from waeup.kofa.permissions import get_users_with_local_roles 52 52 from waeup.kofa.students.interfaces import IStudentsUtils 53 from waeup.kofa.utils.helpers import string_from_bytes, file_size 53 from waeup.kofa.utils.helpers import string_from_bytes, file_size, now 54 54 from waeup.kofa.widgets.datewidget import ( 55 55 FriendlyDateDisplayWidget, FriendlyDateDisplayWidget, … … 829 829 IWorkflowInfo(self.context).fireTransition('submit') 830 830 tz = getUtility(IKofaUtils).tzinfo 831 self.context.application_date = datetime.now(tz)831 self.context.application_date = now(tz) 832 832 self.context.locked = True 833 833 self.flash(_('Form has been submitted.')) -
main/waeup.kofa/trunk/src/waeup/kofa/browser/pdf.py
r8183 r8186 34 34 from zope.component import getUtility 35 35 from waeup.kofa.browser.interfaces import IPDFCreator 36 from waeup.kofa.utils.helpers import now 36 37 from waeup.kofa.interfaces import IKofaUtils 37 38 from waeup.kofa.interfaces import MessageFactory as _ … … 331 332 if not getattr(doc, 'kofa_nodate', False): 332 333 tz = getUtility(IKofaUtils).tzinfo 333 today = datetime.now(tz).strftime('%d/%m/%Y %H:%M:%S')334 today = now(tz).strftime('%d/%m/%Y %H:%M:%S %z %Z') 334 335 canvas.drawString(2.2*cm, 0.5 * inch, 335 336 translate(_(u'Date: ${a}', mapping = {'a': today}))) -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py
r8183 r8186 29 29 from waeup.kofa.interfaces import IKofaUtils 30 30 from waeup.kofa.interfaces import MessageFactory as _ 31 from waeup.kofa.utils.helpers import now 31 32 32 33 class Hostel(grok.Container): … … 164 165 165 166 # 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 172 175 # for indexes (BTrees), that don't have this issue. 173 176 #hostel._p_changed = True … … 207 210 bedticket.bed = None 208 211 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,) 211 215 return old_owner 212 216 -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r7811 r8186 284 284 self.browser.contents) 285 285 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> --') 287 287 # If we release a free be, nothing will happen 288 288 ctrl = self.browser.getControl(name='val_id') -
main/waeup.kofa/trunk/src/waeup/kofa/objecthistory.py
r8183 r8186 23 23 from zope.annotation.interfaces import IAnnotations 24 24 from waeup.kofa.interfaces import IObjectHistory, IKofaObject, IKofaUtils 25 from waeup.kofa.utils.helpers import get_current_principal 25 from waeup.kofa.utils.helpers import get_current_principal, now 26 26 27 27 from waeup.kofa.interfaces import MessageFactory as _ … … 61 61 msgs = self._getMessages() 62 62 tz = getUtility(IKofaUtils).tzinfo 63 timestamp = datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")63 timestamp = now(tz).strftime("%Y-%m-%d %H:%M:%S %z %Z") 64 64 user = get_current_principal() 65 65 if user is None: -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r8183 r8186 39 39 from waeup.kofa.interfaces import MessageFactory as _ 40 40 from waeup.kofa.students.interfaces import IStudentsUtils 41 from waeup.kofa.utils.helpers import now 41 42 42 43 SLIP_STYLE = [ … … 208 209 frame_footer = Frame(1*cm,0,width-(2*cm),1*cm) 209 210 tz = getUtility(IKofaUtils).tzinfo 210 timestamp = datetime.now(tz).strftime("%d/%m/%Y %H:%M:%S")211 timestamp = now(tz).strftime("%d/%m/%Y %H:%M:%S %z %Z") 211 212 left_text = '<font size=10>%s</font>' % timestamp 212 213 story.append(Paragraph(left_text, style["Normal"])) -
main/waeup.kofa/trunk/src/waeup/kofa/testing.py
r7827 r8186 295 295 (re.compile(r'httperror_seek_wrapper:'), 'HTTPError:' ), 296 296 (re.compile('[\d]{10}'), '<10-DIGITS>'), 297 (re.compile('\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d [\+\-]\d\d\d\d [^ ]+'), 298 '<YYYY-MM-DD hh:mm:ss TZ>'), 297 299 (re.compile('\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d'), '<YYYY-MM-DD hh:mm:ss>'), 298 300 (re.compile('\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d'), '<DATETIME>'), -
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_objecthistory.py
r7819 r8186 80 80 hist.addMessage('blah') 81 81 result = ''.join(hist.messages) 82 self.assertMatches('<YYYY-MM-DD hh:mm:ss > - blah by system', result)82 self.assertMatches('<YYYY-MM-DD hh:mm:ss TZ> - blah by system', result) 83 83 84 84 def test_add_messages_existing_principal(self): … … 89 89 hist.addMessage('blah') 90 90 result = ''.join(hist.messages) 91 self.assertMatches('<YYYY-MM-DD hh:mm:ss > - blah by Bob', result)91 self.assertMatches('<YYYY-MM-DD hh:mm:ss TZ> - blah by Bob', result) 92 92 93 93 def test_messages(self):
Note: See TracChangeset for help on using the changeset viewer.