0001-misc-check-for-serializable-file-using-hasattr-11000.patch
tests/test_api.py | ||
---|---|---|
872 | 872 |
formdata.status = 'wf-new' |
873 | 873 |
formdata.evolution[-1].status = 'wf-new' |
874 | 874 | |
875 |
upload = PicklableUpload('test.txt', 'text/plain', 'ascii') |
|
875 |
from qommon.form import PicklableUpload as PicklableUpload2 |
|
876 |
from wcs.qommon.form import PicklableUpload as PicklableUpload3 |
|
877 |
upload = PicklableUpload2('test.txt', 'text/plain', 'ascii') |
|
876 | 878 |
upload.receive(['test']) |
877 |
formdata.workflow_data = {'blah': upload, 'xxx': 23} |
|
879 |
upload2 = PicklableUpload3('test.txt', 'text/plain', 'ascii') |
|
880 |
upload2.receive(['test']) |
|
881 |
formdata.workflow_data = {'blah': upload, 'blah2': upload2, 'xxx': 23} |
|
878 | 882 |
formdata.store() |
879 | 883 | |
880 | 884 |
resp = get_app(pub).get( |
... | ... | |
883 | 887 |
assert resp.json['workflow']['data']['blah']['filename'] == 'test.txt' |
884 | 888 |
assert resp.json['workflow']['data']['blah']['content_type'] == 'text/plain' |
885 | 889 |
assert base64.decodestring(resp.json['workflow']['data']['blah']['content']) == 'test' |
890 |
assert base64.decodestring(resp.json['workflow']['data']['blah2']['content']) == 'test' |
|
886 | 891 | |
887 | 892 |
def test_user_by_nameid(pub, local_user): |
888 | 893 |
resp = get_app(pub).get(sign_uri('/api/users/xyz/', user=local_user), |
wcs/qommon/misc.py | ||
---|---|---|
428 | 428 |
if isinstance(obj, time.struct_time): |
429 | 429 |
return datetime.datetime.utcfromtimestamp(time.mktime(obj)).isoformat() + 'Z' |
430 | 430 | |
431 |
from .form import PicklableUpload |
|
432 |
if isinstance(obj, PicklableUpload): |
|
431 |
if hasattr(obj, 'base_filename'): |
|
433 | 432 |
return { |
434 | 433 |
'filename': obj.base_filename, |
435 | 434 |
'content_type': obj.content_type or 'application/octet-stream', |
436 |
- |