Mercurial > piecrust2
comparison piecrust/routing.py @ 448:a17774094db8
serve: Fix bug with creating routing metadata from the URL.
This is still using the hack for year/month/day values :(
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 06 Jul 2015 21:27:04 -0700 |
parents | cff70eeb1cc1 |
children | cce911be024d |
comparison
equal
deleted
inserted
replaced
447:aefe70229fdd | 448:a17774094db8 |
---|---|
129 # URL like `/foo`. | 129 # URL like `/foo`. |
130 matched_keys = set(route_metadata.keys()) | 130 matched_keys = set(route_metadata.keys()) |
131 missing_keys = self.required_route_metadata - matched_keys | 131 missing_keys = self.required_route_metadata - matched_keys |
132 for k in missing_keys: | 132 for k in missing_keys: |
133 route_metadata[k] = '' | 133 route_metadata[k] = '' |
134 | |
135 # TODO: fix this hard-coded shit | |
136 for key in ['year', 'month', 'day']: | |
137 if key in route_metadata and isinstance(route_metadata[key], str): | |
138 route_metadata[key] = int(route_metadata[key]) | |
134 | 139 |
135 return route_metadata | 140 return route_metadata |
136 | 141 |
137 def getUri(self, route_metadata, *, sub_num=1): | 142 def getUri(self, route_metadata, *, sub_num=1): |
138 uri = self.uri_format % route_metadata | 143 uri = self.uri_format % route_metadata |