summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-01 21:33:56 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-12-01 21:33:56 (GMT)
commita60ab5ff45869757950a5184ad67de25801be62d (patch)
tree8654b0c34d566b06cd418b9f2cf6cc9a234f3317
parentc60c49ae0a6f2271151de7e4ba4113f3bbbce651 (diff)
downloadpython-sievelib-a60ab5ff45869757950a5184ad67de25801be62d.tar.gz
Just to show off, continue to look for parents until we run out
-rw-r--r--sievelib/parser.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/sievelib/parser.py b/sievelib/parser.py
index 4379654..95cee47 100644
--- a/sievelib/parser.py
+++ b/sievelib/parser.py
@@ -318,14 +318,13 @@ class Parser(object):
self.__set_expected("identifier")
if self.__curcommand is not None:
- this_is_parent = self.__curcommand.addchild(command)
-
- if not this_is_parent:
- next_parent = self.__curcommand.parent.addchild(command)
-
- if not next_parent:
+ cur_parent = self.__curcommand
+ while not cur_parent.addchild(command):
+ if hasattr(cur_parent, 'parent'):
+ cur_parent = cur_parent.parent
+ else:
raise ParseError("%s unexpected after a %s" % \
- (tvalue, self.__curcommand.name))
+ (tvalue, self.__curcommand.name))
self.__curcommand = command
self.__cstate = self.__arguments