For the past few days, I've been unsuccessfully trying to use a Zope
ODBC connection from within a Python class.

I have the following situation:

1. A Python class, Order, which has this method:

    def create (self, cust_id, connection_id = None, itemcode = None,
                quantity = 0):

        while self is not None:
            if hasattr(self, 'objectValues'):
                for o in self.objectValues():
                    if hasattr(o, 'id'):
                        if == connection_id:
                            self.connection = o
        self.cust_id = cust_id
        self.itemcode = itemcode
        self.quantity = quantity
        query = 'insert into orders (cust_id, itemcode, quantity) values (%s, \'%s\', 
%s)' % (self.cust_id, self.itemcode, self.quantity) 
        if self.connection != None:
            result = self.connection.query (query)
            print result

2. A Zope class, TestOrder, which subclasses Order. Its constructor
   tries to invokes 'create', however upon executing the SQL query,
   Zope  either dies and is restarted, or just sits there, doing
   nothing, until the HTTP connection times out. In either case, the
   new record is not written in the database. 

3.      Zope 2.1.7
        Z ODBC DA 3.0.3
        Solid dev kit 2.3
        RedHat Linux 6.1 on i386

Please help.

Ivan Raikov

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to