Hi,
I'm struggling to get custom ComputedErrorViewMessage adapters to work
in z3c.form. I'm still debugging, but I came across this:
In error.py:
ErrorViewMessage = value.StaticValueCreator(
discriminators = ('error', 'request', 'widget', 'field', 'form',
'content')
)
ComputedErrorViewMessage = value.ComputedValueCreator(
discriminators = ('error', 'request', 'widget', 'field', 'form',
'content')
)
class ErrorViewSnippet(object):
...
def update(self):
value = zope.component.queryMultiAdapter(
(self.context, self.request, self.widget,
self.field, self.form, self),
interfaces.IValue, name='message')
if value is not None:
self.message = value.get()
else:
self.message = self.createMessage()
...
From what I can tell, self.context is the exception; self.request,
self.widget, self.field and self.form are as you'd expect. But the last
discriminator, 'content' does not match up with 'self' (i.e. the error
view snippet).
So, which is right? The discriminator on the value adapter factory, or
the multi-adapter lookup? The documentation mentions 'content' as the
discriminator, but doesn't define it any further.
FWIW, my expection is that 'content' should be the form's context
content object.
Martin
_______________________________________________
Zope-Dev maillist - [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope )