Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gerion Entrup
brainzfs
Commits
d09adf36
Commit
d09adf36
authored
Nov 14, 2016
by
Gerion Entrup
Browse files
retrieval: fix cache cleaning
fixes sqlalchemy detachted session problem
parent
e569c7d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
retrieval/retrieval.py
View file @
d09adf36
...
...
@@ -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
]
=
{}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment