[reportlab-users] Appengine - Reportlab (Get Photo from Model)

Martinho Arantes martinhoarantes at gmail.com
Tue Oct 5 05:51:24 EDT 2010


I could already make it.
Thanks to user Saxon Druce<http://stackoverflow.com/users/148241/saxon-druce>
from StackOverflow.com

My code was incomplete. Didn´t read the AppEngine function to resize images,
so as Saxon suggested i changed my code to

if self.request.get('photo'):
photo = images.resize(self.request.get('photo '), 40,
40,images.JPEG
)
user.photo = db.Blob(photo )

*instead of:*

if self.request.get('photo'):
photo = images.resize(self.request.get('photo '), 40, 40)
user.photo = db.Blob(photo )

What Google AppEngine was doing, was converting the image to PNG instead of
JPG.

*Note:* You can see this thread
http://stackoverflow.com/questions/3798885/appengine-reportlab-get-photo-from-model
.
Maybe it´ll help others.



2010/10/5 Robin Becker <robin at reportlab.com>


> On 05/10/2010 08:51, Martinho Arantes wrote:

> ...........

>

>

>> First, open up reportlab/lib/utils.py, and go to the rl_isdir() function,

>> starting on line 463. This function depends on some internals of the

>> Python

>> classloader that aren't available on App Engine, so we need to change it.

>> Comment out the last line, line 469, and in its place, insert "return

>> False".

>>

>> Next, look at the _isPILImage() function, starting on line 520. Line 523

>> reads "except ImportError:". Change this to read "except AttributeError:".

>>

>> .........

> is there a standard way to determine that we're running as part of

> appengine? I looked quickly, but I don't see a sys.platform that corresponds

> mentioned.

> --

> Robin Becker

>

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20101005/5b7ff830/attachment.htm>


More information about the reportlab-users mailing list