[Zope-dev] patterns for using sphinx with the Zope Toolkit?
Chris McDonough
chrism at plope.com
Sun Jan 3 18:43:51 EST 2010
Lennart Regebro wrote:
> On Sun, Jan 3, 2010 at 23:14, Benji York <benji at zope.com> wrote:
>> In both of those cases normal doctest blocks seem appropriate.
>
> Not if you don't want the output in the formatting, or if you don't
> want the >>> brackets.
>
Yeah. I haven't thought about this much, so it might be bollocks, but I think
something like this is what I'm after:
.. code-block-setup::
import sys
from somepackage.testing import DummyModule
sys.modules['models'] = DummyModule()
.. code-block:: python
:linenos:
from models import MyModel
from repoze.bfg.view import bfg_view
from repoze.bfg.chameleon_zpt import render_template_to_response
@bfg_view(name='my_view', request_method='POST', context=MyModel,
permission='read')
def my_view(request):
return {'a':1}
.. code-block-teardown::
del sys.modules['models']
Only the code-block would show up. Actually being a code-block would be
helpful, too, so we could use the other features of code-blocks, like line
numbers. Or something.
- C
More information about the Zope-Dev
mailing list