Package: grokcore.site
This package provides support to write local site and utilities for
Zope directly in Python (without ZCML).ContentsSetting upgrokcore.siteExamplesAPI OverviewBase classesDirectivesChanges4.0 (2023-07-11)3.1 (2020-09-02)3.0.3 (2018-01-12)3.0.2 (2018-01-11)3.0.1 (2018-01-10)3.0.0 (2018-01-05)1.8 (2016-09-21)1.7.1 (2016-01-29)1.7 (2015-06-11)1.6.1 (2012-05-02)1.6 (2012-05-01)1.5 (2011-01-03)1.4 (2010-11-01)1.3 (2010-10-18)1.2 (2009-12-20)1.1 (2009-09-18)1.0.1 (2009-06-30)1.0 (2009-06-29)Setting upgrokcore.siteThis package is essentially set up like thegrokcore.componentpackage, please refer to its documentation for details.  The only
additional ZCML line you will need is:<include package="grokcore.site" />Put this somewhere near the top of your root ZCML file but below the
line where you includegrokcore.component’s configuration.ExamplesGlobal utilities are already managed bygrokcore.component.Here a simple example of a local utility:from zope.interface import implements, Interface
import grokcore.site

class IKangaroo(Interface):

    def jump():
       """Make all kangaroos jump somewhere.
       """

class KangarooUtility(grokcore.site.LocalUtility):
    implements(IKangaroo)

    def jump(self):
        passNow, we can register our utility to a local site. That will create
automatically, and register that utility when we create that site:class Jungle(grokcore.site.Site):

    grokcore.site.local_utility(KangarooUtility, IKangaroo)If you don’t add the last line, you will still have your site, but
nothing to make jump your kangaroo. Then, you will be able to add
manually by hand after (if you want).API OverviewBase classesSiteBase class for your site.LocalUtilityBase class for a ZODB-persitent local utility.Directiveslocal_utility(factory, provides=None,name=u'',setup=None, public=False, name_in_container=None)Directive used on a site to register a local utility at the
creation time:factoryWould be the component to register (required parameter),providesWould be the interface used to query the local utility (required
parameter),nameWould be the name used to query the local utility,setupWould be a function taking parameter. If defined it will be
called after the utility is created with it as first and unique
parameter.publicIf true, the utility will be created in the site container
itself, not in the site manager, and public will be able to
access it directly.name_in_containerWould be used as id for the utility in container itwill be
created. If not defined it will ask NameChooser to pick a name
for it.In addition, thegrokcore.sitepackage exposes thegrokcore.componentAPI.Changes4.0 (2023-07-11)Drop support for Python 2.7, 3.5, 3.6.Add support for Python 3.9, 3.10, 3.11.Adapt code tozope.site >= 4.4thus requiring at least that version.
(#7)3.1 (2020-09-02)Fix DeprecationWarnings.Drop support for Python 3.4 and add support for 3.7 and 3.8.3.0.3 (2018-01-12)Rearrange tests such that Travis CI can pick up all functional tests too.3.0.2 (2018-01-11)Do not importgetSitefromzope.site.hooksanymore but fromzope.component.hooks.3.0.1 (2018-01-10)Fix dependencies by removing ZODB3.3.0.0 (2018-01-05)Python 3 compatibility.1.8 (2016-09-21)When removing a site make sure reference are removed from the parent
site.1.7.1 (2016-01-29)Update tests.1.7 (2015-06-11)Add a new directiveinstall_onthat is usable on a site. This
directive let you customize when (namely the event) to install the
configured local sites.RenameApplicationInitializedEventtoApplicationAddedEvent.When theIApplicationAddedEventis triggered the new application
will be current Zope local site. The site is restored after the
event.1.6.1 (2012-05-02)Exposed ApplicationInitializedEvent and IApplicationInitializedEvent.Added the missing import for the exposed IApplication interface.1.6 (2012-05-01)Moved the directivesitefrom Grok to this package.Moved the componentApplicationand all the related utilities from Grok
to this package.1.5 (2011-01-03)Moved IApplication and getApplication from the Grok package into
this one.1.4 (2010-11-01)Upped versions requirements for martian and grokcore.component.1.3 (2010-10-18)Made package comply to repository policy.Update functional tests to only use zope.app.appsetup instead
of zope.app.testing.Update functional tests not to require zope.app.zcmlfiles
anymore.1.2 (2009-12-20)Migrated imports from zope.app.component to zope.site.1.1 (2009-09-18)Updated dependencies (added missing ones and added separate test
dependencies).A local utility now implements IAttributeAnnotatable.Update code documentation from Grok itself.Use 1.0b2 versions.cfg in Grok’s release info instead of a local
copy; a local copy for all grokcore packages is just too hard to
maintain.1.0.1 (2009-06-30)Reupload to pypi with a correct version of Python which doesn’t have
a distutils bug.1.0 (2009-06-29)Createdgrokcore.siteby factoring local site based components,
grokkers and directives out of Grok.