I don't need to return the values. My problem is that while I am able
to send file with a few form fields, It gives an error using many
fields:
w=upload_files[0]
IndexError: list index out of range
INFO 2011-02-13 07:43:10,884 dev_appserver_blobstore.py:328]
Upload handler returned 500
ERROR 2011-02-13 07:43:10,884 dev_appserver_blobstore.py:341]
Invalid upload handler response. Only 301, 302 and 303 statuses are
permitted and it may not have a content body.
INFO 2011-02-13 07:43:10,910 dev_appserver.py:3317] "POST /_ah/
upload/agZlcGN2ZGJyHAsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxjFAgw HTTP/1.1"
500 -
In both cases I use the same definitions:
upload_files = self.get_uploads('file')
w=upload_files[0]
On Feb 13, 9:35 am, Doug Anderson <[email protected]> wrote:
> I have to retract my previous post... this does appear to be working
> for me. I can use "self.request.get('description')" to retrieve the
> text description form field. My previous problem was that
> name='descripton' was spelled wrong in my html form (missing the last
> 'i')... doh!
>
> I think your issue is that you lose your "self.response.out.write(N)"
> content when you redirect via "return self.redirect('/')"... that
> response body content won't survive the redirect (the redirect will
> provide its own content). If you need to return the submitted N and S
> content then perhaps you could redirect to a URL that takes the 'a'
> object key as a parameter "self.redirect('/' +
> urllib.quote(a.key()))". Of course you'd have to setup your handler
> to accept the parameter... but then you could re-retrieve 'a' object
> in the handler via a datastore get such as "a = db.get(a_key)"...
> assuming 'a_key' is the name of the parameter.
>
> On Feb 13, 1:54 am, theone <[email protected]> wrote:
>
>
>
>
>
>
>
> > I think you are right about BlobstoreUploadHandler limitations. When I
> > tried something like:
> > class X(db.Model):
> > N = db.StringProperty()
> > S = db.StringProperty()
> > F = blobstore.BlobReferenceProperty()
>
> > class Upload(blobstore_handlers.BlobstoreUploadHandler):
> > def post(self):
> > upload_files = self.get_uploads('file')
> > a=upload_files[0]
> > N = self.request.get('name')
> > S = self.request.get('sname')
> > if S:
> > m=N + S
> > else:
> > m=S + N
> > self.response.out.write(N)
> > self.response.out.write(S)
> > a=X(N=m, S=S, F=a)
> > a.put()
> > return self.redirect('/')
>
> > It worked partly. I mean I put my model to datastore and file to
> > blobstore. However, it does not writes the thing like:
> > self.response.out.write(N). What I understand here we cannot use
> > everything in BlobstoreUploadHandler.
>
> > Also if you request the form fields, it does not work.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.