ok i found the issue. 
another process accesses and processes the uploaded binaries and deletes them. 
the js upload plugin does not access the redirect url i provide the moment i 
return it so it happens that with many assets
while the js is still uploading the other process starts working on the 
entities and when the js accesses the redirect url the entity is already gone.

On Jul 18, 2011, at 6:54 PM, andreas schmid wrote:

> hi,
> 
> im having issues when i upload many (50-100) files at on a web based upload 
> queue.
> i have 2 handlers. the FileUploadHandler saves the binary, checks if its 
> saved and redirects to the
> RedirectAfterUpload which creates a json dict for the uplaod js to tell that 
> the uplaod is done.
> 
> the issue is that sometimes i get a NoneType when i try to get the asset on 
> the second handler. 
> how is this possible if i checked that it was saved in the first handler and 
> it?
> i also use entity groups and i tried different ways of getting and putting 
> the binary by key.
> sometimes i also get a redirect to temporary-blobstore-error.appspot.com 
> which is really annoying.
> 
> here the 2 handlers:
> 
> class FileUploadHandler(blobstore_handlers.BlobstoreUploadHandler):
>    def post(self, tags=None):
>        uploads = self.get_uploads()
>        if uploads:
>            binary = uploads[0]
>            bin = Binary(parent = imageapp_key,
>                                  blob = binary,
>                                  filename = binary.filename,
>                                  size    = binary.size)
>            # put the entity
>            bin.put()
>            # make a test get operation to see if the 
>            # asset is saved.
>            testget = db.get(bin.key())
>            if not testget or not bin.is_saved():
>                import logging
>                logging.warning('*********** bin is not saved!')
>                return self.error(500)
>            key = str(bin.key())
>        self.redirect('/assets/api/upload/%s.json' %key)
> 
> 
> class RedirectAfterUpload(RequestHandler):
>    def get(self, key):
>        asset = db.get(key)
>        # get the asset
>        if not asset:
>            asset = Binary.get(key)
>            # after the second get the get
>            # still returns a None
>            if not asset:
>                logging.warning('still no asset after second get')
>                return self.error(500)
>        data = dict(name = asset.filename,
>                    thumbnail = asset.serving_url,
>                    size = asset.size)
>        self.response.headers["Content-Type"] = "application/x-javascript"
>        self.response.out.write(jsonify(data))
> 
> i don't understand what it could be.
> 
> thx
> andreas

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to