Move docutils imports at the toplevel, as it seems that imports in methods can be problematic in some cases (e.g. see #4280).
Move docutils imports at the toplevel, as it seems that imports in methods can be problematic in some cases (e.g. see #4280).

In this specific case, the error seen was:
{{{
2008-02-27 10:10:29,405 Trac[api] WARNING: HTML preview using <trac.mimeview.rst.ReStructuredTextRenderer object at 0xb9debdac> failed ('module' object has no attribute 'directives')
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Trac-0.11b1-py2.5.egg/trac/mimeview/api.py", line 630, in render
    rendered_content, filename, url)
  File "/usr/lib/python2.5/site-packages/Trac-0.11b1-py2.5.egg/trac/mimeview/rst.py", line 142, in render
    rst.directives.register_directive('trac', trac)
AttributeError: 'module' object has no attribute 'directives'
}}}

Thanks to H. Turgut Uyar for reporting the issue and testing the fix.


git-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@6617 af82e41b-90c4-0310-8c96-b1721e28e2e2

rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac