GET und POST in Formularen mit SPYCE?

Sockets, TCP/IP, (XML-)RPC und ähnliche Themen gehören in dieses Forum
Antworten
Morpheus1510
User
Beiträge: 3
Registriert: Mittwoch 2. März 2005, 10:53
Wohnort: 56179 Vallendar
Kontaktdaten:

Hallo,

ich habe ein kleines Problem mit SPYCE:

Auf Wunsch habe ich auf einem Kundenserver SPYCE installiert. Funktioniert eigentlich auch, jedoch gibt es wohl ein Problem mit der POST-Methode in Formularen. GET funktioniert einwandfrei...

Hier erstmal der Link zum Bespielscript aus der SPYCE-Doku:
http://web200.freespace4all.de/docs/exa ... etpost.spy

Die POST-Methode fabriziert folgenden Fehler:
Spyce exception
File: /var/www/web200/html/docs/examples/getpost.spy
Message: TypeError: iterable argument required

Stack: getpost.spy:27, in (main):
=request.post1('name')

/usr/share/spyce/modules/request.py:143, in post1:
self._postInit()

/usr/share/spyce/modules/request.py:112, in _postInit:
self._postfields = cgi.FieldStorage(fp=self._api.getRequest(), environ=self.env(), keep_blank_values=1)

/usr/lib/python2.3/cgi.py:442, in __init__:
if 'REQUEST_METHOD' in environ:
Da ich nicht wirklich der Python-Guru bin, hoffe ich mal, dass mir hier vielleicht jemand einen kleinen Hinweis geben kann, wo ich schrauben darf.

Falls wichtig, hier die Serverkonfig:

Debian 3.0 woody
Apache 1.3.33
mod_python 2.7.10
Python 2.4.1
SPYCE 1.3.12
Linux is like a wigwam:
no windows, no gates and an apache inside
Leonidas
Python-Forum Veteran
Beiträge: 16025
Registriert: Freitag 20. Juni 2003, 16:30
Kontaktdaten:

Ich nehme an, es liegt an einem Konfigurationsproblem beim Server, denn bei mir geht das beispiel wunderbar.
Morpheus1510 hat geschrieben:Debian 3.0 woody
Apache 1.3.33
mod_python 2.7.10
Python 2.4.1
SPYCE 1.3.12
Debian 3.1 Sarge
Apache 2.0.52
mod_python 3.1.3
Python 2.3.5
Spyce 1.3.12

Woher hast du Python 2.4.1, wenn 2.4.0 das neueste ist? CVS?
My god, it's full of CARs! | Leonidasvoice vs (former) Modvoice
Gast

Leonidas hat geschrieben: Woher hast du Python 2.4.1, wenn 2.4.0 das neueste ist? CVS?
Debian-Standardpaket aus der testing... Genaue Versionsnummer (-V): 2.4.1a0, läuft aber nur als Alternativsystem... Ansonsten läuft noch 2.3.5, hiermit entsteht allerdings der gleiche Fehler.
Leonidas
Python-Forum Veteran
Beiträge: 16025
Registriert: Freitag 20. Juni 2003, 16:30
Kontaktdaten:

Versuch nochmal das Beispiel aus der aktuellen Spyce Doku mit copy & paste nochmal zu kopieren...
My god, it's full of CARs! | Leonidasvoice vs (former) Modvoice
Morpheus1510
User
Beiträge: 3
Registriert: Mittwoch 2. März 2005, 10:53
Wohnort: 56179 Vallendar
Kontaktdaten:

Ups... da hatte ich wohl vergessen, mich einzuloggen ;-)
Also... Beispiel nochmal neu kopiert, keine Änderung. Ich denke, ich werde im Laufe des Tages mal SPYCE 1.3.13 auf den Server packen und dann sehen wir mal weiter...
Linux is like a wigwam:
no windows, no gates and an apache inside
fs111
User
Beiträge: 170
Registriert: Samstag 15. November 2003, 11:42
Kontaktdaten:

Die request-Klasse unterstützt auch __getitem__, due kannst also auch request['foo'] machen. Der guckt in den POST und GET-Variablen nach, muss also nie angepasst werden, wenn man mal was von POST auf GET umstellt.

fs111
Pydoc-Integration in vim - Feedback willkommen: http://www.vim.org/scripts/script.php?script_id=910
Morpheus1510
User
Beiträge: 3
Registriert: Mittwoch 2. März 2005, 10:53
Wohnort: 56179 Vallendar
Kontaktdaten:

Hallo,

auch nach einem Update auf 3.1.13 gab es keine Besserung meines Problems. Allerdings bin ich hartnäckig und hab die Lösung gefunden. Für alle, die vielleicht mal vor demselben Problem stehen:

Der Fehler liegt in 'spyceUtil.py', dort muss folgender Block geändert werden

Code: Alles auswählen

###############################################
# Return hashtable value, or entire hashtable
#

def extractValue(hash, key, default=None):
  """Extract value from dictionary, if it exists. 
  If key is none, return entire dictionary"""
  if key==None: return hash
  if hash.has_key(key): return hash[key]
  return default

###############################################
muss so aussehen:

Code: Alles auswählen

###############################################
# Return hashtable value, or entire hashtable
#

def extractValue(hash, key, default=None):
  """Extract value from dictionary, if it exists.
  If key is none, return entire dictionary"""
  if key==None:
    if isinstance(hash, dict): return hash
    else: return dict(hash)
  if hash.has_key(key): return hash[key]
  return default

###############################################
Funktioniert bestens :-)
Linux is like a wigwam:
no windows, no gates and an apache inside
Antworten