]> mj.ucw.cz Git - eval.git/commitdiff
Added unfix(), corrected fix()
authorTomas Gavenciak <gavento@ucw.cz>
Fri, 24 Sep 2010 14:00:27 +0000 (16:00 +0200)
committerTomas Gavenciak <gavento@ucw.cz>
Fri, 24 Sep 2010 14:00:27 +0000 (16:00 +0200)
t/moe/config.py

index abc82692b05aaf02b590325b6ee7f1a6b308847a..e6ce045913797a4ff411ee84357fe543f1ab9a1d 100644 (file)
@@ -110,7 +110,14 @@ class ConfigTree(object):
     if isinstance(keys, types.StringTypes):
       keys = [keys]
     for key in keys:
-      self.lookup(key, create=True).fix()
+      self.lookup(key, create=False).fix()
+  
+  def unfix(self, keys):
+    "Unfix value of variable or list of variables. Unfixing undefined variable raises `UndefinedError`."
+    if isinstance(keys, types.StringTypes):
+      keys = [keys]
+    for key in keys:
+      self.lookup(key, create=False).unfix()
 
   def remove(self, parsed):
     """Given a list [(varname, `Operation`)] as returned by `parse` or `parse_file`,