diff piecrust/data/builder.py @ 83:f9f67086415c

Allow adding to the default content model instead of replacing it. Allow dot and slash notation for data endpoints.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 01 Sep 2014 22:49:56 -0700
parents cb1ed436642c
children a643b14a59a3
line wrap: on
line diff
--- a/piecrust/data/builder.py	Mon Sep 01 14:54:34 2014 -0700
+++ b/piecrust/data/builder.py	Mon Sep 01 22:49:56 2014 -0700
@@ -1,3 +1,4 @@
+import re
 import time
 import logging
 from piecrust import APP_VERSION
@@ -103,11 +104,14 @@
         return "The very thing you're looking at!"
 
 
+re_endpoint_sep = re.compile(r'[\/\.]')
+
+
 def build_site_data(page):
     app = page.app
     data = dict(app.config.get())
     for source in app.sources:
-        endpoint_bits = source.data_endpoint.split('/')
+        endpoint_bits = re_endpoint_sep.split(source.data_endpoint)
         endpoint = data
         for e in endpoint_bits[:-1]:
             if e not in endpoint: