parse_blob override in 2.19.01

11 views
Skip to first unread message

DenesL

unread,
Apr 28, 2020, 5:00:46 PM4/28/20
to web2py-users
Hi all


web2py uses b64encode/decode to store/retrieve data in blobs. Legacy tables probably do not do it.

You need you make your own custom adapter to override a method. For example for PostgreSQL:

from gluon.dal import ADAPTERS, UseDatabaseStoredFile,PostgreSQLAdapter
class MyPostgresAdapter(PostgreSQLAdapter):
     drivers = ('psycopg2',)
     def parse_blob(self, value, field_type): return value

ADAPTERS['mypostgres'] = MyPostgresAdapter

db = DAL('mypostgres://.....')

Is this still possible with web2py 2.19.01?

Thanks,
Denes
Reply all
Reply to author
Forward
0 new messages