[Grok-dev] Using fanstatic on your widgets
Noe Nieto
nnieto at noenieto.com
Thu Nov 24 05:15:46 UTC 2011
I was playing with fanstatic in a custom widget for zope.formlib and i'm
surprised how easy is to need() some javascript resource within some widget.
Here some snippet:
import grok
from zope.formlib.widgets import TextWidget
from yourapp.resource import library
from fanstatic import Resource
myJavascript = Resource(library, 'path/to/code.js')
class MyCustomWidget(TextWidget):
def __call__(self):
myJavascript.need()
#Some other stuff
super(TextWidget, self).__call__()
Aaand, that should do.
--
---
Noe Nieto
NNieto Consulting Services
M: nnieto at noenieto.com
W: http://noenieto.com
T: @tzicatl <https://twitter.com/#%21/tzicatl>
Li: Perfil en LinkedIn <http://www.linkedin.com/profile/view?id=84300665>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20111123/0e92ff42/attachment.html
More information about the Grok-dev
mailing list