[Grok-dev] how getting data to view?!
Noe Nieto
nnieto at noenieto.com
Sun Nov 20 15:26:47 UTC 2011
2011/11/12 Tamer Higazi <th982a at googlemail.com>
> Hi people!
> I am reading this amazing grok book (just bought it a short time ago),
> and I thought of writing something that is for me a bit unclear, because
> that isn't described here.
>
>
> In the ZPT Template we got this:
>
>
> <div id="testX2">
> <ul>
> <li tal:repeat="weapon python:view.weapons"
> tal:content="weapon">Weapon</li>
> </ul>
> </div>
>
>
> where and how has the method weapons to be created that returns the
> list, that creates me these entries?!
>
It can be a method or an iterable attribute
>
> I suggest in "app.py" that looks like this at the moment:
>
>
> import grok
> from grokhelloworld import resource
>
> class Grokhelloworld(grok.Application, grok.Container):
> pass
>
>
For example:
> class Index(grok.View):
weapons = ['spear', 'rock']
> def update(self):
> resource.style.need()
>
>
>
>
> Tamer
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>
--
---
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/20111120/c5d0fe6a/attachment.html
More information about the Grok-dev
mailing list