[Grok-dev] confusion
Jan Ulrich Hasecke
janulrich.hasecke at web.de
Tue Aug 28 09:21:38 EDT 2007
Hi,
since there is noe grok-user list I venture to ask some questions
here. During the wonderful grok workshop on froscon we started to
make a game. I now wanted to extend it, but miserably failed.
this is the relevant code from app.py:
class Gehege(grok.Container):
def __init__(self, name):
super(Gehege, self).__init__()
self.name = name
def tierkaufen(self, name):
self[name] = Tier(name)
# this method works we can add Tier-objects to the Container.
def tierverkaufen(self, name):
del self[name]
# this method does not work or is never executed
class Tierkaufen(grok.View):
grok.context(Gehege)
grok.name('tierkaufen')
def update(self, name=None):
if name is None or name in self.context.keys():
return
self.context.tierkaufen(name)
self.redirect(self.url('index'))
# this view redirects to the index-view
class Tierverkaufen(grok.View):
grok.context(Gehege)
grok.name('tierverkaufen')
def upate(self, name):
if name is None or name not in self.context.keys():
return
self.context.tierverkaufen(name)
self.redirect(self.url('index'))
# but this view does not redirect to the index view. It always
behaves as if the if-condition is never False to execute the last two
lines.
# the form in the pagetemplate "tierkaufen.pt" is:
<form tal:attributes="action python:view.url()" method="post">
Name des Tieres: <input type="text" name="name" value="Name des
Tiers" /><br />
<input type="submit" value="Tier kaufen" />
</form>
# the form which does not seem to do anything, not even an error in
"tierverkaufen.pt" is:
<form tal:attributes="action python:view.url()" method="post">
Name des Tieres: <input type="text" name="name" value="Name des
Tiers" /><br />
<input type="submit" value="Tier verkaufen" />
</form>
Because there is no error message at all, I am stuck.
Any hints?
juh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Signierter Teil der Nachricht
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20070828/f1ec086d/PGP.bin
More information about the Grok-dev
mailing list