ich noch mal...

jetzt will ich eine Zahl in einem Formular eingeben und beim klicken auf den Submit Button sollen die daten an ein Valedierungsscript gesendet werden. Dort soll kontrolliert werden ob die Zahl existiert usw.
Das ganze hab ich mal so versucht:
Formular:
Code: Alles auswählen
<html>
<head>
<title tal:content="template/title">The title</title>
</head>
<body>
<form method="POST"
tal:define="errors options/state/getErrors"
tal:attributes="action template/id;">
<p>Enter a number: <input name="num" type="text" value=""></p>
<p><input type="submit" name="form.button.submit" value="Submit" /></p>
<input type="hidden" name="form.submitted" value="1" />
</form>
</body>
</html>
Code: Alles auswählen
##bind container=container
##bind context=context
##bind namespace=
## parameters=
##title="test_validator"
num=context.REQUEST.get('num',None)
try:
int(num)
except ValueError:
state.setError("num", "Keine Zahl", new_status="failure")
except TypeError:
state.setError("num", "Keine Zahl eingegeben.", new_status="failure")
if state.getErrors():
state.set(portal_status_message="Bitte Fehler korrigieren.")
return state
Im Reiter "Actions" --> Name "test_cpt", status="success", action="redirect_to".
Als fehler kommt:
mfg mitchicannot concatenate 'str' and 'dict' objects