changeset 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 aa686b8fbfd0
children 64e1cd71b30b
files piecrust/routing.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/routing.py	Tue Jul 21 22:17:06 2015 -0700
+++ b/piecrust/routing.py	Tue Jul 21 22:42:05 2015 -0700
@@ -135,7 +135,10 @@
         # TODO: fix this hard-coded shit
         for key in ['year', 'month', 'day']:
             if key in route_metadata and isinstance(route_metadata[key], str):
-                route_metadata[key] = int(route_metadata[key])
+                try:
+                    route_metadata[key] = int(route_metadata[key])
+                except ValueError:
+                    pass
 
         return route_metadata