Related Entries

Interview with Ploners
Formulator makes life easy
Server side python
Resetting Zope's session timeout
Getting undo history

« Lust-see TV
» Stand-alone use of SWT

zxref

A simple cross-referencer for Zope

I’m working on a Zope project that has quite a few code and HTML objects, in one folder. For programming documentation, and for quick reference, I wanted to print out a report that shows a list of all the objects in the folder and other objects in the same folder that calls this.

Here is a simple Python Script to do that.

## Script (Python) "cxref"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Cross referencer; does not recurse
##
"""
In the current object folder, find all the objects and
then find a list of objects that call this object.

No acquisition, no recursion. Just plain text search.
"""
objects = context.objectItems()
objects.sort(lambda x,y: cmp(x[0], y[0]))

print 40 * "="
print "Object: Callers Map"
print 40 * "="
for (id,o) in objects:
    print id + '[' +  o.title + ']'
    results = context.ZopeFind(context, obj_searchterm=id)
    if results != []:
        for r in results:
            print "  -", r[0] + '[' +  r[1].title + ']'
    print

return printed

Output is like:


coverage_types[Get Coverage Types]
  - index_html[Welcome Screen]
  - coverage_types[Get Coverage Types]
  - update_ee_data[Validates and Updates record]

create_user_accounts[Create individual user accounts]
  - INSTALL[Installation Instructions]

  1. Very useful! Thank you.

    Posted by: nolo on February 10, 2003 08:42 AM
//-->