I am developing a project which I have split into two products to avoid having too many files in one place. I want to use a common base class in each but I can't find out to do this while keeping all three product directories together. There is something about multiple product directories the archives: " If you are prepared to edit Products/__init__.py add a line: __path__.append('yourpathhere') " Is there a simpler way to do this? david
On Monday 24 November 2003 16:21, David Little wrote:
I am developing a project which I have split into two products to avoid having too many files in one place. I want to use a common base class in each but I can't find out to do this while keeping all three product directories together.
There is something about multiple product directories the archives: " If you are prepared to edit Products/__init__.py add a line: __path__.append('yourpathhere') "
Is there a simpler way to do this?
Its as easy as - inside Products/Product1/FileX.py: from Product.Product2.FileY import CommonBaseClass -- Toby Dickenson
On Mon, 2003-11-24 at 16:53, Toby Dickenson wrote:
On Monday 24 November 2003 16:21, David Little wrote:
I am developing a project which I have split into two products to avoid having too many files in one place. I want to use a common base class in each but I can't find out to do this while keeping all three product directories together.
There is something about multiple product directories the archives: " If you are prepared to edit Products/__init__.py add a line: __path__.append('yourpathhere') "
Is there a simpler way to do this?
Its as easy as - inside Products/Product1/FileX.py:
from Product.Product2.FileY import CommonBaseClass
Thanks, Products.Product2.FileY import CommonBaseClass does the job. I had tried something similar but hadn't realised Product2 had to register a product rather than act as an include directory. david
David Little wrote at 2003-11-24 16:21 +0000:
I am developing a project which I have split into two products to avoid having too many files in one place. I want to use a common base class in each but I can't find out to do this while keeping all three product directories together.
There is something about multiple product directories the archives: " If you are prepared to edit Products/__init__.py add a line: __path__.append('yourpathhere') "
This is to provide additional "Products" folders. There is also an environment variable to this end (such that one does not need to edit the sources). As Toby already pointed out, however, your problem is solved without the need to have additional folders for products. -- Dieter
participants (3)
-
David Little -
Dieter Maurer -
Toby Dickenson