[Zope-CMF] Handy script: find object used by a skin
Tres Seaver
tseaver@zope.com
28 Aug 2002 09:40:29 -0400
On Tue, 2002-08-27 at 16:26, Paul Winkler wrote:
> 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.
Hmm, this would be a good feature to add to the skins tool itself, I
think.
> 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
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com