pombreda / formalchemy

Automatically exported from code.google.com/p/formalchemy
MIT License
0 stars 0 forks source link

Validation of empty string on a field where is_required() is True writes in field_set.errors but does not raise ValidationError #129

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The attached python file demonstrates the behavior and comments on expectations 
when run with (some 
variation) of this console input:

$ mkvirtualenv -q --no-site-packages --distribute fa_test
(fa_test)$ pip install -q formalchemy elixir
Using already activated environment ...virtualenvs/fa_test
(fa_test)$ python formalchemy_example.py 
... output of demonstration ...
(fa_test)$ 

What is the expected output? What do you see instead?

It's not clear to me (based on the documentation) whether or not this is the 
expected behavior.  I know that 
there was discussion of it being possible to have 'allow blank but not None' 
and a decorator was 
implemented.  I believe that the problem has to do with line 700 of fields.py 
at the top of AbstractField.

>  _null_option = (u'None', u'')

I sort of see the reason for this as it relates to 'blank but not None', but 
the default behavior is very 
confusing.  I expect required=True to invalidate in the 'usual' way for a given 
field by throwing an 
exception.  Why would I expect this one particular case to behave differently 
from all of the other validators?  
(As far as I can tell, this fact is not documented).

What version of the product are you using? On what operating system?

Elixir==0.7.1
FormAlchemy==1.3.1
SQLAlchemy==0.5.7

Mac OS X 10.5

Please provide any additional information below.

See attached file

Original issue reported on code.google.com by patrick....@gmail.com on 11 Jan 2010 at 2:11

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by patrick....@gmail.com on 11 Jan 2010 at 2:20

Attachments:

GoogleCodeExporter commented 9 years ago
Whoops, accidentally uploaded an unsaved file with confusing commented old 
code.  
Reuploaded the clean one.

Original comment by patrick....@gmail.com on 11 Jan 2010 at 2:21