Issues

Issue #1509 resolved

TODO extension not compatible with websupport

Dmitry Shachnev
created an issue

Forwarding from https://bugs.debian.org/754408. This was already reported before as #840, but that bug got no attention and was closed.


Hi,

by playing with the sphinx's websupport I go to problems with this exception:

...
pickling environment... done
checking consistency... done
preparing documents... done
Traceback (most recent call last):                                                                                                             
  File "websupport.py", line 34, in <module>
    support.build()
  File "/usr/lib/python2.7/dist-packages/sphinx/websupport/__init__.py", line 127, in build
    app.build()
  File "/usr/lib/python2.7/dist-packages/sphinx/application.py", line 212, in build
    self.builder.build_update()
  File "/usr/lib/python2.7/dist-packages/sphinx/builders/__init__.py", line 214, in build_update
    'out of date' % len(to_build))
  File "/usr/lib/python2.7/dist-packages/sphinx/builders/__init__.py", line 276, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/lib/python2.7/dist-packages/sphinx/builders/__init__.py", line 320, in write
    self._write_serial(sorted(docnames), warnings)
  File "/usr/lib/python2.7/dist-packages/sphinx/builders/__init__.py", line 333, in _write_serial
    self.write_doc(docname, doctree)
  File "/usr/lib/python2.7/dist-packages/sphinx/builders/websupport.py", line 63, in write_doc
    self.docwriter.write(doctree, destination)
  File "/usr/lib/python2.7/dist-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/usr/lib/python2.7/dist-packages/sphinx/writers/html.py", line 51, in translate
    self.document.walkabout(visitor)
  File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 166, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/lib/python2.7/dist-packages/sphinx/writers/websupport.py", line 27, in dispatch_visit
    self.handle_visit_commentable(node)
  File "/usr/lib/python2.7/dist-packages/sphinx/writers/websupport.py", line 34, in handle_visit_commentable
    self.add_db_node(node)
  File "/usr/lib/python2.7/dist-packages/sphinx/writers/websupport.py", line 43, in add_db_node
    if not storage.has_node(node.uid):
AttributeError: 'paragraph' object has no attribute 'uid'

The websupport is implemented by very basic way:

from sphinx.websupport import WebSupport

support = WebSupport(srcdir="path to source dir",
                     builddir="path to build dir",
                     search="whoosh"
                    )
support.build()

After some investigation I find (and confirmed on new empty project), that this is caused by the TODO extension, more precisely by the "todolist" directive, but only if at least one "todo" directive exists. Without any "todo" directive or without "todolist" directive or with the todo_include_todos = False (the default one) all works as expected.

Comments (3)

  1. Takayuki Shimizukawa

    Fix #1509 TODO extension not compatible with websupport

    websupport assigns UID to every node on reading phase and reads it on writing phase. but todolist directive generates new paragraph node on resolving phase. This problem will occur any extensions that generate paragraph nodes on resolving phase.

    This fix changes websupport ignores paragraph node not having UIDs.

    → <<cset bb0211a65072>>

  2. Log in to comment