-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
required=True breaks design symmetry with tw2.core #10
Comments
Hello, It seems I put this problem and I don't understand it. The 'required' is set according to the DB. If I can help to fix this issue, tell me. Aurélien |
Hi, Say you are using DbSingleSelectField directly - and not using SingleSelectField(validator=twc.Required) I think we should carry that model into DbSingleSelectField. In fact, I Paul On Tue, Jul 31, 2012 at 11:22 PM, LeResKP <
|
I've just realised this has introduced a more serious bug. All the DbSelect* fields become required by default. This is because they inhertit from tw2.forms.FormField, which defines a "required" property. This does need fixing quite urgently - it's broken an app of mine here. |
Sorry I'm late at chiming into this.. I had some family issue to attend to for a few weeks. @paj28, do you have a solution in your repos? I could start in on a fix now, but I don't want to duplicate your work (or worse) come up with a third competing, unmergable strategy. |
Hi, No worries Ralph, hope everything is ok now. I have hacked at it a little, but nothing ready to commit. Basically the Paul On Fri, Aug 17, 2012 at 3:10 PM, Ralph Bean [email protected]:
|
I think some of the tests were modified in pull request #6. You can probably modify/remove the tests that were modified/added there. That might make the work a little easier. |
I can make the updates if you want, my vacations are finished.... But one thing was not clear to me: If the field is not nullable in the DB and the user doesn't pass a validator, you are ok that we set the validator as twc.Required? Aurélien |
Hi, Yes, that's exactly what it should do. tw2.core has specific support for Paul On Mon, Aug 20, 2012 at 1:14 PM, LeResKP [email protected] wrote:
|
Hello, I had removed the required parameters: For the one to one relation, it's hard to remove it since it uses AutoEditFieldSet which inherit from AutoContainer. I don't know why but the validator twc.Required I pass is lost. It seems it's updated on the fly in tw2.core.widget with the post_define functions... I see you want to remove the RelatedOneToOneValidator and RelatedItemValidator but I'm not sure it's a good idea since we need to validate the following cases: Example for RelatedOneToOneValidator: class Account(Base): class User(Base): When we add a User we need an Account. Since nothing was required in Account, we need to validate that we have at least one value to make sure we will create the Account object. If it's not the case we will have an IntegrityError since account_id will be None. For RelatedItemValidator: Aurélien |
Hi, That looks good to me, and it solves the problem I had of all the fields
I'm not sure I completely understand this, but if you need it, fair enough.
Paul |
Hello,
Cool. Do you want I create a pull request to toscawidgets?
I just tried to remove RelatedItemValidator but now I remember why I created this validator. In this case: But If I pass an incorrect value (not in the DB) the ListLengthValidator doesn't raise an exception since we have a value, and RelatedValidator will remove this incorrect value without raising an exception (twc.safe_validate is used for the item_validator). So I need a validator which only count the validated values in case the user has tampered the form... Aurélien |
Hi, The change I merged is good to go on the mainline repo. There is one further change I'd like to make, but it's just a minor tidy Paul On Wed, Sep 5, 2012 at 4:59 PM, Ralph Bean [email protected] wrote:
|
Hum, I'm getting an infinite recursion error when I try to run the tests on the develop branch of your repo. Note -> if you issue a pull request against the main toscawidgets repo, the Travis Bot should automatically run the tests and report on the pull request ticket. :) |
From a bisect it looks like the infinite recursion error is caused by commit b8877bb (when working with toscawidgets/tw2.core@3288a59029 and toscawidgets/tw2.forms@0578d04e9) |
@ralphbean, I think the infinite recursion error is caused because reserved_names in @toscawidgets/tw2core3288a59 tw2.core.widgets does not include 'partial_parent'. See paj28/tw2.core@7f30e5fa where it looks like partial_parent was introduced. |
@paj28 and I have been corresponding about this over the mailing list. Creating a ticket here so that it gets fixed at some point.
I think this was introduced in Pull Request #6.
The text was updated successfully, but these errors were encountered: