Skip to content

Commit

Permalink
more meaningfull exception
Browse files Browse the repository at this point in the history
While I tried this module I wrote 

        key:"value"

Which is a meaningfull yaml string while a meaningful dict is ecxpected in the form

    key: "value"

I propose to raise an exception instead of an assert
  • Loading branch information
jul committed Sep 19, 2012
1 parent 8f2b857 commit 146e0f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flask_flatpages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def meta(self):
# yaml.safe_load('- 1\n- a') -> [1, 'a']
if not meta:
return {}
assert isinstance(meta, dict)
if not isinstance(meta, dict):
raise Exception("Excpecting a valid dict in meta <%(_meta_yaml)s> for page at <%(path)s>" %
self.__dict__)
return meta

def __getitem__(self, name):
Expand Down

0 comments on commit 146e0f1

Please sign in to comment.