Reputation: 684
If I call
blobsotre.BlobInfo.properties()
the function return
set(['filename', 'creation', 'content_type', 'md5_hash', 'size'])
but if I call
a = blobstore.BlobInfo.all()
obj = a.fetch(1)[0]
print obj.md5_hash
the function raise exception
AttributeError(name) AttributeError: md5_hash
What is md5_hash property of BlobInfo object intended for? P.S. I want to check what uploaded file is not exist into Blobstore.
Upvotes: 1
Views: 616
Reputation: 21
You probably have BlobInfo objects that don't have an md5_hash written including the first result returned by blobstore.BlobInfo.all()
You can check easily in your dev server's interactive console:
from google.appengine.ext import blobstore
query1 = blobstore.BlobInfo.all()
query2 = blobstore.BlobInfo.gql("WHERE md5_hash != ''")
print query1.count(), query2.count()
# for me this returns '100 85'
Upvotes: 1
Reputation: 101149
The code you show works fine for me, on shell.appspot.com:
>>> from google.appengine.ext import blobstore
>>> blobstore.BlobInfo.properties()
set(['filename', 'creation', 'content_type', 'md5_hash', 'size'])
>>> o = blobstore.BlobInfo.all().get()
>>> o.md5_hash
u'5d41402abc4b2a76b9719d911017c592'
You must be doing something different to what's in your sample code. Can you paste your exact code, and the complete stacktrace?
Upvotes: 1
Reputation: 3956
A cryptographic hash function can be used for many things:
The "intended" use of course depends on what application the blobstore is supporting - are you building a shopping cart, or a data cache, or a map-reduce processing application, or what?
Upvotes: 1