Permalink
Browse files

Be more Django-y about undefined values

Previously evaluating undefined variables threw an error. Django
doesn't do this, so we won't either. Instead evaluate to the empty
list, which conveniently enough works both as an emptry string
and as an empty array
  • Loading branch information...
1 parent 4ebc069 commit 3937d46bda4bad75b4ea9e8f92beff28d392ecf8 @evanmiller evanmiller committed Mar 27, 2013
Showing with 3 additions and 8 deletions.
  1. +3 −8 src/erlydtl_runtime.erl
@@ -59,15 +59,10 @@ find_deep_value([Key|Rest],Item) ->
end;
find_deep_value([],Item) -> Item.
-fetch_value(Key, Data, FileName, Pos) ->
+fetch_value(Key, Data, _FileName, _Pos) ->
case find_value(Key, Data) of
- undefined ->
- throw({undefined_variable,
- [{name, Key},
- {file, FileName},
- {line, Pos}]});
- Val ->
- Val
+ undefined -> [];
+ Val -> Val
end.
regroup(List, Attribute) ->

0 comments on commit 3937d46

Please sign in to comment.