Преглед изворни кода

Fix bug and enable caching

Yentl Van Tendeloo пре 8 година
родитељ
комит
12249b774e
2 измењених фајлова са 8 додато и 10 уклоњено
  1. 8 9
      bootstrap/core_algorithm.alc
  2. 0 1
      wrappers/modelverse.py

+ 8 - 9
bootstrap/core_algorithm.alc

@@ -254,19 +254,18 @@ String function get_entry_id(name : String):
 	String elem
 	Boolean found
 
-	log("Searching for " + name)
 	if (name == ""):
 		return caches["root"]!
 
-	//if (dict_in(caches["models"], name)):
-	//	if (full_name(caches["models"][name]) == name):
-	//		return caches["models"][name]!
+	if (dict_in(caches["models"], name)):
+		if (full_name(caches["models"][name]) == name):
+			return caches["models"][name]!
 
 	current = get_entry_id(get_foldername(name))
+
 	if (current == ""):
 		return ""!
 
-	log("Got result!")
 	if (current_part != ""):
 		elems = allAssociationDestinations(core, current, "contains")
 		while (set_len(elems) > 0):
@@ -277,7 +276,6 @@ String function get_entry_id(name : String):
 	else:
 		return current!
 
-	log("NOT FOUND")
 	return ""!
 
 String function get_service_id(name : String):
@@ -326,8 +324,9 @@ String function create_folders(user_id : String, folder_name : String):
 	String new_entry
 	String cummul
 
-	if (folder_name == ""):
-		return get_entry_id("")!
+	if (get_entry_id(folder_name) != ""):
+		// Folders already exist, so don't iterate
+		return get_entry_id(folder_name)!
 
 	i = 0
 	hierarchy = string_split(folder_name, "/")
@@ -362,7 +361,7 @@ String function store_entry(model_id : String, full_name : String, user_id : Str
 	prev = create_folders(user_id, get_foldername(full_name))
 	log("Created folders up to: " + cast_v2s(read_attribute(core, prev, "name")))
 	instantiate_link(core, "contains", "", prev, model_id)
-	return get_filename(full_name)!
+	return full_name!
 
 String function export_typing(model : Element, name : String, user_id : String):
 	String result

+ 0 - 1
wrappers/modelverse.py

@@ -353,7 +353,6 @@ def model_list_full(location):
     value = output.strip().split("\n")
     for v in value:
         m = v.strip()
-        print("Splitting " + m)
         perm, own, grp, m = m.split(" ", 3)
         lst.add((m, own, grp, perm))