[Checkins] SVN: grok/trunk/ grokcore.component 1.5 exposes its API
specifications as interfaces as well. So let's
Philipp von Weitershausen
philikon at philikon.de
Tue Jul 22 10:46:14 EDT 2008
Log message for revision 88699:
grokcore.component 1.5 exposes its API specifications as interfaces as well. So let's
depend on that and use them.
Changed:
U grok/trunk/setup.py
U grok/trunk/src/grok/interfaces.py
U grok/trunk/versions.cfg
-=-
Modified: grok/trunk/setup.py
===================================================================
--- grok/trunk/setup.py 2008-07-22 14:43:04 UTC (rev 88698)
+++ grok/trunk/setup.py 2008-07-22 14:46:13 UTC (rev 88699)
@@ -36,7 +36,7 @@
zip_safe=False,
install_requires=['setuptools',
'martian >= 0.10',
- 'grokcore.component >= 1.4',
+ 'grokcore.component >= 1.5',
'simplejson',
'pytz',
'ZODB3',
Modified: grok/trunk/src/grok/interfaces.py
===================================================================
--- grok/trunk/src/grok/interfaces.py 2008-07-22 14:43:04 UTC (rev 88698)
+++ grok/trunk/src/grok/interfaces.py 2008-07-22 14:46:13 UTC (rev 88699)
@@ -20,25 +20,21 @@
from zope.viewlet.interfaces import IViewletManager as IViewletManagerBase
from zope.app.container.interfaces import IContainer as IContainerBase
+import grokcore.component.interfaces
+
+# Expose interfaces from grok.interfaces as well:
from grokcore.component.interfaces import IContext
+from grokcore.component.interfaces import IGrokErrors
-class IGrokBaseClasses(interface.Interface):
- ClassGrokker = interface.Attribute("Base class to define a class "
- "grokker.")
- InstanceGrokker = interface.Attribute("Base class to define an "
- "instance grokker.")
- ModuleGrokker = interface.Attribute("Base class to define a "
- "module grokker.")
+
+class IGrokBaseClasses(grokcore.component.interfaces.IBaseClasses):
Model = interface.Attribute("Base class for persistent content objects "
"(models).")
Container = interface.Attribute("Base class for containers.")
OrderedContainer = interface.Attribute("Base class for ordered containers.")
Site = interface.Attribute("Mixin class for sites.")
Application = interface.Attribute("Base class for applications.")
- Adapter = interface.Attribute("Base class for adapters.")
- MultiAdapter = interface.Attribute("Base class for multi-adapters.")
Annotation = interface.Attribute("Base class for persistent annotations.")
- GlobalUtility = interface.Attribute("Base class for global utilities.")
LocalUtility = interface.Attribute("Base class for local utilities.")
View = interface.Attribute("Base class for browser views.")
XMLRPC = interface.Attribute("Base class for XML-RPC methods.")
@@ -59,38 +55,8 @@
Public = interface.Attribute("Marker for explicitly not requiring a permission.")
-class IGrokErrors(interface.Interface):
+class IGrokDirectives(grokcore.component.interfaces.IDirectives):
- def GrokError(message, component):
- """Error indicating that a problem occurrend during the
- grokking of a module (at "grok time")."""
-
- def GrokImportError(*args):
- """Error indicating a problem at import time."""
-
-
-class IGrokDirectives(interface.Interface):
-
- def implements(*interfaces):
- """Declare that a class implements the given interfaces."""
-
- def adapts(*classes_or_interfaces):
- """Declare that a class adapts objects of the given classes or
- interfaces."""
-
- def context(class_or_interface):
- """Declare the context for views, adapters, etc.
-
- This directive can be used on module and class level. When
- used on module level, it will set the context for all views,
- adapters, etc. in that module. When used on class level, it
- will set the context for that particular class."""
-
- def name(name):
- """Declare the name of a view or adapter/multi-adapter.
-
- This directive can only be used on class level."""
-
def layer(layer):
"""Declare the layer for the view.
@@ -114,25 +80,6 @@
of the directory. This can be overridden using
``templatedir``."""
- def provides(interface):
- """Explicitly specify with which interface a component will be
- looked up."""
-
- def baseclass():
- """Mark this class as a base class.
-
- This means it won't be grokked, though if it's a possible context,
- it can still serve as a context.
- """
-
- def global_utility(factory, provides=None, name=u''):
- """Register a global utility.
-
- factory - the factory that creates the global utility
- provides - the interface the utility should be looked up with
- name - the name of the utility
- """
-
def local_utility(factory, provides=None, name=u'',
setup=None, public=False, name_in_container=None):
"""Register a local utility.
@@ -187,12 +134,8 @@
"""
-class IGrokDecorators(interface.Interface):
+class IGrokDecorators(grokcore.component.interfaces.IDecorators):
- def subscribe(*classes_or_interfaces):
- """Declare that a function subscribes to an event or a
- combination of objects and events."""
-
def action(label, **options):
"""Decorator that defines an action factory based on a form
method. The method receives the form data as keyword
@@ -233,9 +176,16 @@
class IGrokAPI(IGrokBaseClasses, IGrokDirectives, IGrokDecorators,
IGrokEvents, IGrokErrors):
+ # BBB this is deprecated
def grok(dotted_name):
- """Grok a module or package specified by ``dotted_name``."""
+ """Grok a module or package specified by ``dotted_name``.
+ NOTE: This function will be removed from the public Grok
+ public API. For tests and interpreter sessions, use
+ grok.testing.grok().
+ """
+
+ # BBB this is deprecated
def grok_component(name, component, context=None, module_info=None,
templates=None):
"""Grok an arbitrary object. Can be useful during testing.
@@ -249,6 +199,10 @@
Note that context, module_info and templates might be required
for some grokkers which rely on them.
+
+ NOTE: This function will be removed from the public Grok
+ public API. For tests and interpreter sessions, use
+ grok.testing.grok_component().
"""
def url(request, obj, name=None, data=None):
Modified: grok/trunk/versions.cfg
===================================================================
--- grok/trunk/versions.cfg 2008-07-22 14:43:04 UTC (rev 88698)
+++ grok/trunk/versions.cfg 2008-07-22 14:46:13 UTC (rev 88699)
@@ -6,7 +6,7 @@
ZODB3 = 3.8
docutils = 0.4
martian = 0.10
-grokcore.component = 1.4
+grokcore.component = 1.5
mechanize = 0.1.7b
pytz = 2007k
simplejson = 1.7.1
More information about the Checkins
mailing list