[Erp5-dev] Validating W3 Confomance of ERP5 Forms

Pelletier Vincent vincent at nexedi.com
Wed Mar 28 18:16:21 CEST 2007


Le Lundi 26 Mars 2007 17:10, Jacek Medrzycki a écrit :
> I have written a small test that validates forms using external
> validator on w3.org page.

It would be better to use a local validation mean. Yoshinori suggested, for 
example, http://openjade.sourceforge.net/ .

> As it's not typical unit test and I'm in doubts of how such test should
> look like, it's more a proposal to discussion than final solution,
> thought it works.

eval is evil :)

Instead of
  eval('object.%s' % (some_id, ))
please use
  getattr(object, some_id)

> The heart of the test is W3FormValidator class

I think it should be the code responsible for the sleep() used to limit the 
access frequency - but if we use a local validation method, it would not be 
needed anyway. Maybe should there be multiple classes providing the same API 
allowing to interface with multiple validation systems... Erm. Then again 
it's just a unit test :) .

I also think verbosity should be given to this class' constructor in order to 
factorise the "append" code.

-- 
Vincent Pelletier



More information about the Erp5-dev mailing list