Why are auto-validators disabled for the NullAdapter

89 views
Skip to first unread message

Anthony

unread,
Sep 12, 2017, 11:38:48 AM9/12/17
to web2py-d...@googlegroups.com
Does anyone know the rationale behind this commit: https://github.com/web2py/pydal/commit/85c530cc791e2aadbbbf6302b2f58d354d9800b5#diff-a33dc1ac8056c1c5491b348ba746ecba?

The problem is that SQLFORM.factory creates a dummy table via DAL(None), and as a result, none of the fields end up getting their default validators.

Can we revert that commit, or do we need to come up with an alternative solution specifically for SQLFORM.factory (see https://groups.google.com/d/msg/web2py/V1-w2bIu2PE/qwpfTthiAwAJ for a start)?

Also, should we consider DAL(None) to be part of the public API of the DAL? If so, then I would say the above commit breaks backward compatibility.

Anthony

Leonel Câmara

unread,
Sep 13, 2017, 1:57:10 PM9/13/17
to web2py-developers
I'm guessing this was for compatibility reasons with any framework using pyDAL, my guess is that we should fix this in SQLFORM.factory.

Anthony

unread,
Sep 13, 2017, 7:13:49 PM9/13/17
to web2py-developers
On Wednesday, September 13, 2017 at 1:57:10 PM UTC-4, Leonel Câmara wrote:
I'm guessing this was for compatibility reasons with any framework using pyDAL, my guess is that we should fix this in SQLFORM.factory.

I don't think that would be the reason because there is already a "validators_method" class attribute that defaults to None, so there would be no reason to override it with an instance attribute (web2py itself makes use of the class attribute by overriding the default). Also, the instance attribute is set only for the NullAdapter, not all adapters.

Maybe Giovanni can weigh in. I would lean toward reverting that change, unless there is a reason for it. Otherwise, I suppose we can just fix it within SQLFORM.factory (which I think is the only place in web2py that uses DAL(None) anyway).

Anthony

Anthony

unread,
Sep 14, 2017, 9:31:56 PM9/14/17
to web2py-developers
Anyone? Giovanni? Massimo?

Massimo DiPierro

unread,
Sep 14, 2017, 11:03:11 PM9/14/17
to web2py-d...@googlegroups.com
Will look asap.

--
-- mail from:GoogleGroups "web2py-developers" mailing list
make speech: web2py-d...@googlegroups.com
unsubscribe: web2py-develop...@googlegroups.com
details : http://groups.google.com/group/web2py-developers
the project: http://code.google.com/p/web2py/
official : http://www.web2py.com/
---
You received this message because you are subscribed to the Google Groups "web2py-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Massimo DiPierro

unread,
Sep 17, 2017, 9:28:16 AM9/17/17
to web2py-d...@googlegroups.com, Giovanni Barillari
I agree that commit is wrong. DAL(None) should continue to be supported and Fields should have default validators else we are breaking backward compatibility. I also do not not understand the rationale behind that commit..
@gi0baro, can you propose a fix that would restore backward compatibility or shall I do it?

Massimo

On Sep 12, 2017, at 10:38 AM, Anthony <abas...@gmail.com> wrote:

Does anyone know the rationale behind this commit: https://github.com/web2py/pydal/commit/85c530cc791e2aadbbbf6302b2f58d354d9800b5#diff-a33dc1ac8056c1c5491b348ba746ecba?

The problem is that SQLFORM.factory creates a dummy table via DAL(None), and as a result, none of the fields end up getting their default validators.

Can we revert that commit, or do we need to come up with an alternative solution specifically for SQLFORM.factory?


Also, should we consider DAL(None) to be part of the public API of the DAL? If so, then I would say the above commit breaks backward compatibility.

Anthony

Giovanni Barillari

unread,
Sep 18, 2017, 4:51:36 AM9/18/17
to web2py-developers
Will look at it later today. Right now I can't remember the rationale behind that commit.

/Giovanni

Giovanni Barillari

unread,
Sep 18, 2017, 11:33:35 AM9/18/17
to web2py-developers
@Massimo: I can't figure out what was the rationale behind it. It was a long time ago to remember. I can remove that two lines and you can check if everything works.

/Giovanni

Massimo DiPierro

unread,
Sep 18, 2017, 12:26:44 PM9/18/17
to web2py-d...@googlegroups.com
ok. Please send me a patch and I will test both.
Reply all
Reply to author
Forward
0 new messages