Changeset 12232


Ignore:
Timestamp:
14 Dec 2014, 21:41:02 (10 years ago)
Author:
Henrik Bettermann
Message:

Catch

AttributeError?: 'list' object has no attribute 'keys'

if department don't have courses (like on pcn-demo portal).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r12180 r12232  
    4242from zope.session.interfaces import ISession
    4343from zope.password.interfaces import IPasswordManager
     44from waeup.kofa.utils.helpers import html2dict
    4445from waeup.kofa.browser.layout import (
    4546    KofaPage, KofaForm, KofaEditFormPage, KofaAddFormPage,
     
    6667from waeup.kofa.university.vocabularies import course_levels
    6768from waeup.kofa.authentication import LocalRoleSetEvent
    68 from waeup.kofa.widgets.htmlwidget import HTMLDisplayWidget
    6969from waeup.kofa.utils.helpers import get_user_account, check_csv_charset
    7070from waeup.kofa.mandates.mandate import PasswordMandate
     
    765765#
    766766
    767 class ConfigurationContainerDisplayFormPage(KofaDisplayFormPage):
    768     """View page of the configuration container.
    769     """
    770     grok.require('waeup.managePortalConfiguration')
    771     grok.name('view')
    772     grok.context(IConfigurationContainer)
    773     pnav = 0
    774     label = _(u'View portal configuration')
    775     form_fields = grok.AutoFields(IConfigurationContainer)
    776     form_fields['frontpage'].custom_widget = HTMLDisplayWidget
    777 
    778 
    779767class ConfigurationContainerManageFormPage(KofaEditFormPage):
    780768    """Manage page of the configuration container. We always use the
     
    794782        'frontpage_dict')
    795783
    796     def _frontpage(self):
    797         view = ConfigurationContainerDisplayFormPage(
    798             self.context,self.request)
    799         view.setUpWidgets()
    800         return view.widgets['frontpage']()
    801 
    802784    @action(_('Save'), style='primary')
    803785    def save(self, **data):
    804786        msave(self, **data)
    805         self.context.frontpage_dict = self._frontpage()
     787        frontpage = getattr(self.context, 'frontpage', None)
     788        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     789        self.context.frontpage_dict = html2dict(frontpage, portal_language)
    806790        return
    807791
Note: See TracChangeset for help on using the changeset viewer.