templater: Better exception for errors in foo%bar formatting.
authorThomas Arendsen Hein <thomas@intevation.de>
Wed, 11 Oct 2006 20:53:02 +0200
changeset 3361 bc5985d53386
parent 3360 ef8307585b41
child 3362 887da2247b57
templater: Better exception for errors in foo%bar formatting.
mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -135,7 +135,11 @@ class templater(object):
                 fl = m.group(4)
 
                 if format:
-                    q = v.__iter__
+                    try:
+                        q = v.__iter__
+                    except AttributeError:
+                        raise SyntaxError(_("Error expanding '%s%s'")
+                                          % (key, format))
                     for i in q():
                         lm.update(i)
                         yield self(format[1:], **lm)