[Checkins] SVN: grok/trunk/src/grok/ explicit class-level context for imported model

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


Log message for revision 70627:
  explicit class-level context for imported model
  

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

-=-
Modified: grok/trunk/src/grok/adapter.txt
===================================================================
--- grok/trunk/src/grok/adapter.txt	2006-10-14 18:39:54 UTC (rev 70626)
+++ grok/trunk/src/grok/adapter.txt	2006-10-14 18:45:16 UTC (rev 70627)
@@ -139,6 +139,8 @@
 
   >>> cleanUp()
 
+Explicit class-level context in case of multiple models:
+
   >>> grok.grok('grok.tests.classcontext')
 
   >>> from grok.tests.classcontext import IHome, Home, Cave
@@ -149,3 +151,20 @@
   True
   >>> isinstance(home, Home)
   True
+
+Clean up:
+
+  >>> cleanUp()
+
+Explicit class-level context for an imported model:
+
+  >>> grok.grok('grok.tests.classcontextimported')
+
+  >>> from grok.tests.classcontextimported import IPainting, Painting, Cave
+  >>> cave = Cave()
+  >>> painting = IPainting(cave)
+
+  >>> IPainting.providedBy(painting)
+  True
+  >>> isinstance(painting, Painting)
+  True

Added: grok/trunk/src/grok/tests/classcontextimported.py
===================================================================
--- grok/trunk/src/grok/tests/classcontextimported.py	2006-10-14 18:39:54 UTC (rev 70626)
+++ grok/trunk/src/grok/tests/classcontextimported.py	2006-10-14 18:45:16 UTC (rev 70627)
@@ -0,0 +1,10 @@
+import grok
+from grok.tests.adapter import Cave
+from zope import interface
+
+class IPainting(interface.Interface):
+    pass
+
+class Painting(grok.Adapter):
+    grok.implements(IPainting)
+    grok.context(Cave)


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



More information about the Checkins mailing list