qmsk_www_pages/pages.py
changeset 61 308b2e3dfd6a
parent 60 bd9cea0b5b11
child 62 a2f29d787bea
--- a/qmsk_www_pages/pages.py	Sun Sep 14 00:59:07 2014 +0300
+++ b/qmsk_www_pages/pages.py	Sun Sep 14 01:07:54 2014 +0300
@@ -79,16 +79,29 @@
         if not page_type:
             return None
 
-        return page_type(page_path, page_name)
+        return page_type(
+            path    = page_path,
+            name    = page_name,
+            parents = parts,
+        )
 
-    def __init__ (self, path, name, encoding=ENCODING):
+    def __init__ (self, path, name, parents, encoding=ENCODING):
         self.path = path
         self.name = name
+        self.parents = parents
         self.encoding = encoding
 
     def open (self):
         return codecs.open(self.path, encoding=self.encoding)
 
+    def breadcrumb (self):
+        path = []
+
+        for parent in self.parents + [ self.name ]:
+            path.append(parent)
+
+            yield '/'.join(path), parent
+
     def render (self, request):
         raise NotImplementedError()