Hi Yuppie,

thanks as ever for the helpful explanation.

Am 29.09.2011, 10:39 Uhr, schrieb yuppie <y.2...@wcm-solutions.de>:

> SettingsEditFormBase has a getContent() method similar to that in
> z3c.form. This allows a clean distinction between 'content' and
> 'context'. For content objects they are usually the same, but in your
> case the site root is the context and the (adapted) SyndicationTool is
> the edited "content".

SettingsEditFormBase landed after my sturm and drang work last year. So  
you generally replace my explicit calls to tools with getContent? I guess  
I just need some proxyFields for enabling and disabling. Had to throw in  
some additional adapters to make the tests happy but test_handle_change  
now works as it should. I guess unittesting views is pushing things a bit  
but I like it if I can get it to work.

> Please have a look at the membership views. They show how to use
> getContent(). In your case the method would look like this:
>     @memoize
>      def getContent(self):
>          syndtool = getUtility(ISyndicationTool)
>          return SyndicationToolSchemaAdapter(syndtool)

> This example uses a hardcoded adapter. You can still register it and
> look it up, but I guess that's overkill.


> I doubt anybody wants to use a customized adapter. And if it is  
> hardcoded, you don't need to register
> it for testing.

I still need to set view.adapters = {} for some reason but that's okay.

Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
Zope-CMF maillist  -  Zope-CMF@zope.org

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Reply via email to