Commit d09adf36 authored by Gerion Entrup's avatar Gerion Entrup
Browse files

retrieval: fix cache cleaning

fixes sqlalchemy detachted session problem
parent e569c7d9
......@@ -51,7 +51,8 @@ class Retrieval():
"""See retrieval.create"""
entity = self._structure[table]
assert(len(args) == len(entity.parameter))
# konstruct keys
# map argument values to entity.query_filter keywords
# needed for unique identification
kwargs = entity.query_filter.get_kwargs()
for key in kwargs:
kwargs[key] = args[entity.parameter.index(kwargs[key])]
......@@ -85,8 +86,8 @@ class Retrieval():
def commit(self):
"""See retrieval.commit"""
with session_scope(self._Session) as session:
for table in self._cache.values():
for entity in table.values():
for table in self._cache:
for entity in self._cache[table].values():
session.add(entity)
# clean the cache
table = {}
self._cache[table] = {}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment