jason kirtland avatar jason kirtland committed 85a3488

Component's .parent is a Component, not a Peg. fixes #1.

Comments (0)

Files changed (2)

pegboard/contrib/component/base.py

         peg = environ['pegboard.peg']
         self.context = peg
         self.all = environ['pegboard.board']
-        self.parent = peg.parent
+        self.parent = peg.parent and peg.parent.app or None
         self.environ = environ
         self.response = peg.response
         return self.prepare()

tests/component/test_components.py

         assert top.parent is None
         assert top.actions == ['preparing', 'processed', 'rendered', 'cleaned']
         child = components.pop(0)
-        assert child.parent.app is top
+        assert child.parent is top
         assert child.actions == ['preparing', 'processed', 'cleaned']
         grandchild = components.pop(0)
-        assert grandchild.parent.app is child
+        assert grandchild.parent is child
         assert grandchild.actions == ['preparing', 'processed', 'cleaned']
 
     def test_custom_peg_child(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.