[Zope] "Zope DB instance has no attribute 'lock'"

Matthew T. Kromer matt@zope.com
Mon, 04 Mar 2002 17:11:04 -0500


Derek Simkowiak wrote:

>	I installed the Z MySQL Database Adaptor product and configured a
>connection with the simple 'database username password' connection string.
>	
>	Now I get the above when I try "select * from applicants" in the
>'test' view of my database adaptor.  I have no idea what it means, or how
>to troubleshoot it.  Is the problem in my database?  In Zope?  WTF?  The
>database connections shows itself as 'open', so I think it can talk to the
>database okay.
>

It sounds like a glitch in the DA.

>
>	What do I do next?  I'd post more information but I'm not sure
>what information is necessary... Here is the traceback from the error 
>message page's source HTML:
>
><!--
>Traceback (innermost last):
>  File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 223, in publish_module
>  File /usr/share/zope/lib/python/Products/Localizer/__init__.py, line 53, in new_publish
>  File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 187, in publish
>  File /usr/share/zope/lib/python/Zope/__init__.py, line 226, in zpublisher_exception_hook
>    (Object: MySQL_database_connection)
>  File /usr/lib/python2.1/site-packages/ZPublisher/Publish.py, line 175, in publish
>  File /usr/share/zope/lib/python/Zope/__init__.py, line 240, in commit
>  File /usr/share/zope/lib/python/ZODB/Transaction.py, line 325, in commit
>  File /usr/share/zope/lib/python/Shared/DC/ZRDB/TM.py, line 122, in tpc_finish
>  File /usr/share/zope/lib/python/Products/ZMySQLDA/db.py, line 351, in _finish
>AttributeError: (see above)
>
>-->
>
>	...and some other stuff:
>

I'd say, open up Products/ZMySQLDA/db.py, line 351, and it probably does 
something like

    something = somethingelse._lock

If you change that to something = getattr(somethingelse, "_lock", 0) it 
will probably work OK.

Alternatively, delete and recreate the DA object.

-- 
Matt Kromer
Zope Corporation  http://www.zope.com/