MADateDescription and nil objects

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

MADateDescription and nil objects

Dominique Dutoit-2
I have a couple of MADateDescription to manage the effective date and  
the expiration date of a structure and their values could be either a  
valid date or nil.

The problem is that once a date object is assigned to these variables  
through the fields generated by MADateDescription, it is not possible  
to assign a nil value just by deleting the content of the fields.  
MADateDescription always tries to parse the field as a date.

1. Left the field empty, effectiveDate is nil.
2. Input a date in the field, effectiveDate is a valid date.
3. Delete the content of the field, MADateDescription complains about  
an invalid date format.

Is there a way to avoid that parsing?

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: MADateDescription and nil objects

Lukas Renggli-2
> I have a couple of MADateDescription to manage the effective date and
> the expiration date of a structure and their values could be either a
> valid date or nil.

How does the description-definition of your MADateDescription look  
like? I quickly tried on my machine and it works as expected.

> 3. Delete the content of the field, MADateDescription complains about
> an invalid date format.

Sorry, I am unable to reproduce.

Cheers,
Lukas

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



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: MADateDescription and nil objects

Dominique Dutoit-2
Hi Lukas

>> 3. Delete the content of the field, MADateDescription complains about
>> an invalid date format.
>
> Sorry, I am unable to reproduce.

Hum, I shouldn't trust my own memory. In fact, the problem has  
nothing to do with the date format but when Magritte is committing  
the changes to the original object.

I can reproduce the problem with a form structure (Pier.72, Magritte.
142).

1) Create a form
2) Edit the meta of that form
3) Add a date element
4) Save the element
5) Save the meta

6) Edit the form
7) Assign a date
8) Save the form

9) Edit the form
10) Select the date and delete it (the field should be empty)
11) Save the form

At that moment, I get this traceback:

MessageNotUnderstood: UndefinedObject>>start
UndefinedObject(Object)>>doesNotUnderstand: #start
        self nil
        temps
        aMessage start
Date(Timespan)>>=
        self 2 March 2006
        temps
        comparand nil
        inst vars
        start 2006-03-02T00:00:00+00:00
        duration 1:00:00:00
[] in Dictionary>>= {[:assoc | (aDictionary at: assoc key ifAbsent:  
[^ false]) = assoc v...]}
        self a Dictionary(a MADateDescription label: 'Date' comment: nil-
 >nil a MAStringDescription label: 'Title...etc...
        temps
        aDictionary a Dictionary(a MADateDescription label: 'Date' comment:  
nil->2 March 2006 a MAStringDescription labe...etc...
        assoc a MADateDescription label: 'Date' comment: nil->nil
        inst vars
        tally 2
        array #(nil nil a MAStringDescription label: 'Title' comment: nil-
 >'Untitled' nil a MADateDescription labe...etc...
Dictionary(Set)>>do:
        self a Dictionary(a MADateDescription label: 'Date' comment: nil-
 >nil a MAStringDescription label: 'Title...etc...
        temps
        aBlock [] in Dictionary>>= {[:assoc | (aDictionary at: assoc key  
ifAbsent: [^ false]) = assoc v......etc...
        index 5
        each a MADateDescription label: 'Date' comment: nil->nil
        indexLimiT 6
        inst vars
        tally 2
        array #(nil nil a MAStringDescription label: 'Title' comment: nil-
 >'Untitled' nil a MADateDescription labe...etc...
Dictionary>>associationsDo:
        self a Dictionary(a MADateDescription label: 'Date' comment: nil-
 >nil a MAStringDescription label: 'Title...etc...
        temps
        aBlock [] in Dictionary>>= {[:assoc | (aDictionary at: assoc key  
ifAbsent: [^ false]) = assoc v......etc...
        inst vars
        tally 2
        array #(nil nil a MAStringDescription label: 'Title' comment: nil-
 >'Untitled' nil a MADateDescription labe...etc..

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: MADateDescription and nil objects

Lukas Renggli-2
Hi,

>>> 3. Delete the content of the field, MADateDescription complains  
>>> about
>>> an invalid date format.
>>
>> Sorry, I am unable to reproduce.
>
> Hum, I shouldn't trust my own memory. In fact, the problem has
> nothing to do with the date format but when Magritte is committing
> the changes to the original object.
>
> I can reproduce the problem with a form structure (Pier.72, Magritte.
> 142).
>
> 1) Create a form

yes, now I can observe some problems. I have changed and simplified a  
lot in Pier in the past, but never looked at the PRForm "meta" things  
for quite a while, so it is likely that there are some problems in  
that area. I will try to fix these problems tomorrow.

Cheers,
Lukas




> 2) Edit the meta of that form
> 3) Add a date element
> 4) Save the element
> 5) Save the meta
>
> 6) Edit the form
> 7) Assign a date
> 8) Save the form
>
> 9) Edit the form
> 10) Select the date and delete it (the field should be empty)
> 11) Save the form
>
> At that moment, I get this traceback:
>
> MessageNotUnderstood: UndefinedObject>>start
> UndefinedObject(Object)>>doesNotUnderstand: #start
> self nil
> temps
> aMessage start
> Date(Timespan)>>=
> self 2 March 2006
> temps
> comparand nil
> inst vars
> start 2006-03-02T00:00:00+00:00
> duration 1:00:00:00
> [] in Dictionary>>= {[:assoc | (aDictionary at: assoc key ifAbsent:
> [^ false]) = assoc v...]}
> self a Dictionary(a MADateDescription label: 'Date' comment: nil-
>> nil a MAStringDescription label: 'Title...etc...
> temps
> aDictionary a Dictionary(a MADateDescription label: 'Date' comment:
> nil->2 March 2006 a MAStringDescription labe...etc...
> assoc a MADateDescription label: 'Date' comment: nil->nil
> inst vars
> tally 2
> array #(nil nil a MAStringDescription label: 'Title' comment: nil-
>> 'Untitled' nil a MADateDescription labe...etc...
> Dictionary(Set)>>do:
> self a Dictionary(a MADateDescription label: 'Date' comment: nil-
>> nil a MAStringDescription label: 'Title...etc...
> temps
> aBlock [] in Dictionary>>= {[:assoc | (aDictionary at: assoc key
> ifAbsent: [^ false]) = assoc v......etc...
> index 5
> each a MADateDescription label: 'Date' comment: nil->nil
> indexLimiT 6
> inst vars
> tally 2
> array #(nil nil a MAStringDescription label: 'Title' comment: nil-
>> 'Untitled' nil a MADateDescription labe...etc...
> Dictionary>>associationsDo:
> self a Dictionary(a MADateDescription label: 'Date' comment: nil-
>> nil a MAStringDescription label: 'Title...etc...
> temps
> aBlock [] in Dictionary>>= {[:assoc | (aDictionary at: assoc key
> ifAbsent: [^ false]) = assoc v......etc...
> inst vars
> tally 2
> array #(nil nil a MAStringDescription label: 'Title' comment: nil-
>> 'Untitled' nil a MADateDescription labe...etc..
>
> _______________________________________________
> SmallWiki, Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

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



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki