Changeset 12739
- Timestamp:
- 11 Mar 2015, 22:51:40 (10 years ago)
- Location:
- main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/customer.py
r12738 r12739 26 26 from zope.password.interfaces import IPasswordManager 27 27 from zope.catalog.interfaces import ICatalog 28 from zope.component import getUtility, createObject,queryUtility28 from zope.component import getUtility, queryUtility 29 29 from zope.component.interfaces import IFactory 30 30 from zope.interface import implementedBy 31 31 from zope.securitypolicy.interfaces import IPrincipalRoleManager 32 from zope.schema.interfaces import ConstraintNotSatisfied33 32 34 33 from waeup.ikoba.image import IkobaImageFile … … 36 35 from waeup.ikoba.interfaces import ( 37 36 IObjectHistory, IUserAccount, IFileStoreNameChooser, IFileStoreHandler, 38 IIkobaUtils, IExtFileStore, 39 CREATED, REQUESTED, APPROVED) 37 IIkobaUtils, IExtFileStore, ) 40 38 from waeup.ikoba.customers.interfaces import ( 41 39 ICustomer, ICustomerNavigation, ICSVCustomerExporter, … … 45 43 from waeup.ikoba.customers.contracts import ContractsContainer 46 44 from waeup.ikoba.payments.interfaces import IPayer, IPayerFinder 47 from waeup.ikoba.utils.helpers import attrs_to_fields, now, copy_filesystem_tree 45 from waeup.ikoba.utils.helpers import ( 46 attrs_to_fields, now, copy_filesystem_tree) 47 48 48 49 49 class Customer(grok.Container): … … 79 79 'password'] = passwordmanager.encodePassword(password) 80 80 self.temp_password['user'] = user 81 self.temp_password['timestamp'] = datetime.utcnow() # offset-naive datetime 81 self.temp_password[ 82 'timestamp'] = datetime.utcnow() # offset-naive datetime 82 83 83 84 def getTempPassword(self): … … 91 92 if temp_password_dict is not None: 92 93 delta = timedelta(minutes=self.temp_password_minutes) 93 now = datetime.utcnow()94 if now < temp_password_dict.get('timestamp') + delta:94 dt_now = datetime.utcnow() 95 if dt_now < temp_password_dict.get('timestamp') + delta: 95 96 return temp_password_dict.get('password') 96 97 else: … … 100 101 101 102 def writeLogMessage(self, view, message): 102 ob_class = view.__implemented__.__name__.replace('waeup.ikoba.','') 103 ob_class = view.__implemented__.__name__.replace( 104 'waeup.ikoba.', '') 103 105 self.__parent__.logger.info( 104 106 '%s - %s - %s' % (ob_class, self.__name__, message)) … … 198 200 return 199 201 202 200 203 def move_customer_files(customer, del_dir): 201 204 """Move files belonging to `customer` to `del_dir`. … … 248 251 timestamp = str(now().replace(microsecond=0)) # store UTC timestamp 249 252 for num, row in enumerate(csv_data[1:-1]): 250 csv_data[num +1] = csv_data[num+1] + ',' + timestamp253 csv_data[num + 1] = csv_data[num + 1] + ',' + timestamp 251 254 csv_path = os.path.join(del_dir, '%s.csv' % name) 252 255 -
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/tests/test_customer.py
r12738 r12739 21 21 import re 22 22 import unittest 23 import grok24 23 from cStringIO import StringIO 25 from datetime import tzinfo 26 from zope.component import ( 27 getUtility, queryUtility, createObject, getUtilitiesFor, 28 ) 24 from zope.component import getUtility, getUtilitiesFor 29 25 from zope.component.hooks import setSite 30 from zope.catalog.interfaces import ICatalog31 26 from zope.component.interfaces import IFactory 32 from zope.event import notify33 27 from zope.interface import verify 34 from zope.schema.interfaces import RequiredMissing35 28 from waeup.ikoba.interfaces import IExtFileStore, IFileStoreNameChooser 36 29 from waeup.ikoba.app import Company … … 45 38 from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase 46 39 40 47 41 class HelperTests(unittest.TestCase): 48 42 # Tests for helper functions in customer module. … … 66 60 path_from_custid('KM123456'), u'00120/KM123456') 67 61 return 62 68 63 69 64 class CustomerTest(FunctionalTestCase): … … 257 252 return 258 253 254 259 255 class CustomerFactoryTest(FunctionalTestCase): 260 256
Note: See TracChangeset for help on using the changeset viewer.