[Zope-dev] zope.globalrequest?

Dieter Maurer dieter at handshake.de
Mon Jan 19 15:03:03 EST 2009


Christian Theune wrote at 2009-1-19 17:13 +0100:
> ...
>> You could use the same arguments with respect to the global "site" ;-)
>> But few people in Zope 3 land separate "site" dependent and "site"
>> independent code despite some cases where the global "site" does
>> make problems.
>
>Using the 'reversal of dependency' (not sure whether this is the
>accurate English term) you always end up with a few general concepts
>that act as mediators. Sites are badly named 'component registries' and
>are part of the central zope.component module which acts as the general
>plug-in point, thus the dependency.
>The ZCA is intended to be depended
>on and activating registries is a part of that. The comparison of a
>component registry versus a request does not hold IMHO.

The automatic activation of the local "component registries" has
drawbacks similar to other automtisms (acquisition, global request),
especially:

 * violates "explicit is better than implicit"

 * makes test and scripts more difficult (as either publishing
   must be used or the registry must be manually activated

 * does the wrong thing in edge cases (e.g. lead to problems when
   portal objects are deleted from outside a portal (as then the
   portal registry has not been activated)

 * can force a complete rewrite of parts of a system when
   a need arises to perform operation inside a "site" from
   outside the "site" (as then the correct site will need to
   be explicitely passed).

>Depending on a request is generally not good

Most Web framesworks see this differently and provide global access
to the request. Thus, YHO is debatable ;-)



-- 
Dieter


More information about the Zope-Dev mailing list