[Checkins] SVN: grok/branches/jw-simpler-skin-registration/src/grok/ Implement the setattr on the directive too.

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Jul 28 16:06:19 EDT 2008


Log message for revision 88892:
  Implement the setattr on the directive too.

Changed:
  U   grok/branches/jw-simpler-skin-registration/src/grok/directive.py
  U   grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective.py

-=-
Modified: grok/branches/jw-simpler-skin-registration/src/grok/directive.py
===================================================================
--- grok/branches/jw-simpler-skin-registration/src/grok/directive.py	2008-07-28 20:02:09 UTC (rev 88891)
+++ grok/branches/jw-simpler-skin-registration/src/grok/directive.py	2008-07-28 20:06:19 UTC (rev 88892)
@@ -219,7 +219,7 @@
         taggeddata[directive.dotted_name()] = value
 
     def setattr(self, context, directive, value):
-        raise NotImplementedError, 'Do we need this?'
+        context.setTaggedValue(directive.dotted_name(), value)
 
 TAGGEDVALUEONCE = TaggedValueStoreOnce()
 

Modified: grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective.py
===================================================================
--- grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective.py	2008-07-28 20:02:09 UTC (rev 88891)
+++ grok/branches/jw-simpler-skin-registration/src/grok/tests/directive/skindirective.py	2008-07-28 20:06:19 UTC (rev 88892)
@@ -25,4 +25,15 @@
    ...
    AttributeError: type object 'NotAnInterfaceClass' has no attribute
    'queryTaggedValue'
+
+In certain cases we need to set a value on a component as if the directive was
+actually used::
+
+  >>> from zope import interface
+  >>> class IFoo(interface.Interface):
+  ...     pass
+  >>> grok.skin.set(IFoo, u'value as set')
+  >>> grok.skin.bind().get(IFoo)
+  u'value as set'
+
 """



More information about the Checkins mailing list