ZSQL methods return with a list of records where fields corresponds to the column names you have defined in the SELECT query. What you have tried to do is to acces the value of the user_id method, not to determine whether it has or has not such an attribute. To workaround the problem staying in the way you started to go on, the simplest is to embed the last, "filed-existence-investigator" piece of code in to a try block. If an AttributeError exception is thrown, you can be sure no user_id attribute exists. try: if result: for i in result: if i.user_id: print "This table have fieldname named user_id" except (AttributeError): print "there's no such a field" If it would not work, check out the Python/Zope docus to find out the exact name of the exception to be caught. By the way, in my opinion you should employ a Python database API to find out which tables have what fields or to have a ZSQL method submitting a query on some system tables holding info on another table. -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Terry Sent: 2002. január 29. 11:29 To: zope@zope.org Subject: [Zope] How to identy a fieldname exist or not? Hello friends, I have a table1 in database. Have fieldnames like "book_id","bookname",table2 has "user_id","username" I use a Python Script call a ZSQL Method and get result from that ZSQL Method. There is not any fieldname like "phone". Why I couldn't check this in Python Script? Zope said this on my browser """ Site Error An error was encountered while publishing this resource. *Error Type: AttributeError* *Error Value: user_id* """ ###My Python Script result1 =some_ZSQL_Method_table1 result2 =some_ZSQL_Method_table2 result =[] for i in range(len(result1)): result.append(result1[i]) if len(result2) >= i+1: result.append(result2[i]) if result: for i in result: if i.user_id: print "This table have fieldname named user_id" return printed ################# Any idea ? Terry _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )