Mercurial > piecrust2
comparison piecrust/app.py @ 173:0a86a7a6b284
routes: Actually match metadata when finding routes, fix problems with paths.
When we look for a route that matches a given page, we now look at the
source metadata that comes with that page, and compare it to the metadata
we need to build URIs.
Also, when matching URIs, we handle the case where a 'path'-component in
our pattern may be completely empty, and thus we may be missing some trailing
slashes in the URI.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 03 Jan 2015 21:10:44 -0800 |
parents | 8d956bd94ad2 |
children | 7decf00eee47 |
comparison
equal
deleted
inserted
replaced
172:4fc1d306046b | 173:0a86a7a6b284 |
---|---|
510 if not skip_taxonomies or route.taxonomy is None: | 510 if not skip_taxonomies or route.taxonomy is None: |
511 yield route | 511 yield route |
512 | 512 |
513 def getRoute(self, source_name, source_metadata): | 513 def getRoute(self, source_name, source_metadata): |
514 for route in self.getRoutes(source_name, True): | 514 for route in self.getRoutes(source_name, True): |
515 if route.isMatch(source_metadata): | 515 if route.matchesMetadata(source_metadata): |
516 return route | 516 return route |
517 return None | 517 return None |
518 | 518 |
519 def getTaxonomyRoute(self, tax_name, source_name): | 519 def getTaxonomyRoute(self, tax_name, source_name): |
520 for route in self.routes: | 520 for route in self.routes: |