Opened 10 years ago

Closed 10 years ago

#935 closed defect (fixed)

Raw Image gets unicodedecodeerror on logging debug data

Reported by: Odin Hørthe Omdal (Velmont) Owned by:
Priority: major Milestone:
Component: programming Keywords: exception
Cc: Christopher Allan Webber, Elrond Parent Tickets:

Description

Forgot to encode to utf-8 first.

Have patch.

Attachments (2)

0001-Raw-image-mediatype-has-a-logging-call-not-encoding-.patch (1.3 KB ) - added by Odin Hørthe Omdal (Velmont) 10 years ago.
0001-Raw-image-mediatype-had-a-non-unicode-logging-call.patch (1.2 KB ) - added by Odin Hørthe Omdal (Velmont) 10 years ago.

Download all attachments as: .zip

Change History (8)

by Odin Hørthe Omdal (Velmont), 10 years ago

comment:1 by Christopher Allan Webber, 10 years ago

Hm. I think this may be backwards! Encoding to utf-8 means encoding to a bytestring, which it looks like yeah, the parent is also a bytestring in python2, so not surprising this is happening.

However, I think it might be better if we did the reverse... instead,

'Wrote new file from {0} to preview (jpg) {1}' should become u'Wrote new file from {0} to preview (jpg) {1}'

In that case, I don't think you need to encode (if anything, maybe decode, but you shouldn't decode something if it's already unicode, which it looks like this probably is?)

Could you test that and see if it works? If so, I'd be happy to merge this in.

comment:2 by Odin Hørthe Omdal (Velmont), 10 years ago

lol, true.

I am in Python 3 land myself, unicode is simpler there :) Of course you're very right. I'll change, test and upload. :)

by Odin Hørthe Omdal (Velmont), 10 years ago

comment:3 by Odin Hørthe Omdal (Velmont), 10 years ago

Don't know how to delete the old patch, -- since I changed the name on this new one.

comment:4 by ShawnRisk, 10 years ago

Owner: Odin Hørthe Omdal (Velmont) removed
Status: newreview

This should always be put in review if there is patch added to the ticket and this needs to be checked by others.

comment:5 by Odin Hørthe Omdal (Velmont), 10 years ago

This really is more or less reviewed, since I did just what Chris said :)

Also have the commit on-web (not in its own branch, but on my own patch-list that I rebase on top of upstream/master):

https://github.com/Velmont/mediagoblin/commit/6907027ec1a9d24d9dd7fc8c1816782ab9cc00a2

comment:6 by Christopher Allan Webber, 10 years ago

Resolution: fixed
Status: reviewclosed

Merged, rebased, pushed. Thank you!

Note: See TracTickets for help on using tickets.