Skip to content
Myr

Added comment to why __unicode__ goes after __str__.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent 790b8a8 · Browse files · 3 files+16 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+16 added−0 removed

  • other:+16 added−0 removed

3 files+16 added−0 removed

modified:jinja2/environment.py+4 added
812 unmodified lines
813814 def __str__(self):815 return unicode(self).encode('utf-8')816817 # unicode goes after __str__ because we configured 2to3 to rename818 # __unicode__ to __str__. because the 2to3 tree is not designed to819 # remove nodes from it, we leave the above __str__ around and let820 # it override at runtime.821 def __unicode__(self):822 return concat(self._body_stream)823824 def __repr__(self):
110 unmodified lines
modified:jinja2/exceptions.py+8 added
42 unmodified lines
4344 def __str__(self):45 return self.message.encode('utf-8')4647 # unicode goes after __str__ because we configured 2to3 to rename48 # __unicode__ to __str__. because the 2to3 tree is not designed to49 # remove nodes from it, we leave the above __str__ around and let50 # it override at runtime.51 def __unicode__(self):52 return self.message5354
29 unmodified lines
8485 def __str__(self):86 return unicode(self).encode('utf-8')8788 # unicode goes after __str__ because we configured 2to3 to rename89 # __unicode__ to __str__. because the 2to3 tree is not designed to90 # remove nodes from it, we leave the above __str__ around and let91 # it override at runtime.92 def __unicode__(self):93 # for translated errors we only return the message94 if self.translated:95 return self.message.encode('utf-8')
48 unmodified lines
modified:jinja2/runtime.py+4 added
452 unmodified lines
453454 def __str__(self):455 return unicode(self).encode('utf-8')456457 # unicode goes after __str__ because we configured 2to3 to rename458 # __unicode__ to __str__. because the 2to3 tree is not designed to459 # remove nodes from it, we leave the above __str__ around and let460 # it override at runtime.461 def __unicode__(self):462 return u''463464 def __len__(self):
66 unmodified lines