[Zope-CMF] Re: [Zope] Preventing duplicates in ZCatalog
Romain Slootmaekers
romain@zzict.com
Wed, 23 Apr 2003 14:09:36 +0200
Oliver Bleutgen wrote:
> Wankyu Choi wrote:
>
>> I found that this problem only occurs with CMF instances + virtual host
>> monster.
>> Normal Zope folders cause no such problem. Only CMF and Plone instances
>> cause this problem when virtual host monster maps a domain to their
>> paths.
>>
>> It's not even a CatalogAwareness problem either since a simple call to an
>> object's getPhysicalPath() via urls can demonstrate what's happening
>> internally:
>>
>> - Add a CMF site named 'CMF'.
>>
>> - Add and set up a virtual host monster in such a way that a certain
>> domain,
>> www.example.com, for example, maps to the path of the CMF instance
>> created
>> above.
>> - create a DTML method called 'test'
>> A call to this DTML method's getPhysicalPath() with the URL
>> "http://www.example.com/test/getPhysicalPath" returns: ('', 'CMF',
>> 'test')
>>
>> The URL "http://www.example.com/CMF/test/getPhysicalPath" returns: ('',
>> 'CMF', 'CMF', 'test')
>>
>> The URL "http://www.example.com/CMF/CMF/CMF/CMF/test/getPhysicalPath"
>> returns: ('', 'CMF', 'CMF', 'CMF', 'CMF', 'CMF', 'test')
>>
>> You get the idea. Without VHM, the problem disappears.
>>
>> With VHM, one can create tons of duplicate entries in the
>> portal_catalog as
>> demonstrated above.
>>
>> I suspect the getPhysicalPath() method overriden in the CMF package
>> doesn't
>> behave well with VHM.
>> I'm cc'ing this to the CMF maillinglist since it's more of a CMF
>> problem :-)
>>
>> How can I fix it? (or is it fixed in the upcoming CMF 1.4 ?)
>
>
> Worse yet, I can reproduce this without a VHM, though, just to be sure,
> I had a VHM before on that server.
> I added a fresh CMF site, "CMF" and went directly (no apache in between)
> to http://myserver:8080/CMF/CMF/getPhysicalPath
> and got
> ('','CMF','CMF')
>
> Duh!
>
> But I can only reproduce this with the PortalSite object for now, I
> suspected SkinnableFolder would also exhibit this bug, but didn't.
> Further, I deleted any subobjects (all *_tool objects etc.) from the
> PortalSite object and the same happened.
>
> Ok, here's a workaround which should work:
> Add a normal folder (stock zope) named 'CMF' (or whatever your Portal
> Site object is called) as a subobject to the Portal Side object. This
> will prevent it from acquiring itself and causing this havoc.
>
> HTH,
> oliver
>
>
>
>
this seems to be the same problem I had with CMFTopic.
see my earlier posts (4/2/2003 5:12 PM) with the subject
[Zope-CMF] problem with CMFTopic.
I found a workaround by not using the catalog in the portal,but using
the ZODB findObject method directly which was enough for me.
Anyway, the cool thing is that someone found a simple example
illustrates the problem.
Romain.