Mercurial > public > mercurial-scm > hg
comparison mercurial/templater.py @ 20857:6eb55310fcbc stable
templater: raise error for unknown func
Previously, if a template '{foo()}' was given, the buildfunc would not be able
to match it and hit a code path that would not return so it would error out
later in the templater stating that NoneType was not iterable. This patch makes
sure that a proper error is raised so that the user can be informed.
Tests have been updated.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Thu, 27 Mar 2014 17:21:27 -0500 |
parents | 5ab28a2e9962 |
children | 81d6dc8c3c63 |
comparison
equal
deleted
inserted
replaced
20826:dd2e25e49862 | 20857:6eb55310fcbc |
---|---|
210 if n in context._filters: | 210 if n in context._filters: |
211 if len(args) != 1: | 211 if len(args) != 1: |
212 raise error.ParseError(_("filter %s expects one argument") % n) | 212 raise error.ParseError(_("filter %s expects one argument") % n) |
213 f = context._filters[n] | 213 f = context._filters[n] |
214 return (runfilter, (args[0][0], args[0][1], f)) | 214 return (runfilter, (args[0][0], args[0][1], f)) |
215 raise error.ParseError(_("unknown function '%s'") % n) | |
215 | 216 |
216 def date(context, mapping, args): | 217 def date(context, mapping, args): |
217 if not (1 <= len(args) <= 2): | 218 if not (1 <= len(args) <= 2): |
218 raise error.ParseError(_("date expects one or two arguments")) | 219 raise error.ParseError(_("date expects one or two arguments")) |
219 | 220 |