Re: patterns for using sphinx with the Zope Toolkit?

Chris McDonough <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Benji York wrote:
> On Sun, Jan 3, 2010 at 6:43 PM, Chris McDonough <[email protected]> wrote:
>> 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.
> 
> If you replace ".. code-block-setup::" and ".. code-block-teardown::"
> with ".. invisible-code-block:: python" you can do that with Manuel now
> (http://packages.python.org/manuel/#invisible-code-blocks).

Nice.  I'll give that a try.

- C

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.