[Zope-dev] Bug with External Methods/Pluggable Brains and Products
David White
davew@ed.ray.com
Fri, 10 Sep 1999 13:11:47 -0400
Hi,
I've been playing around a bit lately with using pluggable brains for
SQL methods
from within a Python Product I'm working on. In the Content Managers
Guide
there's a section which discusses the use of External Methods and
Pluggable
Brains with Products and gives the following (shortened) descriptions:
>For example, suppose an external method or brain is defined using the
file name
>foobar.util, then Zope will attempt to load the method or class files
from the following
>files, in this order:
> 1.lib/python/Products/foobar/Extensions/util.py
> 2.Extensions/foobar.util.py
> 3.Extensions/util.py
I tried this out within a SQL method that I created by enteing in a
module name like
this: 'myProduct.myModule'. I also entered the right mix-in class name
which was
in the module 'myModule. I already had created a Python Zope Product
which resided
in INSTANCE_HOME/lib/python/Products/myProduct and I also created an
'Extensions'
sub-directory in this Product directory. So based on what the
documentation said I
thought I had set this up properly, but when I tried to edit the
'Advanced' tab of the
SQL method it kept telling me that it couldn't find the module
'myProduct.myModule'.
I looked in the App.Extensions.py source and (I think) tracked it down
to the following
bit of code (line 152):
sw=path_split(path_split(SOFTWARE_HOME)[0])[0]
for home in (INSTANCE_HOME, sw):
#rest of loop...
On my machine INSTANCE_HOME=/local/app/Zope and
SOFTWARE_HOME=/local/app/Zope/lib/python
So why does that first line effectively truncate the last two
directories off of SOFTWARE_HOME, effectively
making it equivalent to INSTANCE_HOME???
When I comment out that first line and change the second to:
for home in (SOFTWARE_HOME, INSTANCE_HOME):
#rest of loop
things work as stated in the documentation.
In any event I think I've found a bug here, either in the code above or
in the documentation in
the Content Managers Guide. Also I did try to see if this was in the
Collector, and I did
see an entry which may have been related to this, but it was still
'under review' so I could
not view it to make sure. So if someone could shed some light on this
bug(?) that would
be great.
Dave
--
----------------------------------------------------
David R. White Raytheon Electronic Systems
Process Support (508) 440-2087
528 Boston Post Rd.
Sudbury, MA 01776
davew@ed.ray.com
----------------------------------------------------