allow serialization of dal.py/DAL
This commit is contained in:
+10
-1
@@ -14,7 +14,7 @@ from pydal import DAL as pyDAL
|
|||||||
from pydal import Field
|
from pydal import Field
|
||||||
from pydal.objects import Row, Rows, Table, Query, Expression
|
from pydal.objects import Row, Rows, Table, Query, Expression
|
||||||
from pydal import SQLCustomType, geoPoint, geoLine, geoPolygon
|
from pydal import SQLCustomType, geoPoint, geoLine, geoPolygon
|
||||||
|
import copy_reg as copyreg
|
||||||
|
|
||||||
def _default_validators(db, field):
|
def _default_validators(db, field):
|
||||||
"""
|
"""
|
||||||
@@ -97,6 +97,15 @@ class DAL(pyDAL):
|
|||||||
Field = Field
|
Field = Field
|
||||||
Table = Table
|
Table = Table
|
||||||
|
|
||||||
|
def DAL_unpickler(db_uid):
|
||||||
|
return DAL('<zombie>', db_uid=db_uid)
|
||||||
|
|
||||||
|
|
||||||
|
def DAL_pickler(db):
|
||||||
|
return DAL_unpickler, (db._db_uid,)
|
||||||
|
|
||||||
|
copyreg.pickle(DAL, DAL_pickler, DAL_unpickler)
|
||||||
|
|
||||||
#: add web2py contrib drivers to pyDAL
|
#: add web2py contrib drivers to pyDAL
|
||||||
from pydal.drivers import DRIVERS
|
from pydal.drivers import DRIVERS
|
||||||
if not DRIVERS.get('pymysql'):
|
if not DRIVERS.get('pymysql'):
|
||||||
|
|||||||
+1
-1
Submodule gluon/packages/dal updated: 2554dac7a4...f816d26b6a
Reference in New Issue
Block a user