Paul Winkler wrote:
On Wed, Feb 04, 2004 at 12:20:17PM +0000, Richard Jolly wrote:
Hi,
I'm new to Zope, and I've inherited a project with a bug that I've been unable to solve for a couple of days. Please excuse any wrong-terminology.
There is a zope installation, with two containers under the root folder. In each of these there is an external method having the same name, 'search'. On the public side of the site its clear that, on occaision, the wrong one of these external methods is called.
Root A methx_search B methx_search
The methx's contain sql statements pointing to different databases, and the error messages I get are sql errors ( 'no column ...' ), which is why its pretty clear which one is being called.
I couldn't find any obvious reason why the wrong one was being called, but I found I could disambiguate the external methods by renaming them A_methx_search and B_methx_search in the ZMI, and saving the methods to reload them. This worked, albeit proving I don't understand the root of the problem, however...
It's almost certainly incorrect use of acquisition. Can't say for sure without seeing how exactly you call these methods. That's the problem with acquisition - it's easy to set up something that *usually* works... I would stick with your solution of using distinct names.
It turns out that renaming, via the ZMI, the external methods is not sufficient. They still get confused. Presumably if I rename the methods is the py files this would finally eliminate the problem.
The customer installation of this only includes the .pyc files that contain the external methods. When I try to rename and reload with the .pyc files only in the Extensions folder the problem does not get solved. When I remove the .pyc files and put the original .py files in place, everything works fine. What is going on?
ermm... no idea.
I've found a reference to an old zope bug that sounds similar to my problem that was rejected: http://zope.org/Collectors/Zope/29 however the rejection doesn't throw any light on the py/pyc issue.
by the way, .pyc files don't protect your code very well, if that's why you're shipping only them.
I know - again, I plead "inherited project, not my fault". What I'd really like is to find a fix through the ZMI, because then I don't have to redistribute anything to the customer, and they don't have to reinstall, etc. Thanks for you help, I'll go back to reading about aquisition. Richard