Skip to content
Permalink
Browse files

Use ValueError for missing post data

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Sep 25, 2016
1 parent de83db3 commit a02171777e8cb13060e8d8a4dc2691533ef3abf0
Showing with 6 additions and 7 deletions.
  1. +6 −7 nikola/post.py
@@ -179,7 +179,7 @@ def __init__(
try:
self.date = to_datetime(self.meta[self.default_lang]['date'], tzinfo)
except ValueError:
raise OSError("Invalid date '{0}' in file {1}".format(self.meta[self.default_lang]['date'], source_path))
raise ValueError("Invalid date '{0}' in file {1}".format(self.meta[self.default_lang]['date'], source_path))

if 'updated' not in default_metadata:
default_metadata['updated'] = default_metadata.get('date', None)
@@ -188,12 +188,11 @@ def __init__(

if 'title' not in default_metadata or 'slug' not in default_metadata \
or 'date' not in default_metadata:
raise OSError("You must set a title (found '{0}'), a slug (found "
"'{1}') and a date (found '{2}')! [in file "
"{3}]".format(default_metadata.get('title', None),
default_metadata.get('slug', None),
default_metadata.get('date', None),
source_path))
raise Value("You must set a title (found '{0}'), a slug (found '{1}') and a date (found '{2}')! "
"[in file {3}]".format(default_metadata.get('title', None),
default_metadata.get('slug', None),
default_metadata.get('date', None),
source_path))

if 'type' not in default_metadata:
# default value is 'text'

0 comments on commit a021717

Please sign in to comment.
You can’t perform that action at this time.