def test_categorization_language(self): """The vocabulary of the language field in the ICategorization behavior should only allow to set, what was configured in ``plone.available_languages`` registry setting. """ # set available languages registry = getUtility(IRegistry) registry['plone.available_languages'] = ['hu', 'sl'] self.portal.invokeFactory('Folder', 'test') ob = self.portal.test cat = ICategorization(ob) cat.language = 'hu' self.assertEqual(ob.language, 'hu') cat.language = 'sl' self.assertEqual(ob.language, 'sl') with self.assertRaises(ConstraintNotSatisfied): cat.language = 'de' with self.assertRaises(ConstraintNotSatisfied): cat.language = 'en'
def dx_action(self, obj): if self.effectiveDate and hasattr(obj, 'effective_date'): obj.effective_date = DateTime(self.effectiveDate) if self.expirationDate and hasattr(obj, 'expiration_date'): obj.expiration_date = DateTime(self.expirationDate) if self.copyright and hasattr(obj, 'rights'): obj.rights = self.copyright if self.contributors and hasattr(obj, 'contributors'): obj.contributors = tuple(self.contributors) if self.creators and hasattr(obj, 'creators'): obj.creators = tuple(self.creators) if self.exclude and hasattr(obj, 'exclude_from_nav'): obj.exclude_from_nav = self.exclude == 'yes' behavior_categorization = ICategorization(obj) if self.language and behavior_categorization: behavior_categorization.language = self.language