This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients
Date 2004-10-29.18:47:30
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I think it's a mistake for Template.safe_substitute()
to raise a ValueError when the invalid group is
matched.  I just ran across such a situation in Real
Code that is using Template.  In my code, I'm using a
subclass to override idpattern and then calling
safe_substitute().  The source of the template is a
flattened mail message where what I'm substituting is
going into some of the header fields.

The body of the message contains a big blurb of XML,
including the string "...$1...".  Well, that $1
triggers the ValueError.

This patch changes the semantics of safe_substitute()
so that when the 'invalid' group matches, the original
delimiter is returned, which I think is the right thing
to do.  Included is an updated test (I will update the
docs too if you agree that this patch should be applied).
History
Date User Action Args
2007-08-23 15:40:27adminlinkissue1056967 messages
2007-08-23 15:40:27admincreate