uo
unread,Jun 3, 2010, 11:16:48 AM6/3/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google App Engine
Hello people,
I'm developing an app on GAE using Django and I run into a
problem. I'm trying to return json to the front end and the serializer
is trying to serialize binary content in the form of a PNG,
consequently I get this error:
Traceback: File "/media/disk/Projex/propertyPortal/prop/views/item.py"
in json 42. return HttpResponse(simplejson.dumps({"items":[to_dict(i)
for i in Item.all()]}), mimetype='application/json') File "/usr/lib/
python2.6/json/init.py" in dumps 230. return
_default_encoder.encode(obj) File "/usr/lib/python2.6/json/encoder.py"
in encode 367. chunks = list(self.iterencode(o)) File "/usr/lib/
python2.6/json/encoder.py" in _iterencode 309. for chunk in
self._iterencode_dict(o, markers): File "/usr/lib/python2.6/json/
encoder.py" in _iterencode_dict 275. for chunk in
self._iterencode(value, markers): File "/usr/lib/python2.6/json/
encoder.py" in _iterencode 306. for chunk in self._iterencode_list(o,
markers): File "/usr/lib/python2.6/json/encoder.py" in
_iterencode_list 204. for chunk in self._iterencode(value, markers):
File "/usr/lib/python2.6/json/encoder.py" in _iterencode 309. for
chunk in self._iterencode_dict(o, markers): File "/usr/lib/python2.6/
json/encoder.py" in _iterencode_dict 275. for chunk in
self._iterencode(value, markers): File "/usr/lib/python2.6/json/
encoder.py" in _iterencode 294. yield encoder(o) File "/usr/lib/
python2.6/json/encoder.py" in py_encode_basestring_ascii 63. s =
s.decode('utf-8') File "/usr/lib/python2.6/encodings/utf_8.py" in
decode 16. return codecs.utf_8_decode(input, errors, True)
Exception Type: UnicodeDecodeError at /property/json/ Exception Value:
'utf8' codec can't decode byte 0x89 in position 0: unexpected code
byte
my model:
class Item(db.Model): owner = db.UserProperty() title =
db.StringProperty(multiline=True) price = db.StringProperty()
primaryImage = db.BlobProperty()
My question is how can I exclude the image from being serialized to
json? Please help . Thanks