Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Hanno Schlichting
Hi.

On Wed, Aug 4, 2010 at 10:31 AM, Chris Withers ch...@simplistix.co.uk wrote:
 I'm in the process of egg-ifying some Zope 2 Products of mine (first up
 is MailTemplates) and I'm curious as to how add-in products work in an
 egg-based Zope setup.

 Do I need to include anything in zope.conf or some zcml somewhere?

For a general Python package to be picked up, you would need to add a
regular ZCML slug into the etc/package-includes directory of your
instance.

If your package is a namespace package in the 'Products' namespace,
then it will be picked up automatically, once added to the PYTHONPATH.
This is triggered by the five:loadProducts and
five:loadProductsOverrides directives in your instances site.zcml.
The code for those directives is either in Products.Five or OFS
depending on which version of Zope2 you use.

Hanno
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Chris Withers
Hanno Schlichting wrote:
 For a general Python package to be picked up, you would need to add a
 regular ZCML slug into the etc/package-includes directory of your
 instance.

What does a regular ZCML slug look like?

 If your package is a namespace package in the 'Products' namespace,
 then it will be picked up automatically, once added to the PYTHONPATH.

Is this setuptools namespace package magic making things work or is 
there explicit code in Zope that does this?

 This is triggered by the five:loadProducts and
 five:loadProductsOverrides directives in your instances site.zcml.
 The code for those directives is either in Products.Five or OFS
 depending on which version of Zope2 you use.

Thanks for this!

Chris

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Jens Vagelpohl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/4/10 10:52 , Hanno Schlichting wrote:
 Hi.
 
 On Wed, Aug 4, 2010 at 10:31 AM, Chris Withers ch...@simplistix.co.uk wrote:
 I'm in the process of egg-ifying some Zope 2 Products of mine (first up
 is MailTemplates) and I'm curious as to how add-in products work in an
 egg-based Zope setup.

 Do I need to include anything in zope.conf or some zcml somewhere?

 If your package is a namespace package in the 'Products' namespace,
 then it will be picked up automatically, once added to the PYTHONPATH.

In essence: If your egg is in the Products namespace you don't need to
do anything after adding it e.g. to the list of eggs for a Zope instance
in your buildout.cfg. The product will be recognized, installed, and any
configure.zcml in the root picked up automatically.

That's one reason I stick to that namespace for anything that is indeed
a Zope 2 Product.

jens

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkxZKzQACgkQRAx5nvEhZLK7TgCeI2n6Y+xjagXyPZHeNuEII2V3
xMUAoIJHoErxjlAjZRWYPME8tEPM1S2O
=IYFz
-END PGP SIGNATURE-
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Charlie Clark
Am 04.08.2010, 10:56 Uhr, schrieb Jens Vagelpohl j...@dataflake.org:

 In essence: If your egg is in the Products namespace you don't need to
 do anything after adding it e.g. to the list of eggs for a Zope instance
 in your buildout.cfg. The product will be recognized, installed, and any
 configure.zcml in the root picked up automatically.

ie. in buildout just putting
eggs = Products.MailTemplates

should work fine. As will pip install Products.MailTemplates (just tested  
against Products.CMFDefault)

 That's one reason I stick to that namespace for anything that is indeed
 a Zope 2 Product.

OTOH if you don't want to stick with Products. you will need to add  
something like

zcml = simplistix.MailTemplates to your instance configuration and you're  
good.

Hope this idiot's guide helps.

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting  Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Hanno Schlichting
On Wed, Aug 4, 2010 at 10:55 AM, Chris Withers ch...@simplistix.co.uk wrote:
 What does a regular ZCML slug look like?

My first Google hit is this
http://worldcookery.com/files/ploneconf05-five/step2.html :)

 Is this setuptools namespace package magic making things work or is there
 explicit code in Zope that does this?

It's not really setuptools specific. It's just the same old code that
does import Products and then iterates over everything it finds.

