[Zope-dev] z3c.contents failure (was Re: Zope Tests: 41 OK, 13 Failed)
Marius Gedminas
marius at gedmin.as
Sun Dec 19 14:26:09 EST 2010
On Sun, Dec 19, 2010 at 08:09:21PM +0200, Marius Gedminas wrote:
> I was curious what a TemplateFactory adapter was doing in the _local_
> site, and then discovered that it was being registered inside
> z3c.contents README.txt, via xmlconfig.string().
>
> Apparently this worked just fine when ZCML directives used
> getGlobalSiteManager() for their components, but now they use
> getSiteManager() and you end up with nonpersistable adapters like
> z3c.template's TemplateFactory in the local site.
>
> I can get rid of the TypeError with this patch,
(which does setSite(None) before xmlconfig.string(), and then restores
the real site)
> but then the tests fail
> because the search form is missing from the rendered HTML (why???):
they fail because ContentsPage.template looks up the wrong template --
z3c.formui's div-form.pt, instead of our contents.pt, registered
explicitly for IContentsPage.
How very curious.
Looking at
[a for a in getSiteManager().registeredAdapters()
if a.provided == IContentTemplate and a.name == '']
and
[a for a in getGlobalSiteManager().registeredAdapters()
if a.provided == IContentTemplate and a.name == '']
I see that formui's div-form.pt is provided in the local site, while
our contents.pt is provided in the global site (after my change).
Looking closer at README.txt I see that there's more than one invocation
of xmlconfig.
I've wrapped them all in setSite(None) and the tests pass.
(Nevertheless, the zope.copy bug should be fixed as well.)
Marius Gedminas
--
http://pov.lt/ -- Zope 3/BlueBream consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20101219/3c8ed998/attachment.bin
More information about the Zope-Dev
mailing list