[Grok-dev] Re: Using POST request
uli at gnufix.de
Fri Mar 21 13:47:49 EDT 2008
Martijn Faassen wrote:
> Note that the alternative pattern would be to use an Index view:
> class Index(grok.View):
> def render(self):
> if self.request.method == 'POST':
> It's weird though that the REST story doesn't seem to be working; I
> suspect we're missing something simple, but what?
Worse: also the view seems not to work with setup.py requests (Grok
class eggserver(grok.Application, grok.Model):
""" my content class """
def __init__(self, *args, **kw):
super(Index, self).__init__(*args, **kw)
# Just to make sure, something happened...
print "INDEX CREATED"
if self.request.method == 'POST':
elif self.request.method == 'GET':
print "Somethin else"
This should at least return _something_ in case of POST requests,
shouldn't it? For simple, malformed POST requests, this is the case::
$ telnet localhost 8080 Trying 127.0.0.1...
Connected to lo.
Escape character is '^]'.
POST /eggs HTTP/1.0
HTTP/1.1 200 OK
X-Powered-By: Zope (www.zope.org), Python (www.python.org)
Server: Twisted/2.5.0 TwistedWeb/[twisted.web2, version 0.2.0]
X-Content-Type-Warning: guessed from content
Date: Fri, 21 Mar 2008 16:51:24 GMT
Connection closed by foreign host.
It also works for GET and for browser generated POST requests of any
kind (url-encoded and multipart/form-data). But not for setup.py POST
The view object is even not created upon request, although setup.py
sends a complex but (at first glance) regular POST request. The same is
true for Andreas' ``MyREST2`` class. It is even not asked for generating
content (for GET requests it works, also for browser generated
multipart/form POST requests). What's wrong here? Maybe something
strange in the setup.py request? Anyway, the problem does not seem to be
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20080321/03c4b6ff/attachment.bin
More information about the Grok-dev