- Timestamp:
- 10 Jan 2016, 22:18:06 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/payments.py
r9993 r13583 20 20 """ 21 21 import grok 22 from datetime import datetime 23 from zope.component import getUtility 22 24 from zope.component.interfaces import IFactory 23 25 from zope.interface import implementedBy 26 from waeup.kofa.interfaces import IKofaUtils 24 27 from waeup.kofa.students.interfaces import IStudentNavigation 25 28 from waeup.kofa.students.payments import ( 26 29 StudentOnlinePayment, StudentOnlinePaymentFactory) 27 from waeup.kofa.utils.helpers import attrs_to_fields 30 from waeup.kofa.utils.helpers import attrs_to_fields, to_timezone 28 31 from waeup.uniben.students.interfaces import ICustomStudentOnlinePayment 29 32 … … 47 50 return self.__parent__.__parent__ 48 51 52 @property 53 def formatted_p_date(self): 54 if isinstance(self.payment_date, datetime): 55 tz = getUtility(IKofaUtils).tzinfo 56 try: 57 timestamp = to_timezone( 58 self.payment_date, tz).strftime("%Y-%m-%d %H:%M:%S") 59 except ValueError: 60 return None 61 return timestamp 62 else: 63 return None 64 49 65 CustomStudentOnlinePayment = attrs_to_fields( 50 66 CustomStudentOnlinePayment, omit=['display_item'])
Note: See TracChangeset for help on using the changeset viewer.