[ldapfeed] Use new MetadataGenerator api instead of deprecated MetaGenerator
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 19 Oct 2016 15:58:30 +0200
changeset 11730 6f303125bfc8
parent 11729 809407cbff11
child 11731 6563113b9caf
[ldapfeed] Use new MetadataGenerator api instead of deprecated MetaGenerator
cubicweb/sobjects/ldapparser.py
--- a/cubicweb/sobjects/ldapparser.py	Wed Oct 19 10:21:12 2016 +0200
+++ b/cubicweb/sobjects/ldapparser.py	Wed Oct 19 15:58:30 2016 +0200
@@ -31,17 +31,17 @@
 from cubicweb.dataimport import stores, importer
 
 
-class UserMetaGenerator(stores.MetaGenerator):
+class UserMetaGenerator(stores.MetadataGenerator):
     """Specific metadata generator, used to see newly created user into their initial state.
     """
     @cached
-    def base_etype_dicts(self, entity):
-        entity, rels = super(UserMetaGenerator, self).base_etype_dicts(entity)
-        if entity.cw_etype == 'CWUser':
+    def base_etype_rels(self, etype):
+        rels = super(UserMetaGenerator, self).base_etype_rels(etype)
+        if etype == 'CWUser':
             wf_state = self._cnx.execute('Any S WHERE ET default_workflow WF, ET name %(etype)s, '
-                                         'WF initial_state S', {'etype': entity.cw_etype}).one()
+                                         'WF initial_state S', {'etype': etype}).one()
             rels['in_state'] = wf_state.eid
-        return entity, rels
+        return rels
 
 
 class DataFeedLDAPAdapter(datafeed.DataFeedParser):