Attachment 'patch_htmldoc_escaping.patch'

Download

   1 --- /root/CreatePdfDocument2_4_2.py	2010-09-18 18:23:23.000000000 +0200
   2 +++ CreatePdfDocument.py	2014-08-18 03:50:11.370056029 +0200
   3 @@ -212,6 +212,7 @@
   4  import re
   5  import copy
   6  import shutil
   7 +import subprocess
   8  import StringIO
   9  import array
  10  
  11 @@ -496,30 +497,9 @@
  12      return editorname
  13  
  14  
  15 -def pipeCommand(cmdstr, input=None):
  16 -    child_stdin, child_stdout, child_stderr = os.popen3(cmdstr, u'b')
  17 -    try:
  18 -        if input:
  19 -            child_stdin.write(input)
  20 -        child_stdin.close()
  21 -    except:
  22 -        pass
  23 -
  24 -    child_output = child_stdout.read()
  25 -    child_stdout.close()
  26 -
  27 -    child_error = child_stderr.read()
  28 -    child_stderr.close()
  29 -
  30 -    if os.name in ['posix', 'mac']:
  31 -        try:
  32 -            # REMARK: Otherwise we get <defunct> processes.
  33 -            os.wait()
  34 -        except OSError, e:
  35 -            # 10: No child processes.
  36 -            if e.errno != 10:
  37 -                raise
  38 -    return (child_output, child_error)
  39 +def pipeCommand(tokens, input_data=None):
  40 +    proc = subprocess.Popen(tokens, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
  41 +    return proc.communicate(input_data)
  42  
  43  
  44  class CreatePdfDocument(ActionBase):
  45 @@ -1850,8 +1830,8 @@
  46          if self.debug:
  47              self.wrapper_emit_http_headers()
  48              errmsg = self._(u'HTMLDOC command:') + u'<pre>' + wikiutil.escape(cmdstr) + u'</pre>'
  49 -            cmdstr = self.default_values['htmldoc_cmd'] + u' --help'
  50 -            (htmldoc_help, htmldoc_err) = pipeCommand(cmdstr)
  51 +            htmldocopts = [self.default_values['htmldoc_cmd'], u'--help']
  52 +            (htmldoc_help, htmldoc_err) = pipeCommand(htmldocopts)
  53              errmsg += u'<p>Execute <tt>%s</tt><br /><pre>%s</pre></p>' % (wikiutil.escape(cmdstr), wikiutil.escape(htmldoc_help),)
  54              if 'env' in self.request.__dict__:
  55                  reqenv = u'%s' % wikiutil.escape(self.request.env)
  56 @@ -1859,7 +1839,7 @@
  57                  reqenv = u'None'
  58              errmsg += u'<p>Python release %s<br />MoinMoin release <tt>%s</tt><br />CreatePdfDocument release <tt>%s</tt><br />self.request = <tt>%s</tt><br />self.request.env = <tt>%s</tt><br />os.environ = <tt>%s</tt></p>' % (wikiutil.escape(sys.version), wikiutil.escape(moinmoin_release), wikiutil.escape(__version__), wikiutil.escape(type(self.request)), wikiutil.escape(reqenv), wikiutil.escape(u"%s" % os.environ),)
  59          else:
  60 -            (pdf, htmldoc_err) = pipeCommand(cmdstr, html)
  61 +            (pdf, htmldoc_err) = pipeCommand(htmldocopts, html)
  62  
  63              # Check for error message on STDOUT.
  64              if pdf[:8] == u'HTMLDOC ':

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] (2008-06-25 06:31:28, 12.9 KB) [[attachment:AttributeError_form.html]]
  • [get | view] (2007-09-23 21:24:21, 74.0 KB) [[attachment:CreatePdfDocument2_1_5+p1.py]]
  • [get | view] (2007-09-24 19:04:02, 73.9 KB) [[attachment:CreatePdfDocument2_1_5+p2.py]]
  • [get | view] (2008-06-25 01:39:15, 77.3 KB) [[attachment:CreatePdfDocument2_3_0+p1.py]]
  • [get | view] (2008-06-25 06:52:21, 77.5 KB) [[attachment:CreatePdfDocument2_3_0+p2.py]]
  • [get | view] (2008-06-26 16:18:43, 81.0 KB) [[attachment:CreatePdfDocument2_3_0+p3.py]]
  • [get | view] (2008-11-10 06:53:43, 84.3 KB) [[attachment:CreatePdfDocument2_3_4+p1.py]]
  • [get | view] (2008-11-10 20:22:57, 84.7 KB) [[attachment:CreatePdfDocument2_3_4+p2.py]]
  • [get | view] (2009-01-12 19:30:53, 84.3 KB) [[attachment:CreatePdfDocument2_3_5+p1.py]]
  • [get | view] (2010-09-17 13:22:57, 86.4 KB) [[attachment:CreatePdfDocument2_4_1+p1.py]]
  • [get | view] (2010-05-16 05:14:41, 8311.5 KB) [[attachment:HTMLDOC_1.8.27.msi]]
  • [get | view] (2006-05-25 08:59:55, 100.6 KB) [[attachment:PdfAction--book.pdf]]
  • [get | view] (2006-05-25 10:37:23, 13.2 KB) [[attachment:PdfAction--page.pdf]]
  • [get | view] (2006-09-12 09:11:10, 8.3 KB) [[attachment:RedirectOutputRequest.html]]
  • [get | view] (2007-09-20 15:15:05, 10.9 KB) [[attachment:WikiAdministration_DebugInfo.zip]]
  • [get | view] (2007-09-24 06:25:51, 3.6 KB) [[attachment:WikiAdministration_DebugInfo_20070924.zip]]
  • [get | view] (2008-06-24 09:56:40, 16.0 KB) [[attachment:_AttributeError20080624.html]]
  • [get | view] (2006-09-11 18:56:44, 6.0 KB) [[attachment:bool.html]]
  • [get | view] (2007-06-28 20:42:45, 13.8 KB) [[attachment:coded_w_wing_large.png]]
  • [get | view] (2007-06-28 20:48:21, 8.6 KB) [[attachment:coded_w_wing_medium.png]]
  • [get | view] (2007-06-28 20:44:02, 6.8 KB) [[attachment:coded_w_wing_small.png]]
  • [get | view] (2008-06-26 17:18:39, 16.2 KB) [[attachment:debug260208.html]]
  • [get | view] (2007-09-20 15:14:47, 211.6 KB) [[attachment:htmldoc_WikiAdministration_ClassicTheme.zip]]
  • [get | view] (2008-12-21 10:40:28, 31.5 KB) [[attachment:listings.png]]
  • [get | view] (2010-09-16 12:23:08, 5.4 KB) [[attachment:moin.log.failed.gz]]
  • [get | view] (2010-09-16 12:23:22, 9.6 KB) [[attachment:moin.log.ok.gz]]
  • [get | view] (2014-08-18 02:10:25, 2.6 KB) [[attachment:patch_htmldoc_escaping.patch]]
  • [get | view] (2010-04-07 17:29:57, 5.7 KB) [[attachment:pdfbug.txt]]
  • [get | view] (2006-10-09 21:59:00, 0.7 KB) [[attachment:skip-one-region.diff]]
  • [get | view] (2008-12-21 10:33:05, 11.6 KB) [[attachment:traceback.html]]
 All files | Selected Files: delete move to page copy to page

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