Hanno
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Baiju M
On Wed, Aug 4, 2010 at 2:33 PM, Charlie Clark
charlie.cl...@clark-consulting.eu wrote:
 Am 04.08.2010, 10:56 Uhr, schrieb Jens Vagelpohl j...@dataflake.org:

 In essence: If your egg is in the Products namespace you don't need to
 do anything after adding it e.g. to the list of eggs for a Zope instance
 in your buildout.cfg. The product will be recognized, installed, and any
 configure.zcml in the root picked up automatically.

 ie. in buildout just putting
 eggs = Products.MailTemplates

 should work fine. As will pip install Products.MailTemplates (just tested
 against Products.CMFDefault)

 That's one reason I stick to that namespace for anything that is indeed
 a Zope 2 Product.

 OTOH if you don't want to stick with Products. you will need to add
 something like

 zcml = simplistix.MailTemplates to your instance configuration and you're
 good.

There is an assumption that plone.recipe.zope2instance [1] is used
to create instances from Buildout.

 [1] http://pypi.python.org/pypi/plone.recipe.zope2instance

Regards,
Baiju M
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Chris Withers
Hanno Schlichting wrote:
 On Wed, Aug 4, 2010 at 10:55 AM, Chris Withers ch...@simplistix.co.uk wrote:
 What does a regular ZCML slug look like?
 
 My first Google hit is this
 http://worldcookery.com/files/ploneconf05-five/step2.html :)

yeah yeah...

Okay, but what about:

include package=Products.Whatever /

...causes Whatever/__init__.py's initialize method to get called?

 Is this setuptools namespace package magic making things work or is there
 explicit code in Zope that does this?
 
 It's not really setuptools specific. It's just the same old code that
 does import Products and then iterates over everything it finds.

Yeah, but it's setuptools namespace packages magic that makes sure 
__path__, which the old Zope 2 code iterates over, is set up correctly, 
right?

Chris

-- 
Simplistix - Content Management, Batch Processing  Python Consulting
 - http://www.simplistix.co.uk
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Baiju M
On Wed, Aug 4, 2010 at 2:45 PM, Chris Withers ch...@simplistix.co.uk wrote:
 Baiju M wrote:

 zcml = simplistix.MailTemplates to your instance configuration and you're
 good.

 There is an assumption that plone.recipe.zope2instance [1] is used
 to create instances from Buildout.

 yes, which it isn't for me, since it's evil and I'm not using Plone ;-)

The plone.recipe.zope2instance is not Plone specific.  It works well for us.

BTW, there is related recipe: http://pypi.python.org/pypi/plone.recipe.zeoserver

Regards,
Baiju M
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Hanno Schlichting
On Wed, Aug 4, 2010 at 11:13 AM, Chris Withers ch...@simplistix.co.uk wrote:
 Okay, but what about:

 include package=Products.Whatever /

 ...causes Whatever/__init__.py's initialize method to get called?

Yes. Eggified products behave in the same way as code dumped into one
of the products directories.

If you have a package, which isn't in the Products namespace and
still want its initialize to be called, you need to add some bits to
your configure.zcml:

five:registerPackage package=. initialize=.initialize /

 Yeah, but it's setuptools namespace packages magic that makes sure __path__,
 which the old Zope 2 code iterates over, is set up correctly, right?

Sure.

Hanno
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Chris Withers
Hanno Schlichting wrote:
 If you have a package, which isn't in the Products namespace and
 still want its initialize to be called, you need to add some bits to
 your configure.zcml:
 
 five:registerPackage package=. initialize=.initialize /

Right, that's the bit I was after :-)

Chris

-- 
Simplistix - Content Management, Batch Processing  Python Consulting
 - http://www.simplistix.co.uk
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Charlie Clark
Am 04.08.2010, 11:15 Uhr, schrieb Chris Withers ch...@simplistix.co.uk:

 yes, which it isn't for me, since it's evil and I'm not using Plone

Well, I said it was the idiot's guide...

As you know, I don't use Plone either. I'm also evil but in a different  
way! The recipe just sets up a Zope 2 instance, which I believe is a bit  
tricky to work on all platforms. That said the recipe could probably be a  
simpler.

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting  Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Products in Zope 2.12+

2010-08-04 Thread Chris Withers
Charlie Clark wrote:
 As you know, I don't use Plone either. I'm also evil but in a different  
 way! The recipe just sets up a Zope 2 instance, which I believe is a bit  
 tricky to work on all platforms. 

It's a piece of piss and needs no special recipes:

http://docs.zope.org/zope2/releases/2.12/INSTALL-buildout.html#creating-a-buildout-based-zope-instance

cheers,

Chris

___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )