171 self.vreg.schema = schema |
171 self.vreg.schema = schema |
172 |
172 |
173 def internal_session(self): |
173 def internal_session(self): |
174 return FakeSession(self) |
174 return FakeSession(self) |
175 |
175 |
176 def extid2eid(self, source, extid, etype, session, insert=True): |
176 def extid2eid(self, source, extid, etype, cnx, insert=True): |
177 try: |
177 try: |
178 return self.extids[extid] |
178 return self.extids[extid] |
179 except KeyError: |
179 except KeyError: |
180 if not insert: |
180 if not insert: |
181 return None |
181 return None |
182 self._count += 1 |
182 self._count += 1 |
183 eid = self._count |
183 eid = self._count |
184 entity = source.before_entity_insertion(session, extid, etype, eid) |
184 entity = source.before_entity_insertion(cnx, extid, etype, eid) |
185 self.extids[extid] = eid |
185 self.extids[extid] = eid |
186 self.eids[eid] = extid |
186 self.eids[eid] = extid |
187 source.after_entity_insertion(session, extid, entity) |
187 source.after_entity_insertion(cnx, extid, entity) |
188 return eid |
188 return eid |
189 |
189 |
190 |
190 |
191 class FakeSource(object): |
191 class FakeSource(object): |
192 dbhelper = get_db_helper('sqlite') |
192 dbhelper = get_db_helper('sqlite') |