Unsaved TOC error with KeyError 'toc_depth' when XSLT rendering

Bug #101413 reported by Clemens Robbenhaar
6
Affects Status Importance Assigned to Milestone
Silva Document
Fix Released
Medium
Andy Altepeter

Bug Description

With the current CVS Head try the following steps:

 - create a new Document
 - edit it with the forms based editor
 - create a "table of contents"
 - do not choose "save" or "save and exit",
   switch directly to the preview tab

If I do that I get "KeyError" with the XSLT renderer,
no problem with the widget based one.

Not a very common scenario, I guess ;)

The workaround is to save the TOC first after creating it.

Tags: silva-future
Revision history for this message
Andy Altepeter (aaltepet) wrote :

Verify this in Silva trunk.

Changed in silva:
assignee: nobody → aaltepet
Revision history for this message
Andy Altepeter (aaltepet) wrote :

OK, changed the xmlexport of tocs to assume unlimited when there is no toc_depth attribute. Unlimited is the default in the widgets-based renderer, as well as AutoTOC content type.

However, if you do the steps to replicate, and instead switch back to kupu, you get an error:
  Module Products.SilvaDocument.transform.kupu.silva, line 459, in convert
ValueError: invalid literal for int(): None

Changed in silva:
status: New → Confirmed
Revision history for this message
Andy Altepeter (aaltepet) wrote :

Adjusted Module Products.SilvaDocument.transform.kupu.silva, line 463, in convert
So a None depth isn't converted to the string "None", which doesn't int().

Now going to check if the widgets editor can be changed to set a default depth on node creation.

Revision history for this message
Andy Altepeter (aaltepet) wrote :

Also added an insert_init.py to the toc widget, which adds the toc_depth attribute. This is the root of the bug, and should fix any other related issues.

Changed in silva:
status: Confirmed → Fix Committed
Changed in silvadocument:
status: Fix Committed → 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.