source: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/configuration.py @ 17945

Last change on this file since 17945 was 17791, checked in by Henrik Bettermann, 6 months ago

Adjust to base package.

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1## $Id: configuration.py 17791 2024-05-16 09:19:45Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""
19Containers for session configuration objects.
20"""
21import grok
22from zope.interface import implementedBy
23from waeup.kofa.utils.helpers import attrs_to_fields, iface_names
24from waeup.kofa.configuration import (
25    SessionConfigurationFactory, SessionConfiguration,
26    SessionConfigurationProcessor, SessionConfigurationExporter)
27from kofacustom.iuokada.interfaces import (
28    ICustomSessionConfiguration, ICustomSessionConfigurationAdd)
29
30
31class CustomSessionConfiguration(SessionConfiguration):
32    """
33    Customized session configuration model
34    """
35
36    grok.implements(ICustomSessionConfiguration, ICustomSessionConfigurationAdd)
37
38CustomSessionConfiguration = attrs_to_fields(CustomSessionConfiguration)
39
40class CustomSessionConfigurationFactory(SessionConfigurationFactory):
41    """A customized factory for session configuration objects.
42    """
43
44    def __call__(self, *args, **kw):
45        return CustomSessionConfiguration(*args, **kw)
46
47    def getInterfaces(self):
48        return implementedBy(CustomSessionConfiguration)
49
50class CustomSessionConfigurationExporter(SessionConfigurationExporter):
51    """The Session Configuration Exporter exports all configuration data. It iterates over all
52    objects of the ``configuration`` container.
53    """
54    fields = tuple(sorted(iface_names(ICustomSessionConfiguration)))
55
56class CustomSessionConfigurationProcessor(SessionConfigurationProcessor):
57    """The Session Configuration Processor processes session configuration objects in
58    the ``configuration`` container.
59
60    """
61    iface = ICustomSessionConfiguration
62
Note: See TracBrowser for help on using the repository browser.