[ZODB-Dev] Pre-announce: Oscar 0.1
Christian Robottom Reis
kiko@async.com.br
Mon, 27 Aug 2001 13:22:44 -0300 (BRT)
On Mon, 27 Aug 2001, Andrew Kuchling wrote:
> Grouch doesn't attempt to remove the need for input validation, and it
> seems at the wrong level to do that; users wouldn't find it very
> friendly to get a ValueError traceback when they enter a string
> instead of a number.
Hmmm. Did I imply I think tracebacks should be shipped to the user? :)
What I meant was that we could use Grouch to raise exceptions which we
handled in our user interface code. Something like this:
def __setattr__(self, name, value):
_some_grouch_checktype(name, value)
# do the attribution
on Domain classes. And
def foo_entry_updated(self, entry, *args):
try:
domain.foo = entry.get_text()
except ValueError:
self.win.statusbar.warn("Data b0rked, should be numeric!")
entry.select_region(0,entry.get_size())
How does that look? Non-modal output, too :)
This could be done in a custom _set_foo() method too, if you don't like
the setattr hack.
Does this sound insane?
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL