[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone3-274-gd9a0e57

Guillaume Chereau charlie at openmoko.org
Tue Nov 11 17:09:17 UTC 2008


The following commit has been merged in the master branch:
commit 93ac25e0ca1b86e076a7bde1552f7abf909c4bd7
Author: Guillaume Chereau <charlie at openmoko.org>
Date:   Wed Oct 29 11:03:10 2008 +0800

    oeventsd: Abort rule creation if there is a parsing error
    
    Before this, if a function call in the rule file fails, then the value returned by the function is None.
    Instead we raise an exception, and let the parser aborts the rule (with big error message)

diff --git a/framework/subsystems/oeventsd/parser.py b/framework/subsystems/oeventsd/parser.py
index 11c88ac..b135990 100644
--- a/framework/subsystems/oeventsd/parser.py
+++ b/framework/subsystems/oeventsd/parser.py
@@ -63,6 +63,7 @@ class AutoFunctionMetaClass(type):
                     return cls(*args)
                 except Exception, e:
                     logger.error("Error while calling function %s : %s", dict['function_name'], e)
+                    raise
             Function.register(dict['function_name'], func)
             
 class AutoFunction(object):
@@ -124,6 +125,7 @@ class HasAttr(Function):
         return AttributeFilter(**kargs)
 
 def as_rule(r):
+    """Turn a dictionary into a rule"""
     from rule import Rule, WhileRule # needs to be here to prevent circular import
     assert isinstance(r, dict), type(r)
     # We have to cases of rules :
@@ -172,10 +174,10 @@ class Parser(object):
     def parse_rules(self, src):
         """Parse a string for a list of rules"""
         rules = yaml.load(src, Loader=Loader)
-        rules = self.__parse(rules)
         ret = []
         for r in rules:
             try:
+                r = self.__parse(r)     # We should try to clean that...
                 ret.append(as_rule(r))
             except Exception, e:
                 logger.error("can't parse rule %s : %s", r, e)
@@ -183,7 +185,7 @@ class Parser(object):
         
     def parse_rule(self, src):
         """Parse a string for a rules"""
-        rule = yaml.load(src)
+        rule = yaml.load(src, Loader=Loader)
         rule = self.__parse(rule)
         try:
             return as_rule(rule)

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list