Search code examples
google-app-engineapp-engine-ndbblobstore

Expected BlobKey but instead I get a BlobInfo object - How to get BlobKey from BlobInfo object?


What's the best way to get a BlobKey from a BlobInfo object?

def get(self):
  blobs = BlobInfo.all()
  #something is missing here
  for blob in blobs:
    if not Content.query().filter(ndb.BlobKeyProperty("blobKey") == blob.key).count(1): #ERROR
      blob.delete()                                                    ^
                                              **how do you do make this a normal BlobKey?**



#Error
BadValueError: Expected BlobKey, got <bound method BlobInfo.key of
<google.appengine.ext.blobstore.blobstore.BlobInfo object at 0x048B87D0>>

Thanks!!


Solution

  • BlobInfo.key is a method, not a property, so call it: blob.key()