From d47707af6c8f0c683103016a8f21ab0e0ca4527f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 21 Jun 2012 15:31:57 +0200 Subject: [PATCH] Add Node.rwalk support Signed-off-by: Julien Danjou --- hyde/site.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hyde/site.py b/hyde/site.py index be17521..fa56087 100644 --- a/hyde/site.py +++ b/hyde/site.py @@ -192,6 +192,16 @@ class Node(Processable): for node in child.walk(): yield node + def rwalk(self): + """ + Walk the node upward, first yielding itself then + yielding its parents. + """ + x = self + while x: + yield x + x = x.parent + def walk_resources(self): """ Walks the resources in this hierarchy.