How web2py work with blob

40 views
Skip to first unread message

Константин Комков

unread,
Oct 17, 2019, 4:15:25 AM10/17/19
to web2py-users
In my table I have Field('GRAPH'). In database (firebird 2.5) type if this field is BLOB. But if in tables.py I indicate that field as blob then web2py return error:

<class 'binascii.Error'> Invalid base64-encoded string: number of data characters (17) cannot be 1 more than a multiple of 4

Версия

web2py™Version 2.18.5-stable+timestamp.2019.04.08.04.22.03
PythonPython 3.7.3: C:\Python\python.exe (prefix: C:\Python)

Error snapshot help

Error(Invalid base64-encoded string: number of data characters (17) cannot be 1 more than a multiple of 4)

Function argument list

(s=b'\x01\x00\x00\x00\x03\x00\x00\x00\x00\xc0W\xe5@...0\x00\x00`\x7f\xe5@\x00\x00\x00\x00\x00\x85\xe5@', altchars=None, validate=False)

Code listing
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
        altchars = _bytes_from_decode_data(altchars)
assert len(altchars) == 2, repr(altchars)
s = s.translate(bytes.maketrans(altchars, b'+/'))
if validate and not re.match(b'^[A-Za-z0-9+/]*={0,2}$', s):
raise binascii.Error('Non-base64 digit found')
return binascii.a2b_base64(s)


def standard_b64encode(s):
"""Encode bytes-like object s using the standard Base64 alphabet.
Variables
global binascii<module 'binascii' (built-in)>
binascii.a2b_base64<built-in function a2b_base64>
sb'\x01\x00\x00\x00\x03\x00\x00\x00\x00\xc0W\xe5@...0\x00\x00`\x7f\xe5@\x00\x00\x00\x00\x00\x85\xe5@'
It's not problem because if I not indicate type for that field I can do my query. It's interesting why web2py reading base64 string, because blob is not always base64.
Reply all
Reply to author
Forward
0 new messages