Changeset 12739


Ignore:
Timestamp:
11 Mar 2015, 22:51:40 (10 years ago)
Author:
uli
Message:

pep8, pyflakes

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  
    2626from zope.password.interfaces import IPasswordManager
    2727from zope.catalog.interfaces import ICatalog
    28 from zope.component import getUtility, createObject, queryUtility
     28from zope.component import getUtility, queryUtility
    2929from zope.component.interfaces import IFactory
    3030from zope.interface import implementedBy
    3131from zope.securitypolicy.interfaces import IPrincipalRoleManager
    32 from zope.schema.interfaces import ConstraintNotSatisfied
    3332
    3433from waeup.ikoba.image import IkobaImageFile
     
    3635from waeup.ikoba.interfaces import (
    3736    IObjectHistory, IUserAccount, IFileStoreNameChooser, IFileStoreHandler,
    38     IIkobaUtils, IExtFileStore,
    39     CREATED, REQUESTED, APPROVED)
     37    IIkobaUtils, IExtFileStore, )
    4038from waeup.ikoba.customers.interfaces import (
    4139    ICustomer, ICustomerNavigation, ICSVCustomerExporter,
     
    4543from waeup.ikoba.customers.contracts import ContractsContainer
    4644from waeup.ikoba.payments.interfaces import IPayer, IPayerFinder
    47 from waeup.ikoba.utils.helpers import attrs_to_fields, now, copy_filesystem_tree
     45from waeup.ikoba.utils.helpers import (
     46    attrs_to_fields, now, copy_filesystem_tree)
     47
    4848
    4949class Customer(grok.Container):
     
    7979            'password'] = passwordmanager.encodePassword(password)
    8080        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
    8283
    8384    def getTempPassword(self):
     
    9192        if temp_password_dict is not None:
    9293            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:
    9596                return temp_password_dict.get('password')
    9697            else:
     
    100101
    101102    def writeLogMessage(self, view, message):
    102         ob_class = view.__implemented__.__name__.replace('waeup.ikoba.','')
     103        ob_class = view.__implemented__.__name__.replace(
     104            'waeup.ikoba.', '')
    103105        self.__parent__.logger.info(
    104106            '%s - %s - %s' % (ob_class, self.__name__, message))
     
    198200    return
    199201
     202
    200203def move_customer_files(customer, del_dir):
    201204    """Move files belonging to `customer` to `del_dir`.
     
    248251        timestamp = str(now().replace(microsecond=0))  # store UTC timestamp
    249252        for num, row in enumerate(csv_data[1:-1]):
    250             csv_data[num+1] = csv_data[num+1] + ',' + timestamp
     253            csv_data[num + 1] = csv_data[num + 1] + ',' + timestamp
    251254        csv_path = os.path.join(del_dir, '%s.csv' % name)
    252255
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/tests/test_customer.py

    r12738 r12739  
    2121import re
    2222import unittest
    23 import grok
    2423from cStringIO import StringIO
    25 from datetime import tzinfo
    26 from zope.component import (
    27     getUtility, queryUtility, createObject, getUtilitiesFor,
    28     )
     24from zope.component import getUtility, getUtilitiesFor
    2925from zope.component.hooks import setSite
    30 from zope.catalog.interfaces import ICatalog
    3126from zope.component.interfaces import IFactory
    32 from zope.event import notify
    3327from zope.interface import verify
    34 from zope.schema.interfaces import RequiredMissing
    3528from waeup.ikoba.interfaces import IExtFileStore, IFileStoreNameChooser
    3629from waeup.ikoba.app import Company
     
    4538from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
    4639
     40
    4741class HelperTests(unittest.TestCase):
    4842    # Tests for helper functions in customer module.
     
    6660            path_from_custid('KM123456'), u'00120/KM123456')
    6761        return
     62
    6863
    6964class CustomerTest(FunctionalTestCase):
     
    257252        return
    258253
     254
    259255class CustomerFactoryTest(FunctionalTestCase):
    260256
Note: See TracChangeset for help on using the changeset viewer.