[Grok-dev] grok.Skin question.
Fernando Correa Neto
fcdoth at gmail.com
Thu Jul 24 14:10:35 EDT 2008
Hey there,
Someone on IRC asked if I ever used z3c.form with grok and I decided
to give it a try by just using grok components.
In z3c.form, a lot of it's components are registered for
z3c.form.interfaces.IFormLayer. In order to create a form you
basically need to create a layer like:
from z3c.form.interfaces import IFormLayer
from z3c.layout.pagelet import IPageletBrowserLayer
class IMyFormLayer(IFormLayer, IPageletBrowserLayer):
"""a form layer"""
But then in your skin, you must inherit from IMyFormLayer AND
z3c.formui.interfaces.IDivFormLayer or
z3c.formui.interfaces.ITableFormLayer (depending on what you want in
your html).
So in terms of layers I think we are prettu much OK since we can do this:
class MyGrokLayer(IFormLayer, IPageletBrowserLayer):
pass
But then when you declare your skin naively like this:
class MyGrokSkin(grok.Skin, IDivFormLayer):
grok.name('youwhish')
grok.layer(MyGrokLayer)
It is raises a conflict error like this:
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File
"/Users/fcorrea/grokapps/grokenv/z3cformtest/parts/app/site.zcml",
line 4.0-4.33
ZopeXMLConfigurationError: File
"/Users/fcorrea/grokapps/grokenv/z3cformtest/src/z3cformtest/configure.zcml",
line 5.2-5.27
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a
(non-strict) subclass of the metaclasses of all its bases
So the question is: Would it be possible to create a skin in grok that
gets registered for anything else other than just IBrowserSkinType?
Does anyone know any pattern?
I am attaching my current app.py in case someone decides to take a look.
Best regards,
Fernando
P.S: The test form is also subclassing grok.View for testing purposes
so I could just reach it through url.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: app.py
Type: application/octet-stream
Size: 1355 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20080724/73793e0e/app.obj
More information about the Grok-dev
mailing list