DAL.validators_method become a bound method, requires dal instance as first parameter
This commit is contained in:
+1
-2
@@ -4,7 +4,7 @@ from pydal import DAL as pyDAL
|
|||||||
from pydal import Field, SQLCustomType, geoPoint, geoLine, geoPolygon
|
from pydal import Field, SQLCustomType, geoPoint, geoLine, geoPolygon
|
||||||
|
|
||||||
|
|
||||||
def _default_validators(field):
|
def _default_validators(db, field):
|
||||||
"""
|
"""
|
||||||
Field type validation, using web2py's validators mechanism.
|
Field type validation, using web2py's validators mechanism.
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ def _default_validators(field):
|
|||||||
fieldtype
|
fieldtype
|
||||||
"""
|
"""
|
||||||
from gluon import validators
|
from gluon import validators
|
||||||
db = field.db
|
|
||||||
field_type, field_length = field.type, field.length
|
field_type, field_length = field.type, field.length
|
||||||
requires = []
|
requires = []
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1127,7 +1127,8 @@ class SQLFORM(FORM):
|
|||||||
extra_field.table = table
|
extra_field.table = table
|
||||||
extra_field.tablename = table._tablename
|
extra_field.tablename = table._tablename
|
||||||
if extra_field.requires == DEFAULT:
|
if extra_field.requires == DEFAULT:
|
||||||
extra_field.requires = _default_validators(extra_field)
|
extra_field.requires = _default_validators(table._db,
|
||||||
|
extra_field)
|
||||||
|
|
||||||
for fieldname in self.fields:
|
for fieldname in self.fields:
|
||||||
if fieldname.find('.') >= 0:
|
if fieldname.find('.') >= 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user