[Zope] There is no methods or functions to check the attribute of result from ZSQL ?_? Right?

Terry terry@taipeitimes.com
Wed, 30 Jan 2002 16:42:25 +0800


Hello friends,

It had spend days on Google, Zope Site, and ask question on the list 
(Many thanks to people on the list) ?
But It's infructuous.(I came from Perl,PHP , the origin web script 
langage background, I try to enjoy the fun you guys already had.)

I just hope to solve a easy question. I really couldn't find any method 
or function in Python Script to check a attribute exist or not.
I couldn't just simply to ckeck the attribute in Python Script.

if test(result_object_from_ZSQL[0].ph_id):    
if  result_object_from_ZSQL[0].ph_id:

#My Python Script###########
  results=script.sql_Get_News(ar_id=ar_id,ar_publish='Y') # get article 
from MySQL
  photo=script.sql_Photo(ar_id=ar_id)  # get photo's datd from MySQL
  pull=script.sql_Pull(ar_id=ar_id)  # get pull
  box=script.sql_Box(ar_id=ar_id)  # get box
  print results.names(),'<p>'
  print photo.names(),'<p>'
  print pull.names(),'<p>'
  print box.names(),'<p>'

##############################

I mix photo , pull , and box to one list, temp_glue[].

then I would process the temp_glue[] , so I have to knew each item 
originally came from which table.
So I use the following lins to check.
####### Check each item
for i in range(len(temp_glue)):

     if temp_glue[i].ph_id:
            print "This item came from Photo Table"
     if temp_glue[i].pl_id:
            print "This item came from Pull Table"
     if temp_glue[i].bx_id:
            print "This item came from Box Table"
###################### 


Terry