Browse Source

Debugging problem ...

Yentl Van Tendeloo 7 years ago
parent
commit
a73917fe3e
2 changed files with 28 additions and 10 deletions
  1. 21 10
      bootstrap/core_algorithm.alc
  2. 7 0
      unit/test_all.py

+ 21 - 10
bootstrap/core_algorithm.alc

@@ -1628,22 +1628,33 @@ String function cmd_model_modify(model_name : String, metamodel_name : String):
 
 	model_id = get_entry_id(model_name)
 
+	log("Name: " + model_name)
 	if (model_id != ""):
 		if (allow_read(current_user_id, model_id)):
 			type_id = get_entry_id(metamodel_name)
 			if (type_id != ""):
 				if (allow_read(current_user_id, type_id)):
-					Element new_model
-					new_model = get_full_model(model_id, type_id)
-					if (element_eq(new_model, read_root())):
-						return "Conformance hierarchy unknown for: " + model_name!
-					modify(new_model, allow_write(current_user_id, model_id))
-					if (allow_write(current_user_id, model_id)):
-						// Overwrite the modified model
-						model_overwrite(new_model, model_id, type_id)
-					return "Success"!
+					log("Type 1: " + read_type(core, model_id))
+					log("Type 2: " + read_type(core, type_id))
+					if (read_type(core, model_id) != "Folder"):
+						if (read_type(core, type_id) != "Folder"):
+							Element new_model
+							new_model = get_full_model(model_id, type_id)
+							if (element_eq(new_model, read_root())):
+								return "Conformance hierarchy unknown for: " + model_name!
+							log("Enter modelling of " + model_name)
+							modify(new_model, allow_write(current_user_id, model_id))
+							if (allow_write(current_user_id, model_id)):
+								// Overwrite the modified model
+								model_overwrite(new_model, model_id, type_id)
+							log("Left model!")
+							return "Success"!
+						else:
+							return "Not a model: " + metamodel_name!
+					else:
+						return "Not a model: " + model_name!
 				else:
-					return "Read permission denied to: " + full_name(type_id)!
+					return "Read permission denied to: " + metamodel_name!
 			else:
 				return "Model not found: " + metamodel_name!
 		else:

+ 7 - 0
unit/test_all.py

@@ -2678,6 +2678,13 @@ class TestModelverse(unittest.TestCase):
         except UnknownM3:
             pass
 
+        # Check on folder "model"
+        try:
+            attribute_name("users", "a", "b", "c")
+            self.fail()
+        except NotAModel:
+            pass
+
     def test_op_group_create(self):
         # Test normal operation
         group_name_1 = "new_group"