[Checkins]
SVN: grok/branches/gotcha-configuration-actions/src/grok/meta.py
Move the last remaining grokkers over to actions.
Philipp von Weitershausen
philikon at philikon.de
Fri Oct 12 06:09:06 EDT 2007
Log message for revision 80855:
Move the last remaining grokkers over to actions.
Changed:
U grok/branches/gotcha-configuration-actions/src/grok/meta.py
-=-
Modified: grok/branches/gotcha-configuration-actions/src/grok/meta.py
===================================================================
--- grok/branches/gotcha-configuration-actions/src/grok/meta.py 2007-10-12 10:01:15 UTC (rev 80854)
+++ grok/branches/gotcha-configuration-actions/src/grok/meta.py 2007-10-12 10:09:05 UTC (rev 80855)
@@ -685,7 +685,11 @@
contained_result = contained(result, context, key)
return contained_result
- component.provideAdapter(getAnnotation)
+ config.action(
+ discriminator=('adapter', adapter_context, provides, ''),
+ callable=component.provideAdapter,
+ args=(getAnnotation,),
+ )
return True
@@ -695,10 +699,13 @@
def grok(self, name, factory, module_info, config, **kw):
# XXX fail loudly if the same application name is used twice.
- zope.component.provideUtility(factory,
- provides=grok.interfaces.IApplication,
- name='%s.%s' % (module_info.dotted_name,
- name))
+ provides = grok.interfaces.IApplication
+ name = '%s.%s' % (module_info.dotted_name, name)
+ config.action(
+ discriminator=('utility', provides, name),
+ callable=component.provideUtility,
+ args=(factory, provides, name),
+ )
return True
@@ -718,15 +725,20 @@
context = module_info.getAnnotation('grok.context', None)
context = util.determine_class_context(factory, context)
catalog_name = util.class_annotation(factory, 'grok.name', u'')
- zope.component.provideHandler(
- IndexesSetupSubscriber(catalog_name, indexes,
- context, module_info),
- adapts=(site,
- grok.IObjectAddedEvent))
+
+ subscriber = IndexesSetupSubscriber(catalog_name, indexes,
+ context, module_info)
+ subscribed = (site, grok.IObjectAddedEvent)
+ config.action(
+ discriminator=None,
+ callable=component.provideHandler,
+ args=(subscriber, subscribed),
+ )
return True
class IndexesSetupSubscriber(object):
+
def __init__(self, catalog_name, indexes, context, module_info):
self.catalog_name = catalog_name
self.indexes = indexes
@@ -784,5 +796,10 @@
default=IBrowserRequest)
name = grok.util.class_annotation(factory, 'grok.name',
factory.__name__.lower())
- zope.component.interface.provideInterface(name, layer, IBrowserSkinType)
+
+ config.action(
+ discriminator=None,
+ callable=zope.component.interface.provideInterface,
+ args=(name, layer, IBrowserSkinType)
+ )
return True
More information about the Checkins
mailing list