Attachment 'text_xslt.py.txt'

Download

   1 # HG changeset patch
   2 # User Raphael Bossek <raphael.bossek@gmx.de>
   3 # Date 1186778449 -7200
   4 # Node ID 29682a94eef87170b1ad38d3afb8fe99a0fdd419
   5 # Parent  5c7abdf6554e2908f78c6853625c7ce65cca84b2
   6 Do not convert unicode string into utf-8 encoded byte string by default
   7 
   8 diff -r 5c7abdf6554e -r 29682a94eef8 MoinMoin/parser/text_xslt.py
   9 --- a/MoinMoin/parser/text_xslt.py	Tue Aug 07 14:12:39 2007 +0200
  10 +++ b/MoinMoin/parser/text_xslt.py	Fri Aug 10 22:40:49 2007 +0200
  11 @@ -28,7 +28,7 @@ class Parser:
  12      Dependencies = Dependencies
  13  
  14      def __init__(self, raw, request, **kw):
  15 -        self.raw = raw.encode(config.charset)
  16 +        self.raw = raw
  17          self.request = request
  18          self.form = request.form
  19          self._ = request.getText
  20 @@ -87,14 +87,16 @@ class Parser:
  21                  input_factory = InputSource.InputSourceFactory(resolver=wiki_resolver)
  22  
  23                  page_uri = self.base_uri + wikiutil.url_quote(formatter.page.page_name)
  24 -                raw = self.raw.strip()
  25 +                # 4Suite needs an utf-8 encoded byte string instead of an unicode object
  26 +                raw = self.raw.strip().encode(config.charset)
  27  
  28                  self.processor = Processor()
  29                  self.append_stylesheet() # hook, for extending this parser
  30                  self.processor.run(
  31                      input_factory.fromString(raw, uri=page_uri),
  32                      outputStream=out_file)
  33 -                result = out_file.getvalue()
  34 +                # Convert utf-8 encoded byte string into unicode
  35 +                result = out_file.getvalue().decode(config.charset)
  36                  result = self.parse_result(result) # hook, for extending this parser
  37  
  38              except FtException, msg:

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-03-01 11:39:57, 0.9 KB) [[attachment:1_9-devel_local_server_config.bundle]]
  • [get | view] (2007-07-27 20:50:57, 12.4 KB) [[attachment:IncludeWithAttachment20070727.py]]
  • [get | view] (2007-09-25 12:38:06, 18.2 KB) [[attachment:raphaelbossek.jpg]]
  • [get | view] (2007-08-15 20:55:02, 2.5 KB) [[attachment:test_parser_unicode.py]]
  • [get | view] (2007-07-27 20:49:55, 1.4 KB) [[attachment:text_xslt.patch]]
  • [get | view] (2007-08-10 20:44:42, 1.7 KB) [[attachment:text_xslt.py.txt]]
  • [get | view] (2007-08-09 20:16:03, 2.3 KB) [[attachment:utf8bug.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.