Zim

Export to single html with template crashes on cmd line

Bug #1534450 reported by Seamus
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zim
Fix Released
Undecided
Unassigned

Bug Description

I am running Ubuntu and Zim 0.65. I can export to a single html page IF I don't use my template. I can use my template if I export to multiple pages. I can't use both options together. :(

Exporting to a single page requires [Page] to be passed on the commandline (which is not documented, but reading the code, seems that you can't get the "singlepage" option if page is null). This appears to be a problem for templates:

$ zim --export --template=Homepage_Ref.html --output=$HOME/test MyNotes Home
ERROR: Exception in main()
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/zim/main.py", line 446, in main
    obj.run()
  File "/usr/lib/pymodules/python2.7/zim/main.py", line 378, in run
    exporter.export(selection)
  File "/usr/lib/pymodules/python2.7/zim/export/exporters/__init__.py", line 24, in export
    for p in self.export_iter(pages):
  File "/usr/lib/pymodules/python2.7/zim/export/exporters/files.py", line 83, in export_iter
    self.export_page(pages.notebook, page, pages, prevpage=prev, nextpage=next)
  File "/usr/lib/pymodules/python2.7/zim/export/exporters/files.py", line 129, in export_page
    self.template.process(lines, context)
  File "/usr/lib/pymodules/python2.7/zim/templates/__init__.py", line 174, in process
    self.emit('process', output, context)
  File "/usr/lib/pymodules/python2.7/zim/signals.py", line 376, in emit
    return call_default(self, signal, args)
  File "/usr/lib/pymodules/python2.7/zim/signals.py", line 224, in call_default
    return method(*args)
  File "/usr/lib/pymodules/python2.7/zim/templates/__init__.py", line 178, in do_process
    processor.process(output, context)
  File "/usr/lib/pymodules/python2.7/zim/templates/processor.py", line 81, in process
    self.__call__(output, self.main, context)
  File "/usr/lib/pymodules/python2.7/zim/templates/processor.py", line 111, in __call__
    value = expr(context)
  File "/usr/lib/pymodules/python2.7/zim/templates/expression.py", line 288, in __call__
    return function(*args)
  File "/usr/lib/pymodules/python2.7/zim/templates/expression.py", line 349, in __call__
    return self._func(self._obj, *a)
  File "/usr/lib/pymodules/python2.7/zim/export/template.py", line 282, in index_function
    elif ignore_empty and not (path.hascontent or path.haschildren):
AttributeError: 'Path' object has no attribute 'hascontent'

$ zim -D
INFO: This is zim 0.65
DEBUG: Python version is sys.version_info(major=2, minor=7, micro=6, releaselevel='final', serial=0)
DEBUG: Platform is posix
DEBUG: No bzr version-info found
DEBUG: Not running from a source dir
....
DEBUG: Gtk version is (2, 24, 23)
DEBUG: Pygtk version is (2, 24, 0)
....
DEBUG: NOTE FOR BUG REPORTS:
 At this point zim has send the command to open a notebook to a
 background process and the current process will now quit.
 If this is the end of your debug output it is probably not useful
 for bug reports. Please close all zim windows, quit the
 zim trayicon (if any), and try again.

Revision history for this message
Seamus (lupusnnuri) wrote :

Also, the template exports perfectly as a single page using the GUI. This is just a commandline problem.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

The error trace should not occur with 0.66, offending code has been removed

Changed in zim:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.