|
From: Toshio K. <a.b...@gm...> - 2010-07-05 18:43:35
|
Hi, I've been working on getting python-webhelpers copy of markdown updated
to a more recent version and found that the cyclic imports in the code were
making it hard to do so. Would you take a patch to break the cyclic import?
The current cycles work like this:
import markdown => imports (blockparser, blockprocessors, inlinparser, etc)
=> import markdown
When markdown is a subpackage, this fails:
>>> from webhelpers import markdown
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "webhelpers/markdown/__init__.py", line 161, in <module>
import preprocessors
File "webhelpers/markdown/preprocessors.py", line 11, in <module>
import webhelpers.markdown as markdown
AttributeError: 'module' object has no attribute 'markdown'
Moving a portion of the code from markdown into some new files breaks the
cyclic import and allows this to work:
import markdown => imports blockparser => imports misc
I have a patch here that seems to work:
http://gitorious.org/python-markdown/toshios-mainline/commit/b50560edc707241b236f9d6c3f33edcf09d7cf33
If the idea behind this seems acceptable, I'll propose it for merging.
-Toshio
|