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

余生颓废 提交于 2019-12-25 07:30:06

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/24045315/expected-blobkey-but-instead-i-get-a-blobinfo-object-how-to-get-blobkey-from-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!