Attachment 'dump_templatefile_broken.diff'

Download

   1 --- MoinMoin/script/export/old/dump.py.20080728_100648	2008-02-19 22:46:33.000000000 +0100
   2 +++ MoinMoin/script/export/dump.py	2008-07-28 11:47:07.171089000 +0200
   3 @@ -125,6 +125,10 @@
   4              "-u", "--username", dest = "dump_user",
   5              help = "User the dump will be performed as (for ACL checks, etc)"
   6          )
   7 +        self.parser.add_option(
   8 +            "", "--template", dest = "template_file",
   9 +            help = "Use a customised template instead of the built-in template"
  10 +        )
  11  
  12      def mainloop(self):
  13          """ moin-dump's main code. """
  14 @@ -206,9 +210,29 @@
  15                      traceback.print_exc(None, errlog)
  16              finally:
  17                  timestamp = time.strftime("%Y-%m-%d %H:%M")
  18 +
  19 +		if self.options.template_file:
  20 +                    output_template = ''
  21 +                    if os.path.exists(self.options.template_file):
  22 +                        f = None
  23 +                        try:
  24 +                            f = open(self.options.template_file, 'rt')
  25 +                            output_template = f.read()
  26 +			    f.close
  27 +                        except IOError:
  28 +                            pass
  29 +	            else:
  30 +                        script.fatal("Template file '%s' doesn't exists!" % self.options.template_file)
  31 +                    
  32 +                    if not output_template:
  33 +                        output_template = page_template
  34 +                    
  35 +		else:
  36 +		    output_template = page_template
  37 +
  38                  filepath = os.path.join(outputdir, file)
  39                  fileout = codecs.open(filepath, 'w', config.charset)
  40 -                fileout.write(page_template % {
  41 +                fileout.write(output_template % {
  42                      'charset': config.charset,
  43                      'pagename': pagename,
  44                      'pagehtml': pagehtml,

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-04-17 08:31:17, 1.9 KB) [[attachment:dump_templatefile.diff]]
  • [get | view] (2008-08-01 11:29:44, 1.8 KB) [[attachment:dump_templatefile_broken.diff]]
 All files | Selected Files: delete move to page copy to page

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