Working on PDF service (HELP!)

25 views
Skip to first unread message

Max

unread,
Mar 27, 2012, 9:05:25 AM3/27/12
to google-a...@googlegroups.com
Hi,
I'm trying to develop a service where I get a pdf from an email and I store it in the blobstore as a png.
The code is not working, but I have no error logs. I can't understand why.
The logic is:
I get the email -> Conversion from PDF to PNG -> Store in the blobstore (and in a database to work with the files).
Where is the problem with the code? Someone could help me?
I mixed my knowledge with the Appengine guide.

class LogSenderHandler(InboundMailHandler):
    def receive(self, mail_message):
        for elemento in mail_message.attachments:
            asset = conversion.Asset("application/pdf", str(elemento[1]), "test.pdf")
            conversion_obj = conversion.Conversion(asset, "image/png")
            result = conversion.convert(conversion_obj)
            if result.assets:
                for asset in result.assets:
                    file_name = files.blobstore.create(mime_type='application/octet-stream')
                    with files.open(file_name, 'a') as f:
                        f.write(asset)
                    files.finalize(file_name)
                    blob_key = files.blobstore.get_blob_key(file_name)
                    fax = FAX()
                    fax.link = blob_key
                    fax.Tlink = images.get_serving_url(fax.link, 94)
                    fax.Glink = images.get_serving_url(fax.link, 800)
                    fax.put()
Reply all
Reply to author
Forward
0 new messages