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

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )

Reply via email to