omgwtfgames / appengine-rest-server

REST server for Google App Engine applications.
Other
0 stars 0 forks source link

Uploading images to BlobInfo #78

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When sending image files via REST as a BlobProperty (using POST 
"/MyModel/<key>/<blobProperty>/content), I get a following error:

  File &quot;/home/mojmir/google_appengine/lib/webapp2-2.5.2/webapp2.py&quot;, line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File &quot;/home/mojmir/google_appengine/lib/webapp2-2.5.2/webapp2.py&quot;, line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File &quot;/home/mojmir/google_appengine/lib/webapp2-2.5.2/webapp2.py&quot;, line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File &quot;/home/mojmir/google_appengine/lib/webapp2-2.5.2/webapp2.py&quot;, line 1102, in __call__
    return handler.dispatch()
  File &quot;/home/mojmir/google_appengine/lib/webapp2-2.5.2/webapp2.py&quot;, line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File &quot;/home/mojmir/projects/appengine/rest/__init__.py&quot;, line 2840, in handle_exception
    super(Dispatcher, self).handle_exception(exception, debug_mode)
  File &quot;/home/mojmir/google_appengine/lib/webapp2-2.5.2/webapp2.py&quot;, line 570, in dispatch
    return method(*args, **kwargs)
  File &quot;/home/mojmir/projects/appengine/rest/__init__.py&quot;, line 2262, in post
    self.post_impl()
  File &quot;/home/mojmir/projects/appengine/rest/__init__.py&quot;, line 2281, in post_impl
    self.update_impl(path, model_name, model_key, &quot;POST&quot;, False)
  File &quot;/home/mojmir/projects/appengine/rest/__init__.py&quot;, line 2307, in update_impl
    prop_handler.value_from_request(self, model, path)
  File &quot;/home/mojmir/projects/appengine/rest/__init__.py&quot;, line 734, in value_from_request
    dispatcher.request.body_file.getvalue())
AttributeError: 'LimitedLengthFile' object has no attribute 'getvalue'

Normaly, dispatcher.request.body_file is cStringIO.StringI object, but for some 
reason, it becomes LimitedLengthFile. I hacked it by replacing getvalue() 
method with read() method and it seems to be working now.

Original issue reported on code.google.com by mojmir.v...@gmail.com on 25 Jun 2013 at 3:25

GoogleCodeExporter commented 9 years ago
I have experienced the same problem, and fixed it the same way.  Specifically, 
I noticed this error when trying to add a single value to an indexed 
StringListProperty.

Original comment by JeremyEBlum on 9 Jul 2013 at 9:08