预期的BlobKey,但我得到一个BlobInfo对象 - 如何从BlobInfo对象获取BlobKey?

时间:2014-06-04 18:50:31

标签: google-app-engine app-engine-ndb blobstore

从BlobInfo对象获取BlobKey的最佳方法是什么?

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>>

谢谢!

1 个答案:

答案 0 :(得分:1)

BlobInfo.key是一个方法,而不是属性,所以请调用它:blob.key()