Re: [Zope3-Users] doctest w/ formlib and ViewPageTemplateFile

2006-03-20 Thread Stephan Richter
On Saturday 04 March 2006 11:37, Shaun Cutts wrote:
> I notice that (.).namespace/view is somewhere registered as an adapter for
> ITraversable. Is this what I need? Is there a convenience function
> somewhere to setup this and/or any other adapters I need to get ZPT running
> for doctests? Or how should I be doing my setup?

PlacefulSetup does a lot for you but not everything. You have to investigate 
which particular traversal adapter is missing and register it in your setup 
by hand. In your case this seems to be the namespace traversal adapters. 
Setting up doctests to render HTML is certainly not trivial, see for example 
SchoolTool's setup code:

http://source.schooltool.org/viewcvs/trunk/schooltool/src/schooltool/app/browser/testing.py?rev=5827&view=auto

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] doctest w/ formlib and ViewPageTemplateFile

2006-03-04 Thread Shaun Cutts








Hello list,

 

I was trying to run doctests on a formlib.EditForm-derived object, which uses ViewPageTemplateFile. The template then tries to access the
object; and for testing I have override with a test template to exercise the
object w/out too much html.

 

To set up the doctest, I use zope.formlib.tests.formSetUp (which calls placelesssetup.setUp). However, I have problems in the zpt traversing from “view” to anything else. (I
get a TraversalError because cannot adapt my object
to ITraversable).

 

(However, it works from a browser fine.)

 

I notice that (…).namespace/view is somewhere
registered as an adapter for ITraversable. Is this
what I need? Is there a convenience function somewhere to setup this and/or any
other adapters I need to get ZPT running for doctests?
Or how should I be doing my setup?

 

Thanks,

- Shaun






___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users