开发者

nosegae blobstore support?

开发者 https://www.devze.com 2023-01-30 01:40 出处:网络
im trying to find out if nosegae supports the blobstore for tests like it does for the datastore. im having troubles to test a blobstore upload. does anyone know more about it?

im trying to find out if nosegae supports the blobstore for tests like it does for the datastore. im having troubles to test a blobstore upload. does anyone know more about it?

thank you.

edit:

blob is a BlobReferenceProperty()

right now im having some issues. probably because im missing something. if i try to add an entity with a blob like this:

e = entity(title=title, blob=open('/path/to/image.jpg').read())
e.put()

i get a

   File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore_types.py", line 113, in ValidateString
    if len(value.encode('utf-8')) > max_len:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)

if i use

...
 blob=open('/path/to/image.jpg', 'r')
...

the result is:

File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/blobstore/blobstore.py", line 429, in 开发者_如何转开发get_value_for_datastore
    return blob_info.key()
AttributeError: 'file' object has no attribute 'key'

then if i use webtest.TestApp try to use an uplaod url like '/_ah/upload/....' i get a 404. i guess because my app doesnt cover the '/_ah/upload/...' urls.

any hints?


It should do - NoseGAE simply uses the dev_appserver's code to set up the environment identically.

0

精彩评论

暂无评论...
验证码 换一张
取 消