That's similar to what I did. It feels very clunky though. Isn't there
a better way to do it? Say, have installPackage do registerPackage
also?
No.
ZopeTestCase makes you explicitly install products. installProduct() and
installPackage() are equivalent, and both perform that function.
The Plone ZCML layer loads the Five site.zcml, which loads all ZCML in
Products/*, but not elsewhere. Hence, you need to load that ZCML
explicitly.
You can't call installPackage() until ZCML has been processed, however, at
ZCML processing time, it's too early to call it, so registerPackage can't
call it (not at least because installPackage() is a test-only thing, and
registerPackage is used in regular operation). installProduct() is
responsible for registering with Control_Panel etc. In fact, that used to
happen during ZCML processing in Zope 2.10.4, and it caused all sorts of
subtle breakage because Control_Panel is persistent in the ZODB, and at
that time you don't have a proper DB connection yet.
You explained a lot of stuff here, but you haven't backed your statement
that installPackage cannot call registerPackage if it has not been called
yet. I am worried that lots of people will be bitten by this issue and since
the code to work around it is non-trivial to figure out, this will be a
major source of pain. My opinion is that we need a better answer to this
question than 'just copy some random lines from borg and don't ask
questions'.
--
Sidnei da Silva
Enfold Systems, Inc.
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers