changeset 847:71c4f43d8fc1

data: Don't add route functions or data providers that happen to be null.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 27 Apr 2017 20:53:18 -0700
parents 148ce9bf8664
children 7d83b9484b98
files piecrust/data/builder.py piecrust/data/providersdata.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/data/builder.py	Sun Feb 19 22:28:34 2017 -0800
+++ b/piecrust/data/builder.py	Thu Apr 27 20:53:18 2017 -0700
@@ -51,6 +51,9 @@
 
     for route in app.routes:
         name = route.func_name
+        if not name:
+            continue
+
         func = data.get(name)
         if func is None:
             func = CompositeRouteFunction()
--- a/piecrust/data/providersdata.py	Sun Feb 19 22:28:34 2017 -0800
+++ b/piecrust/data/providersdata.py	Thu Apr 27 20:53:18 2017 -0700
@@ -37,4 +37,5 @@
                     endpoint = endpoint[e]
                 override = endpoint.get(endpoint_bits[-1])
                 provider = source.buildDataProvider(self._page, override)
-                endpoint[endpoint_bits[-1]] = provider
+                if provider is not None:
+                    endpoint[endpoint_bits[-1]] = provider