Revision: 1624
http://epydoc.svn.sourceforge.net/epydoc/?rev=1624&view=rev
Author: edloper
Date: 2007-09-23 12:39:01 -0700 (Sun, 23 Sep 2007)
Log Message:
-----------
- fixed sf bug [ 1663578 ] Rendering of unicode default values --
unicode values are now displayed using unicode chars, not ascii.
If this turns out not to be popular, it can be changed back with a
single switch (PyvalColorize.ESCAPE_UNICODE)
Modified Paths:
--------------
trunk/epydoc/src/epydoc/markup/pyval_repr.py
Modified: trunk/epydoc/src/epydoc/markup/pyval_repr.py
===================================================================
--- trunk/epydoc/src/epydoc/markup/pyval_repr.py 2007-09-23 19:25:54 UTC (rev 1623)
+++ trunk/epydoc/src/epydoc/markup/pyval_repr.py 2007-09-23 19:39:01 UTC (rev 1624)
@@ -133,6 +133,8 @@
GENERIC_OBJECT_RE = re.compile(r'^<.* at 0x[0-9a-f]+>$', re.IGNORECASE)
+ ESCAPE_UNICODE = False # should we escape non-ascii unicode chars?
+
#////////////////////////////////////////////////////////////
# Entry Point
#////////////////////////////////////////////////////////////
@@ -184,7 +186,10 @@
elif pyval_type is str:
self._colorize_str(pyval, state, '', 'string-escape')
elif pyval_type is unicode:
- self._colorize_str(pyval, state, 'u', 'unicode-escape')
+ if self.ESCAPE_UNICODE:
+ self._colorize_str(pyval, state, 'u', 'unicode-escape')
+ else:
+ self._colorize_str(pyval, state, 'u', None)
elif pyval_type is list:
self._multiline(self._colorize_iter, pyval, state, '[', ']')
elif pyval_type is tuple:
@@ -306,7 +311,8 @@
# Body
for i, line in enumerate(lines):
if i>0: self._output('\n', None, state)
- self._output(line.encode(encoding), self.STRING_TAG, state)
+ if encoding: line = line.encode(encoding)
+ self._output(line, self.STRING_TAG, state)
# Close quote.
self._output(quote, self.QUOTE_TAG, state)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|