[Checkins] SVN: grok/trunk/src/grok/ test explicit grok.context for imported models

Philipp von Weitershausen philikon at philikon.de
Sat Oct 14 14:30:14 EDT 2006


Log message for revision 70624:
  test explicit grok.context for imported models
  

Changed:
  U   grok/trunk/src/grok/adapter.txt
  A   grok/trunk/src/grok/tests/modulecontextimported.py

-=-
Modified: grok/trunk/src/grok/adapter.txt
===================================================================
--- grok/trunk/src/grok/adapter.txt	2006-10-14 18:26:35 UTC (rev 70623)
+++ grok/trunk/src/grok/adapter.txt	2006-10-14 18:30:13 UTC (rev 70624)
@@ -94,7 +94,7 @@
 
   >>> cleanUp()
 
-Explicit module-level context:
+Explicit module-level context in case of multiple models:
 
   >>> grok.grok('grok.tests.modulecontext')
 
@@ -106,3 +106,20 @@
   True
   >>> isinstance(home, Home)
   True
+
+Clean up:
+
+  >>> cleanUp()
+
+Explicit module-level context for an imported model:
+
+  >>> grok.grok('grok.tests.modulecontextimported')
+
+  >>> from grok.tests.modulecontextimported import IPainting, Painting, Cave
+  >>> cave = Cave()
+  >>> painting = IPainting(cave)
+
+  >>> IPainting.providedBy(painting)
+  True
+  >>> isinstance(painting, Painting)
+  True

Added: grok/trunk/src/grok/tests/modulecontextimported.py
===================================================================
--- grok/trunk/src/grok/tests/modulecontextimported.py	2006-10-14 18:26:35 UTC (rev 70623)
+++ grok/trunk/src/grok/tests/modulecontextimported.py	2006-10-14 18:30:13 UTC (rev 70624)
@@ -0,0 +1,11 @@
+import grok
+from grok.tests.adapter import Cave
+from zope import interface
+
+grok.context(Cave)
+
+class IPainting(interface.Interface):
+    pass
+
+class Painting(grok.Adapter):
+    grok.implements(IPainting)


Property changes on: grok/trunk/src/grok/tests/modulecontextimported.py
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list