Ignore:
Timestamp:
18 Nov 2014, 11:37:28 (10 years ago)
Author:
Henrik Bettermann
Message:

pep8

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/__init__.py

    r11956 r11985  
    22"""
    33# Make this a package.
    4 
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/authentication.py

    r11958 r11985  
    11## $Id: authentication.py 10055 2013-04-04 15:12:43Z uli $
    2 ## 
     2##
    33## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
    44## This program is free software; you can redistribute it and/or modify
     
    66## the Free Software Foundation; either version 2 of the License, or
    77## (at your option) any later version.
    8 ## 
     8##
    99## This program is distributed in the hope that it will be useful,
    1010## but WITHOUT ANY WARRANTY; without even the implied warranty of
    1111## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1212## GNU General Public License for more details.
    13 ## 
     13##
    1414## You should have received a copy of the GNU General Public License
    1515## along with this program; if not, write to the Free Software
     
    3535from waeup.ikoba.customers.interfaces import ICustomer
    3636
     37
    3738class CustomerAccount(grok.Adapter):
    3839    """An adapter to turn customer objects into accounts on-the-fly.
     
    126127        return passwordmanager.checkPassword(self.context.password, password)
    127128
     129
    128130class CustomersAuthenticatorPlugin(grok.GlobalUtility):
    129131    grok.implements(IAuthenticatorPlugin)
     
    188190        return IUserAccount(customer)
    189191
     192
    190193class PasswordChangeCredentialsPlugin(grok.GlobalUtility,
    191194                                      SessionCredentialsPlugin):
     
    279282        # Return old credentials for this one request only
    280283        return old_credentials
     284
    281285
    282286class CustomersAuthenticatorSetup(grok.GlobalUtility):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/batching.py

    r11964 r11985  
    2525"""
    2626import grok
    27 import unicodecsv as csv # XXX: csv ops should move to dedicated module.
     27import unicodecsv as csv  # XXX: csv ops should move to dedicated module.
    2828from time import time
    2929from datetime import datetime
     
    4646from waeup.ikoba.utils.batching import BatchProcessor
    4747
     48
    4849class CustomerProcessor(BatchProcessor):
    4950    """A batch processor for ICustomer objects.
     
    6667        fields = getFields(self.iface)
    6768        return sorted(list(set(
    68             ['customer_id','reg_number',
     69            ['customer_id', 'reg_number',
    6970            'password', 'state', 'transition'] + fields.keys())))
    7071
     
    9697
    9798    def getLocator(self, row):
    98         if row.get('customer_id',None) not in (None, IGNORE_MARKER):
     99        if row.get('customer_id', None) not in (None, IGNORE_MARKER):
    99100            return 'customer_id'
    100         elif row.get('reg_number',None) not in (None, IGNORE_MARKER):
     101        elif row.get('reg_number', None) not in (None, IGNORE_MARKER):
    101102            return 'reg_number'
    102103        else:
     
    192193                value = row['state']
    193194                IWorkflowState(obj).setState(value)
    194                 msg = _("State '${a}' set", mapping = {'a':value})
     195                msg = _("State '${a}' set", mapping={'a': value})
    195196                history = IObjectHistory(obj)
    196197                history.addMessage(msg)
     
    212213        # Log actions...
    213214        parent = self.getParent(row, site)
    214         if hasattr(obj,'customer_id'):
     215        if hasattr(obj, 'customer_id'):
    215216            # Update mode: the customer exists and we can get the customer_id.
    216217            # Create mode: the record contains the customer_id
     
    223224            # is always set.
    224225            parent.logger.info(
    225                 '%s - %s - %s - imported: %s' 
     226                '%s - %s - %s - imported: %s'
    226227                % (self.name, filename, obj.customer_id, items_changed))
    227228        return items_changed
     
    250251                iface = self.iface_byregnumber
    251252        converter = IObjectConverter(iface)
    252         errs, inv_errs, conv_dict =  converter.fromStringDict(
     253        errs, inv_errs, conv_dict = converter.fromStringDict(
    253254            row, self.factory_name, mode=mode)
    254255        if 'transition' in row:
    255256            if row['transition'] not in IMPORTABLE_TRANSITIONS:
    256257                if row['transition'] not in (IGNORE_MARKER, ''):
    257                     errs.append(('transition','not allowed'))
     258                    errs.append(('transition', 'not allowed'))
    258259        if 'state' in row:
    259260            if row['state'] not in IMPORTABLE_STATES:
    260261                if row['state'] not in (IGNORE_MARKER, ''):
    261                     errs.append(('state','not allowed'))
     262                    errs.append(('state', 'not allowed'))
    262263                else:
    263264                    # State is an attribute of Customer and must not
     
    292293    @property
    293294    def available_fields(self):
    294         fields = ['customer_id','reg_number'] + self.additional_fields
     295        fields = ['customer_id', 'reg_number'] + self.additional_fields
    295296        return sorted(list(set(fields + getFields(
    296297                self.iface).keys())))
     
    342343        """
    343344        converter = IObjectConverter(self.iface)
    344         errs, inv_errs, conv_dict =  converter.fromStringDict(
     345        errs, inv_errs, conv_dict = converter.fromStringDict(
    345346            row, self.factory_name, mode=mode)
    346347        return errs, inv_errs, conv_dict
     
    361362            result[raw_header[num]] = field
    362363        return result
    363 
    364 
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py

    r11979 r11985  
    5151grok.context(IIkobaObject)
    5252
     53
    5354class CustomersBreadcrumb(Breadcrumb):
    5455    """A breadcrumb for the customers container.
     
    7273    def title(self):
    7374        return self.context.display_fullname
     75
    7476
    7577class CustomersContainerPage(IkobaPage):
     
    112114            self.flash(_('No customer found.'), type="warning")
    113115        return
     116
    114117
    115118class CustomersContainerManagePage(IkobaPage):
     
    168171        if len(deleted):
    169172            self.flash(_('Successfully removed: ${a}',
    170                 mapping = {'a':', '.join(deleted)}))
    171         return
     173                mapping={'a': ','.join(deleted)}))
     174        return
     175
    172176
    173177class CustomerAddFormPage(IkobaAddFormPage):
     
    191195        return
    192196
     197
    193198class LoginAsCustomerStep1(IkobaEditFormPage):
    194199    """ View to temporarily set a customer password.
     
    202207    def label(self):
    203208        return _(u'Set temporary password for ${a}',
    204             mapping = {'a':self.context.display_fullname})
     209            mapping={'a': self.context.display_fullname})
    205210
    206211    @action('Set password now', style='primary')
     
    211216        self.context.writeLogMessage(
    212217            self, 'temp_password generated: %s' % password)
    213         args = {'password':password}
     218        args = {'password': password}
    214219        self.redirect(self.url(self.context) +
    215220            '/loginasstep2?%s' % urlencode(args))
    216221        return
     222
    217223
    218224class LoginAsCustomerStep2(IkobaPage):
     
    228234    def label(self):
    229235        return _(u'Login as ${a}',
    230             mapping = {'a':self.context.customer_id})
     236            mapping={'a': self.context.customer_id})
    231237
    232238    def update(self, SUBMIT=None, password=None):
     
    237243        return
    238244
     245
    239246class CustomerBaseDisplayFormPage(IkobaDisplayFormPage):
    240247    """ Page to display customer base data
     
    252259        if self.context.suspended:
    253260            return _('${a}: Base Data (account deactivated)',
    254                 mapping = {'a':self.context.display_fullname})
     261                mapping={'a': self.context.display_fullname})
    255262        return  _('${a}: Base Data',
    256             mapping = {'a':self.context.display_fullname})
     263            mapping={'a': self.context.display_fullname})
    257264
    258265    @property
     
    262269        return _('unset')
    263270
     271
    264272class ContactCustomerForm(ContactAdminForm):
    265273    grok.context(ICustomer)
     
    277285    def label(self):
    278286        return _(u'Send message to ${a}',
    279             mapping = {'a':self.context.display_fullname})
     287            mapping={'a': self.context.display_fullname})
    280288
    281289    @action('Send message now', style='primary')
     
    289297        ikoba_utils = getUtility(IIkobaUtils)
    290298        success = ikoba_utils.sendContactForm(
    291                 self.request.principal.title,email,
    292                 self.context.display_fullname,self.context.email,
     299                self.request.principal.title, email,
     300                self.context.display_fullname, self.context.email,
    293301                self.request.principal.id,usertype,
    294302                self.config.name,
    295                 data['body'],data['subject'])
     303                data['body'], data['subject'])
    296304        if success:
    297305            self.flash(_('Your message has been sent.'))
     
    299307            self.flash(_('An smtp server error occurred.'), type="danger")
    300308        return
     309
    301310
    302311class CustomerBaseManageFormPage(IkobaEditFormPage):
     
    326335            errors = validator.validate_password(password, password_ctl)
    327336            if errors:
    328                 self.flash( ' '.join(errors), type="danger")
     337                self.flash(' '.join(errors), type="danger")
    329338                return
    330339        changed_fields = self.applyData(self.context, **data)
     
    344353        return
    345354
     355
    346356class CustomerTriggerTransitionFormPage(IkobaEditFormPage):
    347357    """ View to manage customer base data
     
    375385        return
    376386
     387
    377388class CustomerActivatePage(UtilityView, grok.View):
    378389    """ Activate customer account
     
    394405        return
    395406
     407
    396408class CustomerDeactivatePage(UtilityView, grok.View):
    397409    """ Deactivate customer account
     
    413425        return
    414426
     427
    415428class CustomerHistoryPage(IkobaPage):
    416429    """ Page to display customer history
     
    424437    @property
    425438    def label(self):
    426         return _('${a}: History', mapping = {'a':self.context.display_fullname})
     439        return _('${a}: History', mapping={'a':self.context.display_fullname})
     440
    427441
    428442class CustomerRequestPasswordPage(IkobaAddFormPage):
     
    446460        # Forward only email to landing page in base package.
    447461        self.redirect(self.url(self.context, 'requestpw_complete',
    448             data = dict(email=email)))
     462            data=dict(email=email)))
    449463        return
    450464
     
    513527        return
    514528
     529
    515530class CustomerRequestPasswordEmailSent(IkobaPage):
    516531    """Landing page after successful password request.
     
    527542        self.customer_id = customer_id
    528543        return
     544
    529545
    530546class CustomerFilesUploadPage(IkobaPage):
     
    548564# Pages for customers only
    549565
     566
    550567class CustomerBaseEditFormPage(IkobaEditFormPage):
    551568    """ View to edit customer base data
     
    563580        msave(self, **data)
    564581        return
     582
    565583
    566584class CustomerChangePasswordPage(IkobaEditFormPage):
     
    587605                self.flash(_('Password changed.'))
    588606            else:
    589                 self.flash( ' '.join(errors), type="warning")
    590         return
    591 
     607                self.flash(' '.join(errors), type="warning")
     608        return
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/catalog.py

    r11958 r11985  
    2929from waeup.ikoba.customers.interfaces import ICustomer
    3030
     31
    3132class CustomersCatalog(grok.Indexes):
    3233    """A catalog for customers.
     
    4142    reg_number = index.Field(attribute='reg_number')
    4243    state = index.Field(attribute='state')
     44
    4345
    4446class CustomerQueryResultItem(object):
     
    5658        self.state = context.state
    5759        self.translated_state = context.translated_state
     60
    5861
    5962def search(query=None, searchtype=None, view=None):
     
    8285    return hitlist
    8386
     87
    8488class SimpleFieldSearch(object):
    8589    """A programmatic (no UI required) search.
     
    9397    """
    9498    catalog_name = 'customers_catalog'
     99
    95100    def __call__(self, **kw):
    96101        """Search customers catalog programmatically.
     
    106111simple_search = SimpleFieldSearch()
    107112
     113
    108114class CustomersQuery(FilteredCatalogQueryBase):
    109115    """Query customers in a site. See waeup.ikoba.catalog for more info.
    110116    """
    111117    cat_name = 'customers_catalog'
    112     defaults = dict(customer_id=None) # make sure we get all studs by default
     118    defaults = dict(customer_id=None)  # make sure we get all studs by default
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/container.py

    r11956 r11985  
    2828from waeup.ikoba.utils.logger import Logger
    2929
    30 lock = allocate_lock() # a lock object to lock threads.
     30lock = allocate_lock()  # a lock object to lock threads.
     31
    3132
    3233class CustomersContainer(grok.Container, Logger):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/customer.py

    r11964 r11985  
    4646RE_CUSTID_NON_NUM = re.compile('[^\d]+')
    4747
     48
    4849class Customer(grok.Container):
    4950    """This is a customer container for the various objects
     
    7677            'password'] = passwordmanager.encodePassword(password)
    7778        self.temp_password['user'] = user
    78         self.temp_password['timestamp'] = datetime.utcnow() # offset-naive datetime
     79        self.temp_password['timestamp'] = datetime.utcnow()  # offset-naive datetime
    7980
    8081    def getTempPassword(self):
    8182        """Check if a temporary password has been set and if it
    82         is not expired. 
     83        is not expired.
    8384
    8485        Return the temporary password if valid,
     
    147148Customer = attrs_to_fields(Customer)
    148149
     150
    149151class CustomerFactory(grok.GlobalUtility):
    150152    """A factory for customers.
     
    160162    def getInterfaces(self):
    161163        return implementedBy(Customer)
     164
    162165
    163166@grok.subscribe(ICustomer, grok.IObjectAddedEvent)
     
    177180        IWorkflowInfo(customer).fireTransition('create')
    178181    return
     182
    179183
    180184def path_from_custid(customer_id):
     
    215219    return folder_name
    216220
     221
    217222def move_customer_files(customer, del_dir):
    218223    """Move files belonging to `customer` to `del_dir`.
     
    242247    return
    243248
     249
    244250def update_customer_deletion_csvs(customer, del_dir):
    245251    """Update deletion CSV files with data from customer.
     
    262268
    263269        # append a deletion timestamp on each data row
    264         timestamp = str(now().replace(microsecond=0)) # store UTC timestamp
     270        timestamp = str(now().replace(microsecond=0))  # store UTC timestamp
    265271        for num, row in enumerate(csv_data[1:-1]):
    266272            csv_data[num+1] = csv_data[num+1] + ',' + timestamp
     
    276282            open(csv_path, 'a').write('\r\n'.join(csv_data[1:]))
    277283    return
     284
    278285
    279286@grok.subscribe(ICustomer, grok.IObjectRemovedEvent)
     
    320327CUSTOMER_FILE_STORE_NAME = 'file-customer'
    321328
     329
    322330class CustomerFileNameChooser(grok.Adapter):
    323331    """A file id chooser for :class:`Customer` objects.
     
    410418        # call super method to ensure that any old files with
    411419        # different filename extension are deleted.
    412         file, path, file_obj =  super(
     420        file, path, file_obj = super(
    413421            CustomerFileStoreHandler, self).createFile(
    414422            store, root,  filename, file_id, file)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/export.py

    r11958 r11985  
    3535EXPORTER_NAMES = ('customers', )
    3636
     37
    3738def get_customers(site, cust_filter=CustomersQuery()):
    3839    """Get all customers registered in catalog in `site`.
    3940    """
    4041    return cust_filter.query()
     42
    4143
    4244class CustomerExporterBase(ExporterBase):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/files.py

    r11972 r11985  
    3636    CustomerFilesUploadPage)
    3737
    38 grok.context(IIkobaObject) # Make IIkobaObject the default context
     38grok.context(IIkobaObject)  # Make IIkobaObject the default context
    3939grok.templatedir('browser_templates')
     40
    4041
    4142def handle_file_delete(context, view, download_name):
     
    4647    store.deleteFileByContext(context, attr=download_name)
    4748    context.writeLogMessage(view, 'deleted: %s' % download_name)
    48     view.flash(_('${a} deleted.', mapping = {'a':download_name}))
     49    view.flash(_('${a} deleted.', mapping={'a': download_name}))
    4950    return
     51
    5052
    5153def handle_file_upload(upload, context, view, max_size, download_name=None):
     
    6264        view.flash(_('Uploaded file is too big.'), type="danger")
    6365        return False
    64     upload.seek(0) # file pointer moved when determining size
     66    upload.seek(0)  # file pointer moved when determining size
    6567    dummy,ext = os.path.splitext(upload.filename)
    6668    # fpm files are expected to be fingerprint minutiae, file
     
    7072    else:
    7173        file_format = get_fileformat(None, upload.read(512))
    72         upload.seek(0) # same here
     74        upload.seek(0)  # same here
    7375    if file_format is None:
    7476        view.flash(_('Could not determine file type.'), type="danger")
     
    7880        if '.' + file_format != expected_ext:
    7981            view.flash(_('${a} file extension expected.',
    80                 mapping = {'a':expected_ext[1:]}), type="danger")
     82                mapping={'a': expected_ext[1:]}), type="danger")
    8183            return False
    8284    else:
     
    8486            view.flash(
    8587                _('Only the following extensions are allowed: ${a}',
    86                 mapping = {'a':', '.join(ALLOWED_FILE_EXTENSIONS)}),
     88                mapping={'a': ', '.join(ALLOWED_FILE_EXTENSIONS)}),
    8789                type="danger")
    8890            return False
     
    9395    context.writeLogMessage(view, 'uploaded: %s (%s)' % (
    9496        download_name,upload.filename))
    95     view.flash(_('File ${a} uploaded.', mapping = {'a':download_name}))
     97    view.flash(_('File ${a} uploaded.', mapping={'a': download_name}))
    9698    return True
     99
    97100
    98101class FileManager(grok.ViewletManager):
     
    100103    """
    101104    grok.name('files')
     105
    102106
    103107class FileDisplay(grok.Viewlet):
     
    123127        else:
    124128            return False
     129
    125130
    126131class FileUpload(FileDisplay):
     
    179184        return
    180185
     186
    181187class PassportDisplay(FileDisplay):
    182188    """Passport display viewlet.
     
    188194    label = _(u'Passport Picture')
    189195    download_name = u'passport.jpg'
     196
    190197
    191198class PassportUploadManage(FileUpload):
     
    201208    tab_redirect = '#tab2'
    202209
     210
    203211class PassportUploadEdit(PassportUploadManage):
    204212    """Passport upload viewlet for customers.
     
    206214    grok.view(CustomerFilesUploadPage)
    207215    grok.require('waeup.uploadCustomerFile')
     216
    208217
    209218class Image(grok.View):
     
    238247        return image
    239248
     249
    240250class Passport(Image):
    241251    """Renders jpeg passport picture.
     
    244254    download_name = u'passport.jpg'
    245255    grok.context(ICustomer)
    246 
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/interfaces.py

    r11967 r11985  
    3030    contextual_reg_num_source, GenderSource, nats_vocab)
    3131
     32
    3233class ICustomersUtils(Interface):
    3334    """A collection of methods which are subject to customization.
    3435
    3536    """
     37
    3638
    3739class ICustomersContainer(IIkobaObject):
     
    8789
    8890        """
     91
    8992
    9093class ICustomer(IIkobaObject):
     
    173176        """
    174177
     178
    175179class ICustomerUpdateByRegNo(ICustomer):
    176180    """Representation of a customer. Skip regular reg_number validation.
     
    181185        required = False,
    182186        )
     187
    183188
    184189class ICSVCustomerExporter(ICSVExporter):
     
    198203        """
    199204
     205
    200206class ICustomerRequestPW(ICustomer):
    201207    """Representation of an customer for first-time password request.
     
    219225        constraint=validate_email,
    220226        )
    221 
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/permissions.py

    r11967 r11985  
    2323# Customer section permissions
    2424
     25
    2526class HandleCustomer(grok.Permission):
    2627    grok.name('waeup.handleCustomer')
     28
    2729
    2830class ViewCustomer(grok.Permission):
    2931    grok.name('waeup.viewCustomer')
    3032
     33
    3134class ViewCustomersTab(grok.Permission):
    3235    grok.name('waeup.viewCustomersTab')
     36
    3337
    3438class ViewMyCustomerDataTab(grok.Permission):
    3539    grok.name('waeup.viewMyCustomerDataTab')
    3640
     41
    3742class ViewCustomersContainer(grok.Permission):
    3843    grok.name('waeup.viewCustomersContainer')
     44
    3945
    4046class PayCustomer(grok.Permission):
    4147    grok.name('waeup.payCustomer')
    4248
     49
    4350class UploadCustomerFile(grok.Permission):
    4451    grok.name('waeup.uploadCustomerFile')
     52
    4553
    4654class ManageCustomer(grok.Permission):
    4755    grok.name('waeup.manageCustomer')
    4856
     57
    4958class LoginAsCustomer(grok.Permission):
    5059    grok.name('waeup.loginAsCustomer')
    5160
     61
    5262class TriggerTransition(grok.Permission):
    5363    grok.name('waeup.triggerTransition')
     64
    5465
    5566# Local role
     
    6071                     'waeup.viewCustomer', 'waeup.payCustomer')
    6172
     73
    6274# Site Roles
    6375class CustomerRole(grok.Role):
     
    6779                     'waeup.Authenticated')
    6880
     81
    6982class CustomersOfficer(grok.Role):
    7083    grok.name('waeup.CustomersOfficer')
     
    7285    grok.permissions('waeup.viewCustomer','waeup.viewCustomers',
    7386          'waeup.viewCustomersTab', 'waeup.viewCustomersContainer')
     87
    7488
    7589class CustomersManager(grok.Role):
     
    8195                     'waeup.viewCustomersTab', 'waeup.triggerTransition')
    8296
     97
    8398class CustomerImpersonator(grok.Role):
    8499    grok.name('waeup.CustomerImpersonator')
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py

    r11971 r11985  
    2222from waeup.ikoba.customers.interfaces import ICustomersUtils
    2323
     24
    2425def generate_customer_id():
    2526    customers = grok.getSite()['customers']
    2627    new_id = customers.unique_customer_id
    2728    return new_id
     29
    2830
    2931class CustomersUtils(grok.GlobalUtility):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py

    r11979 r11985  
    1 3## $Id: viewlets.py 11772 2014-07-31 04:38:23Z henrik $
     1## $Id: viewlets.py 11772 2014-07-31 04:38:23Z henrik $
    22##
    33## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
     
    3333    CustomerBaseDisplayFormPage)
    3434
    35 grok.context(IIkobaObject) # Make IIkobaObject the default context
     35grok.context(IIkobaObject)  # Make IIkobaObject the default context
    3636grok.templatedir('browser_templates')
     37
    3738
    3839class CustomersTab(PrimaryNavTab):
     
    5253        return self.view.application_url('customers')
    5354
     55
    5456class PrimaryCustomerNavManager(grok.ViewletManager):
    5557    """Viewlet manager for the primary navigation tab.
    5658    """
    5759    grok.name('primary_nav_customer')
     60
    5861
    5962class PrimaryCustomerNavTab(grok.Viewlet):
     
    7881            return 'active'
    7982        return ''
     83
    8084
    8185class MyCustomerDataTab(PrimaryCustomerNavTab):
     
    107111        return targets
    108112
     113
    109114class CustomerManageSidebar(grok.ViewletManager):
    110115    grok.name('left_customermanage')
     116
    111117
    112118class CustomerManageLink(grok.Viewlet):
     
    135141                url, text)
    136142
     143
    137144class CustomerManageBaseLink(CustomerManageLink):
    138145    grok.order(2)
     
    140147    text = _(u'Base Data')
    141148
     149
    142150class CustomerManageHistoryLink(CustomerManageLink):
    143151    grok.order(8)
     
    145153    text = _(u'History')
    146154
     155
    147156class CustomersContainerManageActionButton(ManageActionButton):
    148157    grok.order(1)
     
    152161    text = _('Manage customer section')
    153162
     163
    154164class CustomersContainerAddActionButton(AddActionButton):
    155165    grok.order(1)
     
    159169    text = _('Add customer')
    160170    target = 'addcustomer'
     171
    161172
    162173class ContactActionButton(ManageActionButton):
     
    169180    target = 'contactcustomer'
    170181
     182
    171183class CustomerBaseManageActionButton(ManageActionButton):
    172184    grok.order(1)
     
    176188    text = _('Manage')
    177189    target = 'manage_base'
     190
    178191
    179192class CustomerTrigTransActionButton(ManageActionButton):
     
    186199    target = 'trigtrans'
    187200
     201
    188202class CustomerLoginAsActionButton(ManageActionButton):
    189203    grok.order(3)
     
    195209    target = 'loginasstep1'
    196210
     211
    197212class CustomerDeactivateActionButton(ManageActionButton):
    198213    grok.order(7)
     
    215230            "'A history message will be added. Are you sure?'")
    216231
     232
    217233class CustomerActivateActionButton(ManageActionButton):
    218234    grok.order(7)
     
    235251            "'A history message will be added. Are you sure?'")
    236252
     253
    237254class CustomerPasswordActionButton(ManageActionButton):
    238255    grok.order(2)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/vocabularies.py

    r11958 r11985  
    5656            return _('female')
    5757
     58
    5859class RegNumNotInSource(ValidationError):
    5960    """Registration number exists already
     
    6263    # by zope.formlib.
    6364    pass
     65
    6466
    6567class RegNumberSource(object):
     
    7981    validation_error = RegNumNotInSource
    8082    comp_field = 'customer_id'
     83
    8184    def __init__(self, context):
    8285        self.context = context
     
    107110        return True
    108111
     112
    109113def contextual_reg_num_source(context):
    110114    source = RegNumberSource(context)
    111115    return source
     116
    112117directlyProvides(contextual_reg_num_source, IContextSourceBinder)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/workflow.py

    r11982 r11985  
    100100registration_workflow = IkobaWorkflow(REGISTRATION_TRANSITIONS)
    101101
     102
    102103class RegistrationWorkflowState(WorkflowState, grok.Adapter):
    103104    """An adapter to adapt Customer objects to workflow states.
     
    108109    state_key = 'wf.registration.state'
    109110    state_id = 'wf.registration.id'
     111
    110112
    111113class RegistrationWorkflowInfo(IkobaWorkflowInfo, grok.Adapter):
     
    118120        self.context = context
    119121        self.wf = registration_workflow
     122
    120123
    121124@grok.subscribe(ICustomer, IWorkflowTransitionEvent)
Note: See TracChangeset for help on using the changeset viewer.