The schema.Text type will raise an error if assigned either a Python unicode or str object. It only accepts LocalizableString's and UString's.

FYI, I *proposed* this, but I don't know what it would take to actually implement; I seem to recall that the repository doesn't have any type enforcement that would allow this to produce an immediate error. Perhaps Andi can comment?

The repository doesn't enforce types until commit. If the Text alias type doesn't recognize a value stored in an attribute upon commit, an error is raised.

Pity. It makes it harder to find where the broken assignment is in that case, since the commit could be much later.

Of course, the type check could happen at set time, at the cost of performance. It's a trade-off I made a long time ago and that could certainly be revisited. I could also add a 'debug' mode that enforces type upon setting.

Andi..
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev

Reply via email to