# HG changeset patch # User Adrien Di Mascio # Date 1476716008 -7200 # Node ID 9a3663ec4ead07bc959cccea6ea9e1ae51513594 # Parent 9847a097266e263c3e77f2b8fdcf35751e44f599 [dataimport] make MetadataGenerator.META_RELATIONS customizable This should be done on the instance rather than on the class diff -r 9847a097266e -r 9a3663ec4ead cubicweb/dataimport/stores.py --- a/cubicweb/dataimport/stores.py Wed Sep 28 08:57:48 2016 +0200 +++ b/cubicweb/dataimport/stores.py Mon Oct 17 16:53:28 2016 +0200 @@ -272,12 +272,12 @@ * `baseurl`: optional base URL to be used for `cwuri` generation - default to config['base-url'] * `source`: optional source to be used as `cw_source` for imported entities """ - META_RELATIONS = (META_RTYPES - - VIRTUAL_RTYPES - - set(('eid', 'cwuri', - 'is', 'is_instance_of', 'cw_source'))) + META_RELATIONS = frozenset(META_RTYPES + - VIRTUAL_RTYPES + - set(('eid', 'cwuri', + 'is', 'is_instance_of', 'cw_source'))) - def __init__(self, cnx, baseurl=None, source=None): + def __init__(self, cnx, baseurl=None, source=None, meta_skipped=()): self._cnx = cnx if baseurl is None: config = cnx.vreg.config @@ -295,7 +295,8 @@ # attributes/relations specific to each entity self._entity_attrs = ['cwuri'] rschema = cnx.vreg.schema.rschema - for rtype in self.META_RELATIONS: + self.meta_relations = self.META_RELATIONS - set(meta_skipped) + for rtype in self.meta_relations: # skip owned_by / created_by if user is the internal manager if cnx.user.eid == -1 and rtype in ('owned_by', 'created_by'): continue