Ignore:
Timestamp:
9 Dec 2014, 16:45:52 (10 years ago)
Author:
Henrik Bettermann
Message:

Remove session configuration. We do not have sessions in Ikoba.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/browser/breadcrumbs.py

    r11954 r12186  
    2424
    2525from waeup.ikoba.interfaces import (
    26     IConfigurationContainer, ISessionConfiguration, IExportJobContainer)
     26    IConfigurationContainer, IExportJobContainer)
    2727from waeup.ikoba.interfaces import MessageFactory as _
    2828from waeup.ikoba.browser.interfaces import (
     
    126126    title = _(u'Portal Configuration')
    127127    parent_viewname = 'administration'
    128 
    129 class SessionConfigurationBreadcrumb(Breadcrumb):
    130     """A breadcrumb for the configuration container.
    131     """
    132     grok.context(ISessionConfiguration)
    133     title = u'Portal Session Configuration'
    134 
    135     @property
    136     def title(self):
    137         session_string = self.context.getSessionString()
    138         return 'Session %s' % session_string
    139128
    140129class UsersContainerBreadcrumb(Breadcrumb):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/browser/pages.py

    r11979 r12186  
    5353    IIkobaXMLImporter, IIkobaXMLExporter, IBatchProcessor,
    5454    ILocalRolesAssignable, DuplicationError, IConfigurationContainer,
    55     ISessionConfiguration, ISessionConfigurationAdd, IJobManager,
    56     IPasswordValidator, IContactForm, IIkobaUtils, ICSVExporter,
    57     application_sessions_vocab)
     55    IJobManager,
     56    IPasswordValidator, IContactForm, IIkobaUtils, ICSVExporter)
    5857from waeup.ikoba.permissions import (
    5958    get_users_with_local_roles, get_all_roles, get_all_users,
     
    743742    grok.name('index')
    744743    grok.context(IConfigurationContainer)
    745     grok.template('configurationmanagepage')
    746744    pnav = 0
    747745    label = _(u'Edit portal configuration')
    748     taboneactions = [_('Save'), _('Update plugins')]
    749     tabtwoactions = [
    750         _('Add session configuration'),
    751         _('Remove selected')]
    752746    form_fields = grok.AutoFields(IConfigurationContainer).omit(
    753747        'frontpage_dict')
     
    763757        msave(self, **data)
    764758        self.context.frontpage_dict = self._frontpage()
    765         return
    766 
    767     @action(_('Add session configuration'), validator=NullValidator,
    768             style='primary')
    769     def addSubunit(self, **data):
    770         self.redirect(self.url(self.context, '@@add'))
    771         return
    772 
    773     def getSessionConfigurations(self):
    774         """Get a list of all stored session configuration objects.
    775         """
    776         for key, val in self.context.items():
    777             url = self.url(val)
    778             session_string = val.getSessionString()
    779             title = _('Session ${a} Configuration',
    780                       mapping = {'a':session_string})
    781             yield(dict(url=url, name=key, title=title))
    782 
    783     @jsaction(_('Remove selected'))
    784     def delSessonConfigurations(self, **data):
    785         delSubobjects(self, redirect='@@index', tab='2')
    786759        return
    787760
     
    794767        grok.getSite().updatePlugins()
    795768        self.flash(_('Plugins were updated. See log file for details.'))
    796         return
    797 
    798 class SessionConfigurationAddFormPage(IkobaAddFormPage):
    799     """Add a session configuration object to configuration container.
    800     """
    801     grok.context(IConfigurationContainer)
    802     grok.name('add')
    803     grok.require('waeup.managePortalConfiguration')
    804     label = _('Add session configuration')
    805     form_fields = grok.AutoFields(ISessionConfigurationAdd)
    806     pnav = 0
    807 
    808     @action(_('Add Session Configuration'), style='primary')
    809     def addSessionConfiguration(self, **data):
    810         sessionconfiguration = createObject(u'waeup.SessionConfiguration')
    811         self.applyData(sessionconfiguration, **data)
    812         try:
    813             self.context.addSessionConfiguration(sessionconfiguration)
    814             ob_class = self.__implemented__.__name__.replace('waeup.ikoba.','')
    815             self.context.__parent__.logger.info(
    816                 '%s - added: %s' % (
    817                 ob_class, sessionconfiguration.application_session))
    818         except KeyError:
    819             self.flash(_('The session chosen already exists.'), type='danger')
    820             return
    821         self.redirect(self.url(self.context, '@@index')+'#tab2')
    822         return
    823 
    824     @action(_('Cancel'), validator=NullValidator)
    825     def cancel(self):
    826         self.redirect(self.url(self.context, '@@index')+'#tab2')
    827         return
    828 
    829 class SessionConfigurationManageFormPage(IkobaEditFormPage):
    830     """Manage session configuration object.
    831     """
    832     grok.context(ISessionConfiguration)
    833     grok.name('index')
    834     grok.require('waeup.managePortalConfiguration')
    835     form_fields = grok.AutoFields(ISessionConfiguration)
    836     pnav = 0
    837 
    838     @property
    839     def label(self):
    840         session_string = self.context.getSessionString()
    841         return _('Edit academic session ${a} configuration',
    842             mapping = {'a':session_string})
    843 
    844     @action(_('Save'), style='primary')
    845     def save(self, **data):
    846         msave(self, **data)
    847         self.redirect(self.url(self.context.__parent__, '@@index')+'#tab2')
    848         return
    849 
    850     @action(_('Cancel'), validator=NullValidator)
    851     def cancel(self):
    852         self.redirect(self.url(self.context.__parent__, '@@index')+'#tab2')
    853769        return
    854770
  • main/waeup.ikoba/trunk/src/waeup/ikoba/configuration.py

    r11949 r12186  
    2222from zope.component.interfaces import IFactory
    2323from zope.interface import implementedBy
    24 from waeup.ikoba.interfaces import (
    25     ISessionConfiguration, IConfigurationContainer, ISessionConfigurationAdd,
    26     application_sessions_vocab)
     24from waeup.ikoba.interfaces import IConfigurationContainer
    2725from waeup.ikoba.utils.helpers import attrs_to_fields
    2826
    2927class ConfigurationContainer(grok.Container):
    3028    """
    31     The node containing the session configuration models
     29    The node which may contain further configuration models (see waeup.kofa).
    3230    """
    3331
    3432    grok.implements(IConfigurationContainer)
    3533
    36     def addSessionConfiguration(self, sessionconfiguration):
    37         """Add a session configuration object.
    38         """
    39         if not ISessionConfiguration.providedBy(sessionconfiguration):
    40             raise TypeError(
    41                 'ConfigurationContainers contain only '
    42                 'ISessionConfiguration instances')
    43         code = unicode(sessionconfiguration.application_session)
    44         self[code] = sessionconfiguration
    45         return
    46 
    4734ConfigurationContainer = attrs_to_fields(ConfigurationContainer)
    48 
    49 class SessionConfiguration(grok.Model):
    50     """
    51     Session configuration model
    52     """
    53 
    54     grok.implements(ISessionConfiguration, ISessionConfigurationAdd)
    55 
    56     def getSessionString(self):
    57         return application_sessions_vocab.getTerm(self.application_session).title
    58 
    59 SessionConfiguration = attrs_to_fields(SessionConfiguration)
    60 
    61 class SessionConfigurationFactory(grok.GlobalUtility):
    62     """A factory for session configuration objects.
    63     """
    64     grok.implements(IFactory)
    65     grok.name(u'waeup.SessionConfiguration')
    66     title = u"Create a new session configuration object.",
    67     description = u"This factory instantiates new session configurations."
    68 
    69     def __call__(self, *args, **kw):
    70         return SessionConfiguration(*args, **kw)
    71 
    72     def getInterfaces(self):
    73         return implementedBy(SessionConfiguration)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12183 r12186  
    141141
    142142        self.app['configuration'].carry_over = True
    143         configuration = createObject('waeup.SessionConfiguration')
    144         self.app['configuration'].addSessionConfiguration(configuration)
    145143
    146144        # Update the catalog
  • main/waeup.ikoba/trunk/src/waeup/ikoba/interfaces.py

    r12089 r12186  
    8585            SimpleTerm(value, value, title) for title, value in terms])
    8686
    87 def application_sessions():
    88     curr_year = datetime.now().year
    89     year_range = range(1995, curr_year + 2)
    90     return [('%s/%s' % (year,year+1), year) for year in year_range]
    91 
    92 application_sessions_vocab = SimpleIkobaVocabulary(*application_sessions())
    9387
    9488class ContextualDictSourceFactoryBase(SmartBasicContextualSourceFactory):
     
    633627
    634628
    635 class ISessionConfiguration(IIkobaObject):
    636     """A session configuration object.
    637     """
    638 
    639     application_session = schema.Choice(
    640         title = _(u'Period'),
    641         source = application_sessions_vocab,
    642         default = None,
    643         required = True,
    644         readonly = True,
    645         )
    646 
    647 
    648     def getSessionString():
    649         """Returns the session string from the vocabulary.
    650         """
    651 
    652 
    653 class ISessionConfigurationAdd(ISessionConfiguration):
    654     """A session configuration object in add mode.
    655     """
    656 
    657     application_session = schema.Choice(
    658         title = _(u'Academic Session'),
    659         source = application_sessions_vocab,
    660         default = None,
    661         required = True,
    662         readonly = False,
    663         )
    664 
    665 ISessionConfigurationAdd['application_session'].order =  ISessionConfiguration[
    666     'application_session'].order
    667 
    668629class IDataCenter(IIkobaObject):
    669630    """A data center.
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/catalog.py

    r11954 r12186  
    3030
    3131    p_id = grok.index.Field(attribute='p_id')
    32     p_session = grok.index.Field(attribute='p_session')
    3332    p_category = grok.index.Field(attribute='p_category')
    3433    p_item = grok.index.Field(attribute='p_item')
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/interfaces.py

    r11949 r12186  
    1919from zope import schema
    2020from waeup.ikoba.interfaces import (
    21     IIkobaObject, SimpleIkobaVocabulary, application_sessions_vocab,
     21    IIkobaObject, SimpleIkobaVocabulary,
    2222    ContextualDictSourceFactoryBase)
    2323from waeup.ikoba.interfaces import MessageFactory as _
     
    6464        required = False,
    6565        readonly = True,
    66         )
    67 
    68     p_session = schema.Choice(
    69         title = _(u'Payment Session'),
    70         source = application_sessions_vocab,
    71         required = True,
    7266        )
    7367
  • main/waeup.ikoba/trunk/src/waeup/ikoba/products/tests/test_browser.py

    r12077 r12186  
    9797        # Add session configuration
    9898        self.app['configuration'].carry_over = True
    99         configuration = createObject('waeup.SessionConfiguration')
    100 
    101         self.app['configuration'].addSessionConfiguration(configuration)
    10299        self.login_path = 'http://localhost/app/login'
    103100        self.container_path = 'http://localhost/app/products'
  • main/waeup.ikoba/trunk/src/waeup/ikoba/tests/test_configuration.py

    r11949 r12186  
    2121from zope.interface import verify
    2222from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
    23 from waeup.ikoba.configuration import (
    24     ConfigurationContainer, SessionConfiguration, SessionConfigurationFactory)
    25 from waeup.ikoba.interfaces import(
    26     IConfigurationContainer, ISessionConfiguration, ISessionConfigurationAdd)
     23from waeup.ikoba.configuration import ConfigurationContainer
     24from waeup.ikoba.interfaces import IConfigurationContainer
    2725
    2826class ConfigurationTest(FunctionalTestCase):
     
    3331        super(ConfigurationTest, self).setUp()
    3432        self.confcontainer = ConfigurationContainer()
    35         self.sessionconf = SessionConfiguration()
    3633        return
    3734
     
    4340        verify.verifyClass(IConfigurationContainer, ConfigurationContainer)
    4441        verify.verifyObject(IConfigurationContainer, self.confcontainer)
    45         verify.verifyClass(ISessionConfiguration, SessionConfiguration)
    46         verify.verifyObject(ISessionConfiguration, self.sessionconf)
    47         verify.verifyClass(ISessionConfigurationAdd, SessionConfiguration)
    48         verify.verifyObject(ISessionConfigurationAdd, self.sessionconf)
    49 
    50 class SessionConfigurationFactoryTest(FunctionalTestCase):
    51 
    52     layer = FunctionalLayer
    53 
    54     def setUp(self):
    55         super(SessionConfigurationFactoryTest, self).setUp()
    56         self.factory = SessionConfigurationFactory()
    57 
    58     def tearDown(self):
    59         super(SessionConfigurationFactoryTest, self).tearDown()
    60 
    61     def test_interfaces(self):
    62         verify.verifyClass(IFactory, SessionConfigurationFactory)
    63         verify.verifyObject(IFactory, self.factory)
    64 
    65     def test_factory(self):
    66         obj = self.factory()
    67         assert isinstance(obj, SessionConfiguration)
    68 
    69     def test_getInterfaces(self):
    70         implemented_by = self.factory.getInterfaces()
    71         assert implemented_by.isOrExtends(ISessionConfiguration)
Note: See TracChangeset for help on using the changeset viewer.