diff piecrust/routing.py @ 854:08e02c2a2a1a

core: Keep refactoring, this time to prepare for generator sources. - Make a few APIs simpler. - Content pipelines create their own jobs, so that generator sources can keep aborting in `getContents`, but rely on their pipeline to generate pages for baking.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 04 Jun 2017 23:34:28 -0700
parents 4850f8c21b6e
children 45ad976712ec
line wrap: on
line diff
--- a/piecrust/routing.py	Sun May 21 00:06:59 2017 -0700
+++ b/piecrust/routing.py	Sun Jun 04 23:34:28 2017 -0700
@@ -1,5 +1,6 @@
 import re
 import os.path
+import copy
 import logging
 import urllib.parse
 from werkzeug.utils import cached_property
@@ -41,9 +42,11 @@
     """
     def __init__(self, app, cfg):
         self.app = app
+        self.config = copy.deepcopy(cfg)
 
         self.source_name = cfg['source']
         self.uri_pattern = cfg['url'].lstrip('/')
+        self.pass_num = cfg['pass']
 
         self.supported_params = self.source.getSupportedRouteParameters()
 
@@ -230,7 +233,7 @@
             route_params[arg_name] = self._coerceRouteParameter(
                 arg_name, arg_val)
 
-        self.source.onRouteFunctionUsed(self, route_params)
+        self.source.onRouteFunctionUsed(route_params)
 
         return self.getUri(route_params)
 
@@ -310,3 +313,6 @@
 
     def __call__(self, *args, **kwargs):
         return self._route.execTemplateFunc(*args, **kwargs)
+
+    def _isCompatibleRoute(self, route):
+        return self._route.uri_pattern == route.uri_pattern