コード例 #1
0
ファイル: forms.py プロジェクト: collective/eea.uberlisting
 def handleSave(self, action):
     """ Save form data
     """
     data, errors = self.extractData()
     if errors:
         return False
     else:
         self.applyChanges(data)
         _redirect(self, _('Saved uberlisting configuration changes'))
コード例 #2
0
 def textListingOrIcon(data):
     """ :param data: form data passed on submit
         :return: error if both listTemplatesAsText and
         onlyTemplatesWithIcons is enabled
     """
     if data.listTemplatesAsText and data.onlyTemplatesWithIcons:
         raise Invalid(_(u"'List templates as text' and 'List only "
                         u"templates with icons' are mutually "
                         u"exclusive"))
コード例 #3
0
ファイル: view.py プロジェクト: gopinath6/eea.uberlisting
    def disable(self):
        """ Disable uberlisting view by noLongerProviding IUberlistingView
        interface
        """
        try:
            translations = self.context.getTranslations()
            for trans in translations.values():
                # set as the layout the first available template
                trans[0].setLayout(trans[0].getAvailableLayouts()[0][0])
                noLongerProvides(trans[0], IUberlistingView)
                trans[0].reindexObject(idxs='object_provides')
        except AttributeError:
            self.context.setLayout(self.context.getAvailableLayouts()[0][0])
            noLongerProvides(self.context, IUberlistingView)
            self.context.reindexObject(idxs='object_provides')

        _redirect(self, _('UberlistingView disabled'))
コード例 #4
0
ファイル: view.py プロジェクト: gopinath6/eea.uberlisting
    def enable(self):
        """ Enable uberlisting view by providing IUberlistingView interface
        """
        # enable this listing also for the translation of the context if
        # LinguaPlone is enabled and this context is translated
        try:
            translations = self.context.getTranslations()
            for trans in translations.values():
                trans[0].setLayout('uberlisting_view')
                alsoProvides(trans[0], IUberlistingView)
                trans[0].reindexObject(idxs='object_provides')
        except AttributeError:
            self.context.setLayout('uberlisting_view')
            alsoProvides(self.context, IUberlistingView)
            self.context.reindexObject(idxs='object_provides')

        _redirect(self, _('UberlistingView enabled'))
コード例 #5
0
ファイル: forms.py プロジェクト: collective/eea.uberlisting
 def handleCancel(self, action):
     """ Cancel form edit
     """
     _redirect(self, _('Canceled uberlisting configuration changes'))