Opened 18 years ago
Closed 18 years ago
#93 closed defect (fixed)
Unwanted conversion of strings to Unicode
Reported by: | adamw@… | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.4 |
Component: | Expression evaluation | Version: | 0.3.5 |
Keywords: | Cc: |
Description
Genshi transforms str strings inside templates into unicode. See the following example:
import genshi, datetime s = '''<p xmlns:py="http://genshi.edgewall.org/" py:content="d.strftime('%d-%m-%Y')"></p>''' print genshi.template.MarkupTemplate(s).generate(d=datetime.datetime.now())
yields
TypeError: strftime() argument 1 must be str, not unicode
This appears to be a limitation of strftime, not taking a basestring, however genshi has silently convereted a standard string passed in ('%d-%m-Y') into unicode (u'%d-%m-%Y').
The following however works, but is undesirable
import genshi, datetime s = '''<p xmlns:py="http://genshi.edgewall.org/" py:content="d.strftime(str('%d-%m-%Y'))"></p>''' print genshi.template.MarkupTemplate(s).generate(d=datetime.datetime.now())
Change History (1)
comment:1 Changed 18 years ago by cmlenz
- Component changed from General to Expression evaluation
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.
This is actually already fixed in trunk, by [437]. Only strings that aren't ASCII are changed to unicode objects.