[Zope-CMF] Creator info not properly cataloged

Ivo van der Wijk ivo@amaze.nl
Sat, 16 Nov 2002 18:56:05 +0100


On Sat, Nov 16, 2002 at 04:01:20PM +0100, Ivo van der Wijk wrote:
> Hi All
> 
> After putting my locally developed CMF site online, I noticed that
> references to here/Creator were replaced with 'Anonymous User', while
> the object definately had a proper owner (and still has).
> 
> Updating the catalog doesn't work - all Creator fields are "Anonymous User"
> 
> I previously already had problem with double entries in the catalog - this
> was fixed by updating the catalog without a working virtual root through
> VHM.
> 
> Does anyone know what causes this, and how it can be fixed?
> 

Okay, I figured it out. It seems the Owner info is partially incorrect
if the position of the object moves relative to the physicalRoot (i.e.
through export/import).

Running the following script fixed the problem for me (thanks to peterbe
for his Recursive folderish test recipe) -- let's hope it didn't break
anything else:

## Script (Python) "fixOwnerAfterAdd"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=obj=None
##title=
##
if obj is None:
    # start 'here' unless else is specified
    obj = context
# loop though everything!
for object in obj.objectValues():
    # is the object folderish
    print "Fixing %s<br>\n" % object.title_or_id()
    obj.manage_fixupOwnershipAfterAdd()
    if object.isPrincipiaFolderish:
        # go deeper
        print "Recursing: %s"%object.title_or_id()
        print context.fixOwnerAfterAdd(object)
return printed

Cheers

	Ivo

-- 
Drs. I.R. van der Wijk                                      -=-              
Brouwersgracht 132                             Amaze Internet Services V.O.F.
1013 HA Amsterdam, NL                                       -=-              
T +31-20-4688336         F +31-20-4688337        Linux/Web/Zope/SQL/MMBase   
W http://www.amaze.nl    E info@amaze.nl             Network Solutions        
W http://vanderwijk.info E ivo@amaze.nl                 Consultancy          
PGP http://vanderwijk.info/pgp                              -=-