[Epydoc-commits] SF.net SVN: epydoc: [1248] trunk/epydoc/src/epydoc/docwriter/html_colorize.py
Brought to you by:
edloper
From: <ed...@us...> - 2006-08-21 05:37:45
|
Revision: 1248 Author: edloper Date: 2006-08-20 22:37:41 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1248&view=rev Log Message: ----------- - Fixed sf bug #1543572, where source code colorization would fail because names & tooltips were added as unicode. Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/html_colorize.py Modified: trunk/epydoc/src/epydoc/docwriter/html_colorize.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/html_colorize.py 2006-08-21 05:34:35 UTC (rev 1247) +++ trunk/epydoc/src/epydoc/docwriter/html_colorize.py 2006-08-21 05:37:41 UTC (rev 1248) @@ -812,7 +812,14 @@ # Loop through each token, and colorize it appropriately. for i, (toktype, toktext) in enumerate(line): - assert type(s) is str # *not* unicode! + if type(s) is not str: + if type(s) is unicode: + log.error('While colorizing %s -- got unexpected ' + 'unicode string' % self.module_name) + s = s.encode('ascii', 'xmlcharrefreplace') + else: + raise ValueError('Unexpected value for s -- %s' % + type(s).__name__) # For each token, determine its css class and whether it # should link to a url. @@ -912,7 +919,7 @@ if url is None: docs = sorted(self.name_to_docs.get(toktext, [])) if docs: - tooltip='\n'.join(['%s'%d.canonical_name + tooltip='\n'.join([str(d.canonical_name) for d in docs]) if len(docs) == 1 and self.GUESS_LINK_TARGETS: url = self.url_func(docs[0]) @@ -1011,7 +1018,7 @@ return uid, onclick def doc_descr(self, doc, context): - name = doc.canonical_name.contextualize(context) + name = str(doc.canonical_name.contextualize(context)) descr = '%s %s' % (self.doc_kind(doc), name) if isinstance(doc, RoutineDoc): descr += '()' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |