google app engine - Using Blobstore Python API over HTTPS generates 405 error when redirecting back -
don't know if it's i'm doing wrong or if there's bug (i think so, seen others having same problem) in blobstore.create_upload_url
method.
in app.yaml have url's property secure: always
, action
attribute of form
element starts https://
when it's return api it's redirected non-https.
there's bug file on google app engine issue tracker no response google.
does know of work around? current solution have separate .py file handle response , direct original url on https.
edit
i use set action attribute:
from google.appengine.api import blobstore view['upload_url'] = blobstore.create_upload_url ## pass view dict template , in template <form action="{{ upload_url }}" enctype="multipart/form-data" method="post"> </form>
the output in html looks like:
action="https://appid.appspot.com/_ah/upload/ammfu6bca9sfz5isqw6pnnb8xzry2ruolams2gfjfpewcz-vg9m_hqtor87wydnmo7zibqx9ninjorftikauolmhrpxvpf6r8y5963gd9cbv_9gikgtemtdvt5vcvqxzvbegqg3v5xqt/albnuayaaaaatpdfcxxacfrqnuilxwx61vimdz7f0alf/"
the file uploads (i can view in admin console->blob viewer) when api redirect redirects http , when using secure: always
http request returns http 405 error.
this upload handler:
class addupdateimagestore(blobstore_handlers.blobstoreuploadhandler): def post(self): if self.request.get('imagestore_key'): image = dbimagestore.imagestore.get(self.request.get('imagestore_key')) else: image = dbimagestore.imagestore() image.name = self.request.get('image_name') upload_files = self.get_uploads('image_file') if upload_files: image.imageurl = images.get_serving_url(str(upload_files[0].key())) imagekey = db.put(image) language in settings.languages: description = self.request.get('image_description_' + language) if description: imagedescription = dbimagestore.imagedescription.gql('where imageentry = :imageentry , lang = :lang', imageentry = imagekey, lang = language).get() if imagedescription none: imagedescription = dbimagestore.imagedescription() imagedescription.imageentry = imagekey imagedescription.lang = language imagedescription.description = description db.put(imagedescription) self.redirect('/edit/imagestore/?status=1&message=image added/updated')
this issue has been fixed sdk 1.4.2. tested , working fine now.
see issue in tracker here: http://code.google.com/p/googleappengine/issues/detail?id=3463
Comments
Post a Comment