tags:

views:

37

answers:

1

It's a little confusing that ZCML registrations for Zope utilities can accept a component or a factory.

<utility component=".some.Class" />

versus

<utility factory=".some.Factory" />

What is the difference?

+1  A: 

A factory creates utilities, while a utility registered as a component is an instance. Hence, if you look up a factory registered as a component, you will get the same object back every time. But if it's registered as a factory, you'll get a new instance every time.

Lennart Regebro