# HG changeset patch # User Ludovic Chabant # Date 1425274865 28800 # Node ID 0641fe5c3ef91785a6dce4abaf5cd80bbf17c33e # Parent 8c0c53a315ae6119d53cacb3b1f1950ec6f2a4bb serve: Don't crash when a post URL doesn't match our expectations. It can happen that a posts source's URL pattern matches that of something else, like a taxonomy page. In this case, don't crash when what we think will be integers turn out to be something else. Instead, just return that no page has been found. diff -r 8c0c53a315ae -r 0641fe5c3ef9 piecrust/sources/posts.py --- a/piecrust/sources/posts.py Sun Mar 01 21:39:26 2015 -0800 +++ b/piecrust/sources/posts.py Sun Mar 01 21:41:05 2015 -0800 @@ -38,12 +38,15 @@ day = metadata.get('day') slug = metadata.get('slug') - if year is not None: - year = int(year) - if month is not None: - month = int(month) - if day is not None: - day = int(day) + try: + if year is not None: + year = int(year) + if month is not None: + month = int(month) + if day is not None: + day = int(day) + except ValueError: + return None, None ext = metadata.get('ext') if ext is None: