def manage_addPredicate(self, id, title, predicate, expression, component_name, REQUEST=None): """ Factory method that creates a Property Set Predicate""" obj = createPredicate(predicate, id, title, expression, component_name) self._setObject(id, obj) if REQUEST is not None: next = 'manage_main' if hasattr(obj, 'manage_changeSettingsForm'): next = 'manage_changeSettingsForm' REQUEST['RESPONSE'].redirect('/'.join((self.absolute_url(), id, next))) return self._getOb(id)
def _updateMarshallRegistry(registry, xml, should_purge, encoding=None): if should_purge: registry.manage_delObjects(ids=list(registry.objectIds())) importer = MarshallRegistryImporter(registry, encoding) reg_info = importer.parseXML(xml) for info in reg_info['predicates']: if registry.hasObject(info['id']): registry.manage_delObjects(ids=[info['id']]) obj = createPredicate(info['predicate_name'], info['id'], info['title'], info['expression'], info['component']) if (info['predicate_name'] in ('xmlns_attr', ) and info.get('xml_settings', ())): obj.edit(**info['xml_settings'][0]) registry._setObject(info['id'], obj)
def _updateMarshallRegistry(registry, xml, should_purge, encoding=None): if should_purge: registry.manage_delObjects(ids=list(registry.objectIds())) importer = MarshallRegistryImporter(registry, encoding) reg_info = importer.parseXML(xml) for info in reg_info['predicates']: if registry.hasObject(info['id']): registry.manage_delObjects(ids=[info['id']]) obj = createPredicate(info['predicate_name'], info['id'], info['title'], info['expression'], info['component']) if (info['predicate_name'] in ('xmlns_attr',) and info.get('xml_settings', ())): obj.edit(**info['xml_settings'][0]) registry._setObject(info['id'], obj)