Ignore:
Timestamp:
12 Mar 2015, 08:25:43 (10 years ago)
Author:
Henrik Bettermann
Message:

Add plugin to update existing sites.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/container.py

    r12311 r12746  
    2020"""
    2121import grok
     22from waeup.ikoba.interfaces import IIkobaPluggable
    2223from waeup.ikoba.payments.interfaces import IPaymentsContainer
    2324from waeup.ikoba.utils.helpers import attrs_to_fields
     
    4142
    4243PaymentsContainer = attrs_to_fields(PaymentsContainer)
     44
     45class PaymentsPlugin(grok.GlobalUtility):
     46    """A plugin that creates container for payments inside a company.
     47    """
     48    grok.implements(IIkobaPluggable)
     49    grok.name('payments')
     50
     51    def setup(self, site, name, logger):
     52        if 'payments' in site.keys():
     53            logger.warn('Could not create container for payments.')
     54            return
     55        site['payments'] = PaymentsContainer()
     56        logger.info('Container for payments created')
     57        return
     58
     59    def update(self, site, name, logger):
     60        if not 'payments' in site.keys():
     61            self.setup(site, name, logger)
Note: See TracChangeset for help on using the changeset viewer.