[Zope3-Users] How to organize common code for Z2 and Z3
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Apr 13 11:19:54 EDT 2005
On Wednesday 13 April 2005 10:31, Andreas Jung wrote:
> I am currently working on TextIndexNG V3 with the goal to have its
> functionality available
> for Zope 2 and Zope 3 (means a common code base). Are there recommendations
> or experiences
> how to structure code and test? E.g. at the moment everything lives under
> Products/TextIndexNG3.
> Unittest scripts perform imports from Products.TextIndexNG3...which is fine
> for Zope 2
> but properly not for Zope 3. So what the best way to deal with common code
> on both platforms?
I knew this would happen some day, and I have thought for a long time about it
already. :-) I think the trick would be to write code for Zope 3 and put it
in a top-level package, like "textindexng". Inside this package you add a
package "TextIndexNG" that is expected to be added to Zope 2's
lib/python/Products.
So the tricky part is to not run the tests in "textindexng/TextIndexNG" when
testing from Zope 3's test runner. I could work with you on some testing
support for this.
So in effect, in Zope 3 you would have:
src/textindexng
+-- TextIndexNG (not used or even distributed)
In Zope 2:
lib/python
+-- textindexng
+-- Products
+-- TextIndexNG
I think this would be a usable pattern; what do you think?
Regards,
Stephan
--
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
More information about the Zope3-users
mailing list