-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jung wrote:

The issue seems to be related to the Zope 2 request -> Webob request
converter here:

>
>  18
>  19 def getDeformData(request, schema):
>  20     """ Turn request into webob request for proper
>  21         form data serialization.
>  22     """
>  23     request.stdin.seek(0)
>  24     body = request.stdin.read()
>  25     req = webob.Request.blank('/', POST=body, environ=request.environ)
>  26     form = deform.Form(schema,  method='POST')
>  27     data = form.validate(req.POST.items())
>  28     return data

The Zope 2 request/form is the following

(Pdb) print request.form
{'__formid__': 'deform', 'titel': '0', 'autorengruppe': '1', 'strasse':
'', 'bemerkung': '', 'telefon': '', 'kontakt': '', '_charset_': '',
'id': '7483', 'vita': '', 'kundennr': '', 'email2': '', 'anrede': '1',
'stip_konform': '', 'kontonr': '', 'eintritt': '', 'firma': '', 'mobil':
'', 'ort2': '', '__start__': ['default:mapping', 'fibu:mapping',
'privatadresse:mapping', 'interna:mapping', 'stip:mapping'], 'vorname':
'Andreas ', 'postfach': '', 'fax2': '', 'internet': '', 'mail': '',
'ort': '', 'bemadresse': '', 'status': '0', 'fax': '', 'firma_funktion':
'', 'funktion': '', 'ust': '', 'fazusatz': '', 'kreditor': '', 'plz':
'', 'geburtstag': '', 'plzpostfach': '', 'benutzervorher': '',
'stip_brief': '', 'bank': '', 'telefon2': '', 'land': '2', 'name':
'Jung', 'blz': '', 'steuernr': '', 'zuverlaessigkeit': '0', 'Speichern':
'Speichern', '__end__': ['default:mapping', 'fibu:mapping',
'privatadresse:mapping', 'interna:mapping', 'stip:mapping'], 'beruf':
'', 'qualifikation': '0', 'benutzer': ''}

and transformed through the method above into

(Pdb) print form_data
{'default': {'kontakt': False, 'titel': u'0', 'bemerkung': False,
'telefon': False, 'id': 7483, 'vita': False, 'kundennr': False,
'email2': False, 'anrede': u'1', 'eintritt': False, 'firma': False,
'mobil': False, 'ort2': False, 'beruf': False, 'vorname': u'Andreas',
'fax2': False, 'internet': False, 'mail': False, 'status': u'0', 'fax':
False, 'firma_funktion': False, 'funktion': False, 'persoenlich': False,
'fazusatz': False, 'geburtstag': False, 'vertraulich': False,
'telefon2': False, 'name': u'Jung'}, 'fibu': {'kontonr': False, 'blz':
False, 'steuerpflichtig': False, 'kreditor': 0, 'steuernr': False,
'ust': 0, 'bank': False}, 'privatadresse': {'land': u'2', 'ort': False,
'plz': False, 'postfach': False, 'plzpostfach': False, 'strasse':
False}, 'interna': {'herausgeber': False, 'autorengruppe': u'1',
'zuverlaessigkeit': u'0', 'bemadresse': False, 'anonym': False,
'benutzervorher': False, 'redakteur': False, 'qualifikation': u'0',
'benutzer': False}, 'stip': {'stip_konform': False, 'stip_brief': False}}

So both empty string values for  'ust' and 'kreditor' field
are turned into a numeric 0 value. Obviously a side-effect
deserialize() seems to expect strings only (which make sense).

I think my problem is that I trying a double deserialization here.
So the code in getDeformData() seems to perform some implicit
deserialization - correct?

Andreas






-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQGUBAEBAgAGBQJM/x28AAoJEADcfz7u4AZjaYALwMj1kwz9C225WfAOttAfiPyp
tJ88a2t4YzKf4TAUcHpBPlXDwEp78feH2cfuJOlUL2oZuM/wY/Wvrx5Qv/Rw5EDN
B7u0NMpnQW5FIYTktj+zQ7vALhO5VWovINALnVz40saaEp56Xm+kLiev1IPjwAa+
vL1SmGjs2JIjg236D7eQ1CMMO0Gg1MYEhaRLWpKte/iKolJnpO/2nt8I2cwXje/F
v6TDKlPxodsFy7tRDL0aLjgc525MA0u4AgiRu95sTBVwWtdGgMa22tYHveOhv8cA
ss+rsi6qMPrUZ166KSrGCyyFueNsyEHO4ESgrLQLiAQBrbHY6KDUgEFRqsbFqVVI
4Cwi9XcWjbBBQeGVzzZH94SUaBEszJ/dqpfaMseTToUJvW1WAE9zBYQkL13+fwCu
jRNcS5CWt9mphB+R06Y236RrqiPizAvkqgMb+r1Ui3deymsi43c6Puxf5QTL1dbd
TLF5UYjpeORJrx/zvX7UNSA75VO5BWE=
=CKPM
-----END PGP SIGNATURE-----

<<attachment: lists.vcf>>

_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to