Zope stdin
Janez Jere
janez.jere at void.si
Mon Mar 11 09:17:44 EST 2002
Are you sure? My echo is not working properly in ZCGI.
BTW, I dont want to run a separate process, i just want to read()
posted data AS in CGI.
Janez
# CGI script and test
import sys, os
if len(sys.argv) == 1:
print 'Content-Type: text/plain'
print
#length = os.environ['CONTENT_LENGTH']
#print 'length', length
print repr(sys.stdin.read())#int(length)))
else:
# test echo
url = sys.argv[1]
import urllib2 as w
x= w.urlopen(url, 'abc '*300)
print 'read(%s):\n' % url, x.read()
On Sun, 10 Mar 2002 23:51:44 GMT, Darrell <dgallion1 at yahoo.com> wrote:
>http://www.zope.org/Members/haqa/ZCGI
>
>Janez Jere wrote:
>
>> HHi,
>> could anyone help me port my simple cgi to zope script. Problem which I
>> am unable to solve is reading posted raw data (legacy client posts a xml
>> document to my cgi and expects a result).
>>
>> Among all my attempts the closest solutions are:
>> request.get(BODY) # BODYFILE a
>> and
>> request.stdin.read() # but it is not allowed to access read method.
>>
>> #echo cgi
>> import sys, os
>> length = os.environ['CONTENT_LENGTH']
>> print 'Content-Type: text/plain'
>> print
>> print sys.stdin.read(int(length))
>>
>> Thank for help.
>> Janez
More information about the Python-list
mailing list