示例#1
0
def apply_customization_workflow(name, ti):
    """Apply customizations, features as per configuration from a workflow. 
    Must (currently) be run after db setup.
    """
    # support to infer/get the domain class from the type key
    from bungeni.models import domain, orm
    def get_domain_kls(name):
        """Infer the target domain kls from the type key, following underscore 
        naming to camel case convention.
        """
        return getattr(domain, naming.camel(name))
    
    # get the domain class, and associate with type
    kls = get_domain_kls(name)
    ti.domain_model = kls
    
    # We "mark" the domain class with IWorkflowed, to be able to 
    # register/lookup adapters generically on this single interface.
    classImplements(kls, IWorkflowed)
    
    # dynamic features from workflow
    wf = ti.workflow
    # decorate/modify domain/schema/mapping as needed
    kls = domain.configurable_domain(kls, wf)
    orm.configurable_mappings(kls)
    
    # !+ following should be part of the domain.feature_audit(kls) logic
    if wf.has_feature("audit"):
        # create/set module-level dedicated auditor singleton for auditable kls
        bungeni.core.audit.set_auditor(kls)
示例#2
0
 def _apply_customization_workflow(kls):
     # decorate/modify domain/schema/mapping as needed
     kls = domain.configurable_domain(kls, wf)
     schema.configurable_schema(kls)
     orm.configurable_mappings(kls)
     # !+ ok to call set_auditor(kls) more than once?
     # !+ following should be part of the domain.auditable(kls) logic
     if wf.has_feature("audit"):
         # create/set module-level dedicated auditor singleton for auditable kls
         bungeni.core.audit.set_auditor(kls)
示例#3
0
 def _apply_customization_workflow(kls):
     # decorate/modify domain/schema/mapping as needed
     kls = domain.configurable_domain(kls, wf)
     schema.configurable_schema(kls)
     orm.configurable_mappings(kls)
     # !+ ok to call set_auditor(kls) more than once?
     # !+ following should be part of the domain.auditable(kls) logic
     if wf.has_feature("audit"):
         # create/set module-level dedicated auditor singleton for auditable kls
         bungeni.core.audit.set_auditor(kls)