I am new to OOP and Zope so please forgive me if I am being a chowderhead

I have a root report folder called "ReportParent". Within this folder, I
have 47 folders called, for simplicity, "report1, report2 ... reportN".
Within each of these folders I have a ZSQL query called "query" that is a
simple select statement.

In the ReportParent folder, I have an external method called columnNames:

def columnNames(self):
    """ docstring """
    fieldnames = []
    tempList = []
    columns = res._schema.items()
    for (name,value) in columns:
    for name, value in tempList:
    return fieldnames

This returns the column names of the batch returned by the "query" ZSQL
Method in each reports1..N folder. In each folder is also an "index_html"
DTML Doc that renders the batch returned from the ZSQL Method:

<dtml-var standard_html_header>
Created for <dtml-var "REQUEST.AUTHENTICATED_USER.getUserName()"> on
<dtml-var ZopeTime fmt="%d/%m/%Y"> at <dtml-var ZopeTime fmt="%H:%M"> <br>
<table border="2">
  <dtml-in columnNames>
   <dtml-comment> Click on column header to re-order by that
    <td><a href="<dtml-var URL1>?orderby=<dtml-var sequence-item>"><dtml-var
  <dtml-in query>
     <dtml-in sequence-item>
         <td align=right><dtml-var sequence-item></td>
<dtml-if "REQUEST.AUTHENTICATED_USER.getUserName() == 'root'">
SQL Source:<br><pre>
<dtml-var expr="_.string.replace(query(src__=1),_.chr(0) ,'<hr>')">
<dtml-var standard_html_footer>

I can call these queries with - www.mysite.net:8080/ReportParent/reportN and
get the desired results.

I have two questions on how I would like to change things:

1. The DTML Doc "index_html" is the same in the case of 45 of the 47 reports
folders. Seems to me I should be able to move the common index_html up to
the ReportParent folder, and just leave the two specialized ones where they
are, in their report? folders and continue to call the reports the same way.
Those that have a local index_html will use that, the others will look up
the hierarchy and find the common one in ReportParent. However, when I do
this and call the reports with the same URL I get:
    "Error Type: AttributeError - Error Value: query" ?
Seems the index_html DTML Doc (or columnNames extended Method) can't find
"query" below it. How do I address this properly?

2. How do I pass in the ZSQL Method object to the external method
I'd like to name the queries what I want and reuse this method anywhere,
without the query having to be named "query". Out of frustration, I named
all the queries with the same name and then addressed "query" explicitly in
the external method, because no matter what I tried, I couldn't get the
cloumnNames methos to accept the ZSQL Method name as a second parameter?!

Thanks for your input,

Erik Myllymaki

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to