[Grok-dev] how getting data to view?!

Tamer Higazi th982a at googlemail.com
Sat Nov 12 06:27:42 UTC 2011


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?!

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

class Index(grok.View):
    def update(self):
        resource.style.need()




Tamer


More information about the Grok-dev mailing list