Tryton - Issues

 

Issue8414

Title hashlib.md5 fails with xmlrpclib.Binary as input Type
Priority bug Status resolved
Superseder Nosy List brunnenschacht, ced, reviewbot, roundup-bot
Type crash Components trytond
Assigned To ced Keywords review
Reviews 279541002
View: 279541002

Created on 2019-06-10.10:38:53 by brunnenschacht, last changed by roundup-bot.

Messages
New changeset 2036661ebb11 by Cédric Krier in branch '4.8':
Use custom base64 unmarshaller
https://hg.tryton.org/trytond/rev/2036661ebb11

New changeset 925bae21d0cf by Cédric Krier in branch '4.6':
Use custom base64 unmarshaller
https://hg.tryton.org/trytond/rev/925bae21d0cf

New changeset 22135da4f59b by Cédric Krier in branch '4.4':
Use custom base64 unmarshaller
https://hg.tryton.org/trytond/rev/22135da4f59b
New changeset 5f03d55e6b8f by Cédric Krier in branch '5.0':
Use custom base64 unmarshaller
https://hg.tryton.org/tryton-env/rev/5f03d55e6b8f
New changeset d2e2fcab5219 by Cédric Krier in branch '5.0':
Use custom base64 unmarshaller
https://hg.tryton.org/trytond/rev/d2e2fcab5219
review279541002 updated at https://codereview.tryton.org/279541002/#ps279551002
msg50165 (view) Author: [hidden] (brunnenschacht) Date: 2019-06-10.12:17:32
thanks, the patch works.
msg50164 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-06-10.12:04:31
It should be fixed by review279541002 (issue8143 has fixed it for further releases).
msg50159 (view) Author: [hidden] (brunnenschacht) Date: 2019-06-10.10:38:52
tryton version: 5.0.7
proteus version: 5.0.3

after i try to add a new attachment to a model (with proteus). trytond shows this Traceback.

Traceback (most recent call last):
  File "/home/tryton/staging/trytond/5.0/venv/lib/python3.7/site-packages/trytond/protocols/dispatcher.py", line 176, in _dispatch                            
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/home/tryton/staging/trytond/5.0/venv/lib/python3.7/site-packages/trytond/ir/resource.py", line 96, in create                                         
    records = super(ResourceMixin, cls).create(vlist)
  File "/home/tryton/staging/trytond/5.0/venv/lib/python3.7/site-packages/trytond/model/modelsql.py", line 147, in wrapper                                    
    return func(cls, *args, **kwargs)
  File "/home/tryton/staging/trytond/5.0/venv/lib/python3.7/site-packages/trytond/model/modelsql.py", line 645, in create                                     
    field.set(cls, fname, *fargs)
  File "/home/tryton/staging/trytond/5.0/venv/lib/python3.7/site-packages/trytond/model/fields/binary.py", line 113, in set                                   
    filestore.set(value, prefix) if value else None, None]
  File "/home/tryton/staging/trytond/5.0/venv/lib/python3.7/site-packages/trytond/filestore.py", line 31, in set                                              
    id = self._id(data)
  File "/home/tryton/staging/trytond/5.0/venv/lib/python3.7/site-packages/trytond/filestore.py", line 63, in _id                                              
    return hashlib.md5(data).hexdigest()
TypeError: object supporting the buffer API required

i thing its because the data is a xmlrpclib.Binary Object. When i change the line to hashlib.md5(data.data) it works.
of course only till fp.write(data)
History
Date User Action Args
2019-06-25 23:26:11roundup-botsetmessages: + msg50398
2019-06-16 12:38:00roundup-botsetmessages: + msg50263
2019-06-16 12:37:55roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg50262
2019-06-10 12:18:48reviewbotsetnosy: + reviewbot
messages: + msg50166
2019-06-10 12:17:33brunnenschachtsetmessages: + msg50165
2019-06-10 12:04:31cedsetstatus: unread -> testing
keyword: + review
nosy: + ced
messages: + msg50164
reviews: 279541002
assignedto: ced
2019-06-10 10:38:53brunnenschachtcreate

Showing 10 items. Show all history (warning: this could be VERY long)