Skip to content
Snippets Groups Projects
Commit 006f8481 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

ENH: names of records can now be used for identification

parent 96fb0548
No related branches found
No related tags found
No related merge requests found
......@@ -147,12 +147,16 @@ class AbstractCFood(object):
@staticmethod
def find_existing(entity):
query_string = "FIND Record " + entity.get_parents()[0].name
#import IPython
# IPython.embed()
query_string += " with " + " and ".join(
["'" + p.name + "'='"
+ get_value(p) + "'" for p in entity.get_properties()])
if entity.name is None:
query_string = "FIND Record " + entity.get_parents()[0].name
#import IPython
# IPython.embed()
query_string += " with " + " and ".join(
["'" + p.name + "'='"
+ get_value(p) + "'" for p in entity.get_properties()])
else:
query_string = "FIND '{}'".format(entity.name)
print(query_string)
q = db.Query(query_string)
try:
......
......@@ -35,7 +35,10 @@ def replace_path_prefix(path, old_prefix, new_prefix):
"""
if not path.startswith(old_prefix):
raise RuntimeError("Path does not start with old_prefix")
raise RuntimeError(
"Path does not start with old_prefix\n{}\nvs\n{}".format(
path,
old_prefix))
path = path[len(old_prefix):]
return os.path.join(new_prefix, path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment