-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 03/16/2014 01:21 PM, Achim Domma wrote:
> I have a growing web application which implements sophisticated search > and reporting functionality. To decouple some of our components, I > would like to use the ZCA, but I'm not perfectly sure how to do it. > > The first question would be, how to access the registry in the correct > way during startup. I would like to register some utilities and > adapters while application startup to use them later in my views. > Currently I'm using the registry property of my Configurator instance, > which seems to work, but I feel a bit unsure if it's supposed to be > used that way. Using the configurator's registry is the most flexible strategy: it allows you to have more than one application configured (e.g., stitched together by something like one of Paste's composites) without stepping on each other's use of the global registry. It is a less "Zopish" pattern, but one we find useful, especially for testing. As Mike said, have a look at SubstanceD for how that works, e.g.: https://github.com/Pylons/substanced/blob/master/substanced/principal/tests/test_principal.py#L571 > The second question would be, if I should use that registry at all? Or > should I just go for registerUtility & Co from zope.component? I will > need to adapt IRequest, but as it's a plain zope.interface.Interface, > it should not be a problem to register adapters for it in the "plain" > ZCA. If you want to use the ZCA's global API, see one of: http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/zca.html#enabling-the-zca-global-api-by-using-hook-zca or: http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/zca.html#enabling-the-zca-global-api-by-using-the-zca-global-registry Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 [email protected] Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlMocFEACgkQ+gerLs4ltQ7dRwCfccP97z7E30zMKlQJblaXCpVr fKsAnRzxoztOVvqX9Cs92creyfyOVh1r =FEZe -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
