[10765] | 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 | """ |
---|
| 19 | Containers for session configuration objects. |
---|
| 20 | """ |
---|
| 21 | import grok |
---|
| 22 | from zope.interface import implementedBy |
---|
[17756] | 23 | from waeup.kofa.utils.helpers import attrs_to_fields, iface_names |
---|
[10765] | 24 | from waeup.kofa.configuration import ( |
---|
[17756] | 25 | SessionConfigurationFactory, SessionConfiguration, |
---|
[17791] | 26 | SessionConfigurationProcessor, SessionConfigurationExporter) |
---|
[15563] | 27 | from kofacustom.iuokada.interfaces import ( |
---|
[10765] | 28 | ICustomSessionConfiguration, ICustomSessionConfigurationAdd) |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | class CustomSessionConfiguration(SessionConfiguration): |
---|
| 32 | """ |
---|
| 33 | Customized session configuration model |
---|
| 34 | """ |
---|
| 35 | |
---|
| 36 | grok.implements(ICustomSessionConfiguration, ICustomSessionConfigurationAdd) |
---|
| 37 | |
---|
| 38 | CustomSessionConfiguration = attrs_to_fields(CustomSessionConfiguration) |
---|
| 39 | |
---|
| 40 | class 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): |
---|
[17756] | 48 | return implementedBy(CustomSessionConfiguration) |
---|
| 49 | |
---|
[17791] | 50 | class CustomSessionConfigurationExporter(SessionConfigurationExporter): |
---|
| 51 | """The Session Configuration Exporter exports all configuration data. It iterates over all |
---|
[17756] | 52 | objects of the ``configuration`` container. |
---|
| 53 | """ |
---|
| 54 | fields = tuple(sorted(iface_names(ICustomSessionConfiguration))) |
---|
| 55 | |
---|
[17791] | 56 | class CustomSessionConfigurationProcessor(SessionConfigurationProcessor): |
---|
| 57 | """The Session Configuration Processor processes session configuration objects in |
---|
[17756] | 58 | the ``configuration`` container. |
---|
| 59 | |
---|
| 60 | """ |
---|
| 61 | iface = ICustomSessionConfiguration |
---|
| 62 | |
---|