[Grok-dev] Whats wrong wit my update method

Lumir Jasiok lumir.jasiok at vsb.cz
Tue Jul 27 06:15:15 EDT 2010


I am pretty new in Grok Development, so sorry for (probably) trivia 
question. I have small testing application in app.py

import grok

class Awbarcode(grok.Application,grok.Container):

     def __init__(self):
         super(Awbarcode, self).__init__()
         self.title = 'AWBarcode manager'
         self.text = "basic text"
         self.next_id = 0

     def addBarcode(self,text):
         id = str(self.next_id)
         self.next_id = self.next_id + 1
         self[id] = Barcode(text)

     def deleteBarcode(self,barode):
         del self[barcode]

class Barcode(grok.Model):

     def __init__(self,text):
         self.text = text

class AwbarcodeIndex(grok.View):

class AddBarcode(grok.View):

     def update(self,text):

Also I have two .pt files, awbarcodeindex.pt:

<title tal:content="context/title">Barcode manager</title>
<h1 tal:content="context/title">Barcode manager</h1>
<h2>Here you can see barcodes:</h2>
<tal:block repeat="barcode context/values">
<li tal:content="barcode/text">Barcode</li>

and addbarcode.pt:

<h2>Add barcode</h2>
<form tal:attributes="action view/url"  method="POST">
             New Barcode text: <input type="text" name="text" value="" 
/><br />
<input type="submit" value="Add Barcode Text" />

So, if I manually add some barcode text, I can see it listed on the 
index page, but when I try to add new barcode text using url:


I can see just "A system error occurred.", not form I have in 
addbarcode.pt  and in log file is "TypeError: Missing argument to 
update(): text". I must use this to add new text to the storage:


After that I can finally see form and add new barcode text.

What I am doing wrong? Thanks for any help.

Best Regards

Lumir Jasiok

  Lumír Jasiok
  VSB-TU Ostrava - Computer centre
  Tel: +420 59 732 3189
  E-mail: lumir.jasiok at vsb.cz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20100727/c791e9a0/attachment-0001.html 

More information about the Grok-dev mailing list