comparison piecrust/routing.py @ 482:cce911be024d

serve: Fix a crash when matching taxonomy URLs with incorrect URLs. This is still around code that should have been fixed a while ago but hey, consider this a growing TODO.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 21 Jul 2015 22:42:05 -0700
parents a17774094db8
children 64e1cd71b30b
comparison
equal deleted inserted replaced
481:aa686b8fbfd0 482:cce911be024d
133 route_metadata[k] = '' 133 route_metadata[k] = ''
134 134
135 # TODO: fix this hard-coded shit 135 # TODO: fix this hard-coded shit
136 for key in ['year', 'month', 'day']: 136 for key in ['year', 'month', 'day']:
137 if key in route_metadata and isinstance(route_metadata[key], str): 137 if key in route_metadata and isinstance(route_metadata[key], str):
138 route_metadata[key] = int(route_metadata[key]) 138 try:
139 route_metadata[key] = int(route_metadata[key])
140 except ValueError:
141 pass
139 142
140 return route_metadata 143 return route_metadata
141 144
142 def getUri(self, route_metadata, *, sub_num=1): 145 def getUri(self, route_metadata, *, sub_num=1):
143 uri = self.uri_format % route_metadata 146 uri = self.uri_format % route_metadata