I found the bug. It was caused by the extra space after "name=", which
the SDK version of app engine ignores gracefully, but the appspot.com
version can't handle.

I wasted probably three hours tracking this bug. I love software
engineering in general, but sometimes hate my job - I think the
software engineering is the only job in the world where just an extra
space causes such a pain!

Satoshi

On Nov 3, 5:03 pm, Satoshi <[email protected]> wrote:
> I am wring an iPhone app that uploads an image to a blob via HTTP-
> POST. Everything has been working great so far.
>
> Recently, I decided to send a parameter "uuid" along with the image.
> My python code on the server side (subclass of
> blobstore_handlers.BlobstoreUploadHandler) receives this uuid (along
> with the image) correctly as long as I run it under SDK, but fails to
> receive the uuid when I deploy this app to the actual sever on
> appspot.com. Is there any known issue with this additional parameter
> to BlobstoreUploadHandler?
>
> Here is my python code:
>
> gdispatch.route(lambda: ('/blob/upload', UploadHandler))
> class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
>     @gdispatch.kwargs
>     def post(self, uuid):
>         upload_files = self.get_uploads('file')  # 'file' is file
> upload field in the form
>         blob_info = upload_files[0]
>         logging.info("/blog/upload uuid=%s" % uuid)
>         ...
>
> gdispatch.kwargs is a decorator to make those parameters accessible as
> arguments:
>
> def kwargs(original_func):
>     """ This decorator allows RequestHandlers to receive get/post
> parameters as named arguments """
>     import inspect
>     argspec = inspect.getargspec(original_func)
>     args = tuple(argspec[0][1:])
>     def decorated_func(rh):
>         kwargs = dict([(arg, rh.request.get(arg)) for arg in args])
>         return original_func(rh, **kwargs)
>     return decorated_func
>
> Here is the actually data I am posting:
>
> --somethingUniquegc0p4Jq0M2Yt08jU534c0p
> Content-Disposition: form-data; name= "uuid"
>
> 4123DD08-A663-485B-AC03-EBC62B1F46C8
> --somethingUniquegc0p4Jq0M2Yt08jU534c0p
> Content-Disposition: form-data; name="file"; filename="Library Image"
> Content-Type: image/jpeg
> {... actual image data in binary format ...}
>
> --somethingUniquegc0p4Jq0M2Yt08jU534c0p--

-- 
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.

Reply via email to