diff markup/path.py @ 211:0a14c2a06be3

Fix another regression introduced in [258]: some kinds of cascaded match templates were broken, for example in the TurboGears example app.
author cmlenz
date Tue, 29 Aug 2006 21:14:58 +0000
parents a2e0a7986d19
children e92135672812
line wrap: on
line diff
--- a/markup/path.py
+++ b/markup/path.py
@@ -151,16 +151,17 @@
 
         def _test(kind, data, pos, variables):
             for steps, size, stack in paths:
+                if kind is END:
+                    if stack:
+                        stack.pop()
+                    continue
+                elif kind is START:
+                    stack.append(stack and stack[-1] or 0)
+
                 if not stack:
                     continue
                 cursor = stack[-1]
 
-                if kind is END:
-                    stack.pop()
-                    continue
-                elif kind is START:
-                    stack.append(cursor)
-
                 while 1:
                     axis, nodetest, predicates = steps[cursor]
 
Copyright (C) 2012-2017 Edgewall Software