Changeset 6692
- Timestamp:
- 03/13/2008 08:48:47 PM (7 months ago)
- Files:
-
- 1 modified
-
trunk/trac/web/chrome.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trac/web/chrome.py
r6654 r6692 20 20 import pprint 21 21 import re 22 try: 23 from cStringIO import StringIO as cStringIO 24 except ImportError: 25 cStringIO = StringIO 22 26 23 27 from genshi import Markup … … 35 39 from trac.resource import * 36 40 from trac.util import compat, get_reporter_id, presentation, get_pkginfo, \ 37 get_module_path, translation 41 get_module_path, translation, arity 38 42 from trac.util.compat import partial, set 39 43 from trac.util.html import plaintext … … 683 687 684 688 if method == 'text': 685 return stream.render('text') 689 if arity(stream.render) == 3: 690 # TODO: remove this when we depend on Genshi >= 0.5 691 return stream.render('text') 692 else: 693 buffer = cStringIO() 694 stream.render('text', out=buffer) 695 return buffer.getvalue() 686 696 687 697 doctype = {'text/html': DocType.XHTML_STRICT}.get(content_type) … … 702 712 703 713 try: 704 return stream.render(method, doctype=doctype) 714 if arity(stream.render) == 3: 715 # TODO: remove this when we depend on Genshi >= 0.5 716 return stream.render(method, doctype=doctype) 717 else: 718 buffer = cStringIO() 719 stream.render('xhtml', doctype=doctype, out=buffer) 720 return buffer.getvalue() 705 721 except: 706 722 # restore what may be needed by the error template
