quick search:
 

Display All ZSQL Methods

Submitted by: pup
Last Edited: 2004-10-14

Category: ZSQL and SQL DA

Average rating is: 4.7 out of 5 (10 ratings)

Description:
If you work w/a SQL-database driven site, you probably, like me,
have lots of ZSQL methods around, and are always turning caching
on and off, updating methods, etc.

This recipe prints all of your ZSQL methods on one page, with
the SQL code, and the advanced properties.


Source (Text):
<dtml-in "ZopeFind(restrictedTraverse(['']), obj_metatypes=['Z SQL Method'], search_sub=1)">
  <h2>&dtml.-id; (&dtml.-title_or_id;)</h2>
  <p><i><dtml-var absolute_url></i></p>
  <blockquote><pre><dtml-var "template"></pre></blockquote>
  <b>Max Rows:</b> <dtml-var "max_rows_"> /
  <b>Max Cache:</b> <dtml-var "max_cache_"> /
  <b>Cache Time:</b> <dtml-var  "cache_time_"> /
  <b>Class:</b> <dtml-var "class_name_"> /
  <b>Class File:</b> <dtml-var "class_file_"> /
  <b>Direct:</b> <dtml-var "allow_simple_one_argument_traversal">
</dtml-in>

Explanation:
restrictedTraverse( ) gets us the root object.

The methods "max_rows_", "template", etc. are the properties
of a ZSQL method.


Comments:

List all ZSQL objects beneath a folder by wisser - 2004-10-14
Hi,
I use have several projects on one Zope instance running. I would like to list only the ZSQL methods for one project like this:

/listZSQL (<- the DTML method to list all ZSQL objects)
/projectONE
/projectTWO

If I view /projectONE/listZSQL I would like to see only the ZSQL objects beneatch the projectONE folder.

I played a bit arround but got it only "not working at all". 

Thanks

Ulli


allow_simple_one_argument_traversal ?? by peterbe - 2004-10-14
What does the allow_simple_one_argument_traversal do? Is it a Z SQL Method property?
 
Re: allow_simple_one_argument_traversal ?? by drees - 2004-10-14
It's the 'Allow "simple" direct traversal' property from the advanced tab 


using VirtualRootPhysicalPath by runyaga - 2004-10-14
this is a Script (Python) that returns objects that are under folders that have an attribute called published which is true.

pub = []
for folder in context.ZopeFind(context.restrictedTraverse(context.REQUEST.VirtualRootPhysicalPath), obj_metatypes=('Folder',), search_sub=1):
    if hasattr(folder, 'published') and folder.published: 
        pub.append(folder.absolute_url())
    pub.append(folder)
return pub