diff --git a/hyde/ext/plugins/structure.py b/hyde/ext/plugins/structure.py index 82b766d..e8f7f38 100644 --- a/hyde/ext/plugins/structure.py +++ b/hyde/ext/plugins/structure.py @@ -336,7 +336,8 @@ class PaginatorPlugin(Plugin): for node in self.site.content.walk(): added_resources = [] paged_resources = (res for res in node.resources - if hasattr(res.meta, 'paginator')) + if hasattr(res, "meta") + and hasattr(res.meta, 'paginator')) for resource in paged_resources: paginator = Paginator(resource.meta.paginator) added_resources += paginator.walk_paged_resources( diff --git a/hyde/tests/ext/test_paginator.py b/hyde/tests/ext/test_paginator.py index 8e78443..d7f42c2 100644 --- a/hyde/tests/ext/test_paginator.py +++ b/hyde/tests/ext/test_paginator.py @@ -31,6 +31,10 @@ class TestPaginator(object): def tearDown(self): TEST_SITE.delete() + def test_page_no_paginator(self): + f = File(self.deploy.child('empty.txt')) + assert f.exists + def test_pages_of_one(self): pages = ['pages_of_one.txt', 'page2/pages_of_one.txt', 'page3/pages_of_one.txt', 'page4/pages_of_one.txt'] diff --git a/hyde/tests/sites/test_paginator/content/empty.txt b/hyde/tests/sites/test_paginator/content/empty.txt new file mode 100644 index 0000000..bc56c4d --- /dev/null +++ b/hyde/tests/sites/test_paginator/content/empty.txt @@ -0,0 +1 @@ +Foo