[Zope3-dev] Zope 3 Questions

Jim Fulton jim@zope.com
Wed, 08 Jan 2003 05:32:00 -0500


Shane Hathaway wrote:
> I looked at the latest Zope 3 today and suddenly felt like a Zope 3 
> newbie. :-)   I was happy to see it works, but I encountered a lot of 
> surprises.  So if someone wouldn't mind, please help me find the answers 
> to a few questions:

I'll answer the service/package questions and leave the UI questions
for someone else.

...

> - Why are services in packages?  This is not what I envisioned for 
> packages.

Packages are where software and configuration work gets done.

This work includes creating instances of persistent components,
like services, utilities, worfflow process definitions, etc.

Someone creates an instance in a package, and, possibly does some
management/configuration of it there, where the configuration
of the instance itself.

They then create a service configuration for the service instance to
say how the instance should be *used* within the site. The service
configuration corresponses to a zcml provide-service directive and
specified the indented use.

...

> - I can't remember the difference between a service being "registered" 
> and "active".  I know only one service of each type can be active, but 
> what does it mean for a service to be registered yet not active? 

A registered service is shown in the service manager, so somene can see all
of the available components that could provide a particular service and
easily change which one is active.

A lot of this relates to package distribution and installation,
which we don't have yet.

Consider the following scenario.  I create a database-based (TTW) package
that has a new content type and some adapters and views for that content type.
The package also includes some configurations for the content type, adapters,
and views. In fact, imagine that these are Contact views defined in the tutorial,
except that they are database based, rather than file-system based. I make a
distribution of the package and give it to you.

You install the package. In the first step of the installation, Zope reads the
package, gets the configurations, and shows you a summary of the various
configurations. At this point, nothing in the system has changed yet.
There are no conflicts with existing configurations, so you go approve the
install without changes. The package and all of it's changes are installed.

(Note that you performed the install in one of the sites within your Zope instance,
  where a site is just a folder that has a service manager. This could have been
  your root folder, a sub-folder of the root folder, or some other folder.
  Because the install was done in a site, the install affects *only* that site
  and subsites.)

You don't like my contact edit view, so you create your own contact edit view and
make it active. Note that you did not modify the package I sent you. You created the
new view in a separate package within the same site.

I update my package, adding a new field to contacts. I send you the update and you
invoke the UI to install it.  The UI notes that the package was installed previously
and shows you the changes that the update would make before applying it. In particular,
it shows you the configuration changes.  In this case, there is a conflict, because
the update wants to install it's edit view, but you have your own contact edit view.
By default, the updater would not override your configuration, but it would highlight
the fact that you had overridden it. You accept the default update, which leaves your
override in place. The update is performed. You get the new update view, but
it is registered and not active, because your view is active.

You notice that contacts have a new field that needs to be edited. You will update
your editing view to reflect this, but, until you do, you make the new editing view
active, rather than your view.  Later, you update your view and make it active again.

 > And
 > what does it mean for a service to exist but not be registered?  Why not
 > just delete unregistered services?

Because you need to be able to create components and their configurations without
actually registering them.  You might be working on them and don't want
them to show up in the relevent service configurations, but you don't want to
lose the configuration data.

Jim

-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org