[Seaside] Fwd: MAStringReader and nil

Otto Behrens otto at finworks.biz
Thu Mar 6 14:04:54 UTC 2014


I apologise in advance if this cross post bothers you, but I'm not
sure if people are looking at the other list where I posted.

We will appreciate your help if you know something in this area of
Magritte-Seaside.

---------- Forwarded message ----------
From: Otto Behrens <otto at finworks.biz>
Date: Thu, Mar 6, 2014 at 12:38 PM
Subject: MAStringReader and nil
To: "Magritte, Pier and Related Tools ..." <smallwiki at iam.unibe.ch>


Hi,

We'd like some help with how nil / undefined is handled in Magritte,
and specifically a MAStringDescription. The method MAStringReader >>
read:description: overrides the default behaviour to return nil. Is a
nil in Magritte seen as a "unpopulated" token?

Our problem more specifically is this:

We start with an object containing an string in an instance variable.
We use a MAStringDescription for this instance variable. We use the
magritte-seaside binding to edit this field on the UI. If the user
does not capture text in the text input, an empty string is "written".

The method on MAStringReader mentioned above intercepts this and
returns nil, so nil is written back to our domain object, where we
started off with an empty string.

We do not want nils to be written into our domain object where we
initialized it with an empty string.

How do we fix this? Is there a hook where we should be specifying
this? Or is there a fundamental way of working with Magritte-Seaside
where it will write nils and we have to manage that on our domain
object?

Thanks for your help.

Otto


More information about the seaside mailing list