[Checkins]
SVN: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/
inline the check_adapts helper,
it's only used in one place. Streamlined the error message a bit.
Philipp von Weitershausen
philikon at philikon.de
Sun May 4 08:31:12 EDT 2008
Log message for revision 86348:
inline the check_adapts helper, it's only used in one place. Streamlined the error message a bit.
Changed:
U grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/meta.py
U grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/adapter/multiadaptsnone.py
U grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/util.py
-=-
Modified: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/meta.py
===================================================================
--- grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/meta.py 2008-05-04 12:26:19 UTC (rev 86347)
+++ grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/meta.py 2008-05-04 12:31:11 UTC (rev 86348)
@@ -19,7 +19,6 @@
from zope import component, interface
from martian.error import GrokError
-from grokcore.component.util import check_adapts
from grokcore.component.util import check_module_component
from grokcore.component.util import determine_module_component
@@ -67,7 +66,10 @@
provides = get_provides(factory)
name = grokcore.component.name.get(factory)
- check_adapts(factory)
+ if component.adaptedBy(factory) is None:
+ raise GrokError("%r must specify which contexts it adapts "
+ "(use the 'adapts' directive to specify)."
+ % factory, factory)
for_ = component.adaptedBy(factory)
config.action(
Modified: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/adapter/multiadaptsnone.py
===================================================================
--- grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/adapter/multiadaptsnone.py 2008-05-04 12:26:19 UTC (rev 86347)
+++ grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/tests/adapter/multiadaptsnone.py 2008-05-04 12:31:11 UTC (rev 86348)
@@ -4,8 +4,8 @@
>>> grok.testing.grok(__name__)
Traceback (most recent call last):
...
- GrokError: <class 'grokcore.component.tests.adapter.multiadaptsnone.Home'> must specify
- which contexts it adapts (use grok.adapts to specify).
+ GrokError: <class 'grokcore.component.tests.adapter.multiadaptsnone.Home'>
+ must specify which contexts it adapts (use the 'adapts' directive to specify).
"""
import grokcore.component as grok
Modified: grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/util.py
===================================================================
--- grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/util.py 2008-05-04 12:26:19 UTC (rev 86347)
+++ grokcore.component/branches/jw-philipp-using-ndir-directives/src/grokcore/component/util.py 2008-05-04 12:31:11 UTC (rev 86348)
@@ -20,12 +20,6 @@
from martian.error import GrokError
from martian.util import methods_from_class, scan_for_classes
-def check_adapts(class_):
- if component.adaptedBy(class_) is None:
- raise GrokError("%r must specify which contexts it adapts "
- "(use grok.adapts to specify)."
- % class_, class_)
-
def _sort_key(component):
explicit_order, implicit_order = grokcore.component.order.get(component)
return (explicit_order,
More information about the Checkins
mailing list