Пример #1
0
 def get_value(self, context, wizard_id, property=None):
     """
     If called with a «property» returns the property of the wizard
     identified by «wizard_id». If no «property», just return the entire
     wizard object.
     """
     warnings.warn(
         "Templatetag cms_wizard will be removed in django CMS 3.5",
         PendingDeprecationWarning
     )
     try:
         wizard = wizard_pool.get_entry(wizard_id)
         return wizard.widget_attributes.get(property, wizard)
     except ValueError:
         return None
Пример #2
0
    def get_value(self, context, wizard_id, property=None):
        """
        If called with a «property» returns the property of the wizard
        identified by «wizard_id». If no «property», just return the entire
        wizard object.
        """
        try:
            wizard = wizard_pool.get_entry(wizard_id)
        except ValueError:
            wizard = None

        if wizard:
            if property in ['description', 'title', 'weight']:
                # getters
                getter = getattr(wizard, "get_{0}".format(property), None)
                return getter()
            elif property in ['id', 'form', 'model', 'template_name']:
                # properties
                return getattr(wizard, property, None)
            else:
                return wizard
        return None
Пример #3
0
    def get_value(self, context, wizard_id, property=None):
        """
        If called with a «property» returns the property of the wizard
        identified by «wizard_id». If no «property», just return the entire
        wizard object.
        """
        try:
            wizard = wizard_pool.get_entry(wizard_id)
        except ValueError:
            wizard = None

        if wizard:
            if property in ['description', 'title', 'weight']:
                # getters
                getter = getattr(wizard, "get_{0}".format(property), None)
                return getter()
            elif property in ['id', 'form', 'model', 'template_name']:
                # properties
                return getattr(wizard, property, None)
            else:
                return wizard
        return None
Пример #4
0
 def test_get_entry(self):
     wizard_pool._clear()
     wizard_pool.register(self.page_wizard)
     entry = wizard_pool.get_entry(self.page_wizard)
     self.assertEqual(entry, self.page_wizard)
Пример #5
0
 def test_get_entry(self):
     wizard_pool._clear()
     wizard_pool.register(self.page_wizard)
     entry = wizard_pool.get_entry(self.page_wizard)
     self.assertEqual(entry, self.page_wizard)