[Zope] Shared.DC.ZRDB.Results

Brenton Bills billsb@optushome.com.au
Wed, 29 Jan 2003 17:05:02 +1000


Greetings Folks,

I have a case were we have general index_html which is
aquired by various subfolders, the crux of this
index_html is a call to SQL, have a generic sql method
that is called in each folder. This is all well and
good until I need to specifically get some ordering
to the values returned in my sql, therefore I have
created an external method that changes the ordering
in which the results are returned, but sadly I can't
figure out how to return a Shared.DC.ZRDB.Results object
to my dtml-in, I need to return that rather than a mapping
keyword in dtml-in as existing sql returns that kind of
object (Shared...Results) and I dont want to override the 
index_html as I dont want to change two files if I make
a modification.

Currently my code looks something like this,

def receiving_sql_select(self):
    invalid= []
    valid = []

    result = self.sql_select_all()
    resultdicts = result.dictionaries()

    for item in resultdicts:
        if int(item['status'])==3:
              invalid.append(item)
        else:
              valid.append(item)
    return invalid + valid

I think I almost have it? Ideas/Suggestions appreciated

Regards,
Brenton Bills.