src/pyams_skin/configuration.py
changeset 509 d157f898b1b6
parent 413 9921b2813e66
equal deleted inserted replaced
508:eb708d0e9298 509:d157f898b1b6
    36 #
    36 #
    37 # Dynamic front-office configuration
    37 # Dynamic front-office configuration
    38 # May be overriden by custom applications
    38 # May be overriden by custom applications
    39 #
    39 #
    40 
    40 
    41 @implementer(IConfiguration)
    41 @factory_config(IConfiguration)
    42 @factory_config(provided=IConfiguration)
       
    43 class Configuration(Persistent, Contained):
    42 class Configuration(Persistent, Contained):
    44     """Manageable configuration"""
    43     """Manageable configuration"""
    45 
    44 
    46     title = FieldProperty(IConfiguration['title'])
    45     title = FieldProperty(IConfiguration['title'])
    47     short_title = FieldProperty(IConfiguration['short_title'])
    46     short_title = FieldProperty(IConfiguration['short_title'])
    58 
    57 
    59 
    58 
    60 @adapter_config(context=IConfigurationManager, provides=IConfiguration)
    59 @adapter_config(context=IConfigurationManager, provides=IConfiguration)
    61 def configuration_factory(context):
    60 def configuration_factory(context):
    62     """Configuration factory"""
    61     """Configuration factory"""
    63     return get_annotation_adapter(context, SKIN_CONFIGURATION_KEY, factory=IConfiguration,
    62     return get_annotation_adapter(context, SKIN_CONFIGURATION_KEY, IConfiguration,
    64                                   name='++configuration++')
    63                                   name='++configuration++')
    65 
    64 
    66 
    65 
    67 @adapter_config(name='configuration', context=(Interface, Interface, Interface), provides=ITALESExtension)
    66 @adapter_config(name='configuration', context=(Interface, Interface, Interface), provides=ITALESExtension)
    68 class ConfigurationTalesExtension(ContextRequestViewAdapter):
    67 class ConfigurationTalesExtension(ContextRequestViewAdapter):
    97 #
    96 #
    98 # Dynamic back-office configuration
    97 # Dynamic back-office configuration
    99 # May be overriden by custom applications
    98 # May be overriden by custom applications
   100 #
    99 #
   101 
   100 
   102 @implementer(IBackOfficeConfiguration)
   101 @factory_config(IBackOfficeConfiguration)
   103 @factory_config(provided=IBackOfficeConfiguration)
       
   104 class BackOfficeConfiguration(Persistent, Contained):
   102 class BackOfficeConfiguration(Persistent, Contained):
   105     """Back-office manageable configuration"""
   103     """Back-office manageable configuration"""
   106 
   104 
   107     title = FieldProperty(IBackOfficeConfiguration['title'])
   105     title = FieldProperty(IBackOfficeConfiguration['title'])
   108     short_title = FieldProperty(IBackOfficeConfiguration['short_title'])
   106     short_title = FieldProperty(IBackOfficeConfiguration['short_title'])
   122 
   120 
   123 
   121 
   124 @adapter_config(context=IConfigurationManager, provides=IBackOfficeConfiguration)
   122 @adapter_config(context=IConfigurationManager, provides=IBackOfficeConfiguration)
   125 def back_office_configuration_factory(context):
   123 def back_office_configuration_factory(context):
   126     """Back-office configuration factory"""
   124     """Back-office configuration factory"""
   127     return get_annotation_adapter(context, SKIN_BACK_CONFIGURATION_KEY, factory=IBackOfficeConfiguration,
   125     return get_annotation_adapter(context, SKIN_BACK_CONFIGURATION_KEY, IBackOfficeConfiguration,
   128                                   name='++back-configuration++')
   126                                   name='++back-configuration++')
   129 
   127 
   130 
   128 
   131 @adapter_config(name='back_configuration', context=(Interface, Interface, Interface), provides=ITALESExtension)
   129 @adapter_config(name='back_configuration', context=(Interface, Interface, Interface), provides=ITALESExtension)
   132 class BackOfficeConfigurationTalesExtension(ContextRequestViewAdapter):
   130 class BackOfficeConfigurationTalesExtension(ContextRequestViewAdapter):