[Zope-CMF] Re: [Zope] Preventing duplicates in ZCatalog
Wankyu Choi
wankyu@neoqst.com
Thu, 24 Apr 2003 02:25:17 +0900
>> Plus, VHM sometimes redirects visitors to a mapped folder prepending
>> the folder's id ( I don't know why, but it does happen from time to
>> time ): www.example.com/CMF, for example, where the url should have
>> been just "www.example.com". And that's where this madness starts.
>I have never seen that. Are you sure your rewrite rules are right? Maybe
>a trailing slash too much or missing?
I didn't even run Apache. I used VHM mappings directly:
*.example.com/Example, for example.
And it **DOES** happen with this simple setting. I don't know exactly when.
>> Another situation with VHM: you log in as manager; manage your CMF
>> sites; while you're at it, try to add/edit some content; you put
>> yourself into this acquisition blackhole again.
>But this does only happen due to the bug you found, doesn't it? How else
>could this give a problem?
Yes, I meant exactly that ;-)
>> Without this redirect_program script, I can't prevent users from
>> having fun with this acquisition thing... or can I?
>Well, I got this idea in another thread, somewhere in your product you
>could compare URL0 (or URL1, or whatever, don't remember ATM) with
>self.absolute_url() and just return an redirect to self.absolute_url()
>if they don't match.
I did:
security.declarePrivate( '_getObjectURL' )
def _getObjectURL( self, ob ):
"""
Return Object URL
"""
path = list( ob.getPhysicalPath() )
path = path[ path.index(
self.getNeoPortalElementContainerCatalog().getId() )+1: ]
# make paths acquisition-safe
while ( self.getNeoPortalElementContainerCatalog().getId() in path
):
path.remove( self.getNeoPortalElementContainerCatalog().getId()
)
return '/'+ '/'.join( path )
Just removing every instance of the container's id in the path looked
simpler :-)
I'll try your idea.
Thanks.
All the best,
Wankyu Choi
---------------------------------------------------------------
Wankyu Choi
CEO/President
NeoQuest Communications, Inc.
http://www.zoper.net
http://www.neoboard.net
---------------------------------------------------------------