This also harms when working with gettext translations, to extract
translatable strings from template files (using babel), I have to
generate python code from it, and then use the default extractor for
python files.
at fist my extract_webpy function looked like this:
def extract_webpy(fileobj, keywords, comment_tags, options):
code = "# coding: utf-8\n\n" +
Template.generate_code(fileobj.read(),
fileobj.name)
return extract_python(StringIO.StringIO(code), keywords,
comment_tags, options)
But accidently it stopped to work, because of generate_code raising
UnicodeDecode error.
So now it should be:
def extract_webpy(fileobj, keywords, comment_tags, options):
code = "# coding: utf-8\n\n" +
Template.generate_code(fileobj.read().decode("utf-8"),
fileobj.name)
return extract_python(StringIO.StringIO(code), keywords,
comment_tags, options)