[Zope-CMF] Handy script: find object used by a skin

Paul Winkler pw_lists@slinkp.com
Tue, 27 Aug 2002 13:26:30 -0700


After wasting much time manually tracing through skin paths
to find out where an object was actually being found,
I wrote the following script.

Drop it in your portal_skins directory, and
give it two arguments, skin_name and element_id.
Run it from the Test view and have fun.

skinbase = container
skinpath = skinbase.getSkinPath(skin_name).split(', ')

print "<html>"
found = 0
for path in skinpath:
    skinfolder = skinbase.restrictedTraverse(path, None)
    if skinfolder is None: continue
    if element_id in [foo.id for foo in skinfolder.objectValues()]:
        path = "%s/%s" % (path, element_id)
        found = 1
        print "%s found in skin %s: <a href='%s'>%s</a>" % (element_id, 
                                                            skin_name, 
                                                            path + "/manage_workspace", 
                                                            path)

        break

if not found:
   print "%s not found in %s (path: %s)" % (element_id, skin_name, skinpath)

print "</html>"
return printed
 
 


--

Paul Winkler
"Welcome to Muppet Labs, where the future is made - today!"