On 01/04/12 15:53 +0200, Albert Cervera i Areny wrote:
> A Diumenge, 11 de març de 2012 11:40:54, Cédric Krier va escriure:
> > On 11/03/12 11:30 +0100, Albert Cervera i Areny wrote:
> > > A Dissabte, 10 de març de 2012 14:52:07, Cédric Krier va escriure:
> > > > On 10/03/12 13:08 +0100, Albert Cervera i Areny wrote:
> > > > I agree, it is an idea in the pipeline since sometimes.
> > > > But I think it should be changed globaly.
> > > 
> > > Why should it be changed globally. If we said that properties can be
> > > changed one at a time, I don't see why we can't commit checks that raise
> > > exceptions while existing ones still return False.
> > 
> > Here are my reasons:
> > 
> >     - The base code of Tryton must be an example of good practices for
> >       developpers.
> >     - It is a good way to ensure that every constraints is reviewed and
> >       improved.
> >     - The documentation must reflect the practice.
> > 
> > About properties, my thoughts were to have an example. But once there is
> > one working example, we should migrate every Models and remove
> > properties for the same reasons as above.
> 
> Alright. What should the new API look like? I think we should simply convert 
> self._constraints from a list of tuples to a list of strings:
> 
> self._constraints += [
>     'check_one_thing',
>     'check_another thing',
>     ]
> 
> Then, those functions should just raise a user exception with the information 
> of the offending record.

Agree.
We could also move error message from _error_messages into the simple
record in the translation database.

> At the same time, I think we should remove all exclamation marks from 
> exception messages, those are not good from a usability POV. We should not 
> scare or shout at users but simply tell them what is wrong with the data they 
> provided.

An error is an error, for me they deserve an exclamation mark.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpA72paE4vu8.pgp
Description: PGP signature

Reply via email to