Magritte Validation Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Magritte Validation Question

Udo Schneider
Hi,

I have a question regarding Magritte Validation. Given the following
description

descriptionAcquireRetryDelay
        ^ MANumberDescription new
                selectorAccessor: #acquireRetryDelay
                label: 'Aquire Retry Delay';
                group: 'C3P0';
                priority: 100;
                beRequired;
                beInteger;
                bePositive;
                yourself

I do have a problem if the user enters a non-number. This is IMHO caused
by #bePositive which checks if a given number is positive by sending
#positive.

However if the user enters "aaa" the object being validated is the
String ... which does not understand #positive.

If I remove the #bePositive condition everything is find and I do get
(expected) Validation Errors complaining about invalid input and
non-integer.

So I'm wondering if I need to somehow specify to check the #bePositive
condition (or any other condition for this case) only /after/ the
correct type has been validated/determined.

Any pointers?

CU,

Udo


Reply | Threaded
Open this post in threaded view
|

Re: Magritte Validation Question

Udo Schneider
After digging a bit more I think the following patch fixes the issue ...
not sure if it breaks anything else though:

MAKindError>>#isResumable
        ^ false

CU,

Udo



Udo Schneider schrieb:

> Hi,
>
> I have a question regarding Magritte Validation. Given the following
> description
>
> descriptionAcquireRetryDelay
>     ^ MANumberDescription new
>         selectorAccessor: #acquireRetryDelay
>         label: 'Aquire Retry Delay';
>         group: 'C3P0';
>         priority: 100;
>         beRequired;
>         beInteger;
>         bePositive;
>         yourself
>
> I do have a problem if the user enters a non-number. This is IMHO caused
> by #bePositive which checks if a given number is positive by sending
> #positive.
>
> However if the user enters "aaa" the object being validated is the
> String ... which does not understand #positive.
>
> If I remove the #bePositive condition everything is find and I do get
> (expected) Validation Errors complaining about invalid input and
> non-integer.
>
> So I'm wondering if I need to somehow specify to check the #bePositive
> condition (or any other condition for this case) only /after/ the
> correct type has been validated/determined.
>
> Any pointers?
>
> CU,
>
> Udo
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Re: Magritte Validation Question

Lukas Renggli
Looks like you've discovered yet another bug in exception handling.

I am looking into removing these resumable exceptions now. We should
not need to use them. That's too tricky.

Lukas



2009/11/5 Udo Schneider <[hidden email]>:

> After digging a bit more I think the following patch fixes the issue ... not
> sure if it breaks anything else though:
>
> MAKindError>>#isResumable
>        ^ false
>
> CU,
>
> Udo
>
>
>
> Udo Schneider schrieb:
>>
>> Hi,
>>
>> I have a question regarding Magritte Validation. Given the following
>> description
>>
>> descriptionAcquireRetryDelay
>>    ^ MANumberDescription new
>>        selectorAccessor: #acquireRetryDelay
>>        label: 'Aquire Retry Delay';
>>        group: 'C3P0';
>>        priority: 100;
>>        beRequired;
>>        beInteger;
>>        bePositive;
>>        yourself
>>
>> I do have a problem if the user enters a non-number. This is IMHO caused
>> by #bePositive which checks if a given number is positive by sending
>> #positive.
>>
>> However if the user enters "aaa" the object being validated is the String
>> ... which does not understand #positive.
>>
>> If I remove the #bePositive condition everything is find and I do get
>> (expected) Validation Errors complaining about invalid input and
>> non-integer.
>>
>> So I'm wondering if I need to somehow specify to check the #bePositive
>> condition (or any other condition for this case) only /after/ the correct
>> type has been validated/determined.
>>
>> Any pointers?
>>
>> CU,
>>
>> Udo
>>
>>
>>
>
>
>



--
Lukas Renggli
http://www.lukas-renggli.ch

Reply | Threaded
Open this post in threaded view
|

Re: Magritte Validation Question

Udo Schneider
Thanks for the information. I'll keep my KISS "fix" for the moment until
you did the hard part :-) Currently the fix doesn't seem to break anything.


Best Regards,

Udo


Lukas Renggli schrieb:

> Looks like you've discovered yet another bug in exception handling.
>
> I am looking into removing these resumable exceptions now. We should
> not need to use them. That's too tricky.
>
> Lukas
>
>
>
> 2009/11/5 Udo Schneider <[hidden email]>:
>> After digging a bit more I think the following patch fixes the issue ... not
>> sure if it breaks anything else though:
>>
>> MAKindError>>#isResumable
>>        ^ false
>>
>> CU,
>>
>> Udo
>>
>>
>>
>> Udo Schneider schrieb:
>>> Hi,
>>>
>>> I have a question regarding Magritte Validation. Given the following
>>> description
>>>
>>> descriptionAcquireRetryDelay
>>>    ^ MANumberDescription new
>>>        selectorAccessor: #acquireRetryDelay
>>>        label: 'Aquire Retry Delay';
>>>        group: 'C3P0';
>>>        priority: 100;
>>>        beRequired;
>>>        beInteger;
>>>        bePositive;
>>>        yourself
>>>
>>> I do have a problem if the user enters a non-number. This is IMHO caused
>>> by #bePositive which checks if a given number is positive by sending
>>> #positive.
>>>
>>> However if the user enters "aaa" the object being validated is the String
>>> ... which does not understand #positive.
>>>
>>> If I remove the #bePositive condition everything is find and I do get
>>> (expected) Validation Errors complaining about invalid input and
>>> non-integer.
>>>
>>> So I'm wondering if I need to somehow specify to check the #bePositive
>>> condition (or any other condition for this case) only /after/ the correct
>>> type has been validated/determined.
>>>
>>> Any pointers?
>>>
>>> CU,
>>>
>>> Udo
>>>
>>>
>>>
>>
>>
>
>
>