<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I am pretty new in Grok Development, so sorry for (probably) trivia
question. I have small testing application in app.py<br>
<br>
import grok<br>
<br>
class Awbarcode(grok.Application,grok.Container):<br>
<br>
def __init__(self):<br>
super(Awbarcode, self).__init__()<br>
self.title = 'AWBarcode manager'<br>
self.text = "basic text"<br>
self.next_id = 0<br>
<br>
def addBarcode(self,text):<br>
id = str(self.next_id)<br>
self.next_id = self.next_id + 1<br>
self[id] = Barcode(text)<br>
<br>
def deleteBarcode(self,barode):<br>
del self[barcode]<br>
<br>
class Barcode(grok.Model):<br>
<br>
def __init__(self,text):<br>
super(Barcode,self).__init__()<br>
self.text = text<br>
<br>
class AwbarcodeIndex(grok.View):<br>
grok.context(Awbarcode)<br>
grok.name('index')<br>
<br>
class AddBarcode(grok.View):<br>
grok.context(Awbarcode)<br>
grok.name('addbarcode')<br>
<br>
def update(self,text):<br>
self.context.addBarcode(text)<br>
self.redirect(self.url('index'))<br>
<br>
Also I have two .pt files, awbarcodeindex.pt:<br>
<br>
<html><br>
<head><br>
<title tal:content="context/title">Barcode
manager</title><br>
</head><br>
<body><br>
<h1 tal:content="context/title">Barcode manager</h1><br>
<h2>Here you can see barcodes:</h2><br>
<tal:block repeat="barcode context/values"><br>
<ul><br>
<li tal:content="barcode/text">Barcode</li><br>
</ul><br>
</tal:block><br>
</body><br>
</html><br>
<br>
and addbarcode.pt:<br>
<br>
<html><br>
<body><br>
<h2>Add barcode</h2><br>
<form tal:attributes="action view/url" method="POST"><br>
New Barcode text: <input type="text" name="text"
value="" /><br /><br>
<input type="submit" value="Add Barcode Text" /><br>
</form><br>
</body><br>
</html><br>
<br>
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:<br>
<br>
<a class="moz-txt-link-freetext" href="http://localhost:8080/test/addbarcode">http://localhost:8080/test/addbarcode</a> <br>
<br>
I can see just
<meta charset="utf-8">
"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:<br>
<br>
<a class="moz-txt-link-freetext" href="http://localhost:8080/test/addbarcode?text=text1">http://localhost:8080/test/addbarcode?text=text1</a><br>
<br>
After that I can finally see form and add new barcode text.<br>
<br>
What I am doing wrong? Thanks for any help.<br>
<br>
Best Regards<br>
<br>
Lumir Jasiok<span class="Apple-style-span" style="border-collapse:
separate; color: rgb(0, 0, 0); font-family: Times; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: 2; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; font-size: medium;"> <br>
</span>
<pre class="moz-signature" cols="72">--
Lumír Jasiok
VSB-TU Ostrava - Computer centre
Tel: +420 59 732 3189
E-mail: <a class="moz-txt-link-abbreviated" href="mailto:lumir.jasiok@vsb.cz">lumir.jasiok@vsb.cz</a>
<a class="moz-txt-link-freetext" href="http://www.vsb.cz">http://www.vsb.cz</a>
</pre>
</body>
</html>