[PATCH stable] templater: handle a missing value correctly

Christian Ebert blacktrash at gmx.net
Tue Aug 7 06:00:07 CDT 2012


* Matt Mackall on Monday, August 06, 2012 at 12:01:08 -0500
> On Sat, 2012-08-04 at 15:08 +0200, Ross Lagerwall wrote:
>> # HG changeset patch
>> # User Ross Lagerwall <rosslagerwall at gmail.com>
>> # Date 1344083837 -7200
>> # Branch stable
>> # Node ID ed99b19d78bd5ba28f072e5f217b4da7be209798
>> # Parent  e15765c18ebc18448addb955d2b698c75fc8b380
>> templater: handle a missing value correctly
>> 
>> Before, using a broken style such as:
>> changeset =
>> would result in a traceback.
> 
>> +            if not val:
>> +                raise SyntaxError(_('%s: missing value') % conf.source('', key))
> 
> I don't think this is the right fix. I think we should instead just
> quietly accept empty templates.

Would this also be the policy for e.g. {foo|localdate}, see:
http://bz.selenic.com/show_bug.cgi?id=3344
?

i.e. instead of a traceback give the equivalent output to
{foo|shortdate} - fail over to current date, instead of trying to
detect whether foo is a meaningful value?

c

-- 
\black\trash movie         _SAME  TIME  SAME  PLACE_
 --->> http://www.blacktrash.org/underdogma/stsp.php
\black\trash audio   _ANOTHER  TIME  ANOTHER  PLACE_
--->> http://www.blacktrash.org/underdogma/atap.html


More information about the Mercurial-devel mailing list