Skip to content
Snippets Groups Projects
Commit 0e317506 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 1498e97d
No related branches found
No related tags found
No related merge requests found
...@@ -147,12 +147,16 @@ class AbstractCFood(object): ...@@ -147,12 +147,16 @@ class AbstractCFood(object):
@staticmethod @staticmethod
def find_existing(entity): def find_existing(entity):
query_string = "FIND Record " + entity.get_parents()[0].name if entity.name is None:
#import IPython query_string = "FIND Record " + entity.get_parents()[0].name
# IPython.embed() #import IPython
query_string += " with " + " and ".join( # IPython.embed()
["'" + p.name + "'='" query_string += " with " + " and ".join(
+ get_value(p) + "'" for p in entity.get_properties()]) ["'" + p.name + "'='"
+ get_value(p) + "'" for p in entity.get_properties()])
else:
query_string = "FIND '{}'".format(entity.name)
print(query_string) print(query_string)
q = db.Query(query_string) q = db.Query(query_string)
try: try:
......
...@@ -35,7 +35,10 @@ def replace_path_prefix(path, old_prefix, new_prefix): ...@@ -35,7 +35,10 @@ def replace_path_prefix(path, old_prefix, new_prefix):
""" """
if not path.startswith(old_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):] path = path[len(old_prefix):]
return os.path.join(new_prefix, path) 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