You are right. I have a problem with strings now, but empty field for 
integer is inserted as null at least. So I reverted this piece of code to 
version 2.13.4 like this and now is everything like it was, and shoud be.

    """
    if field.unique:
        requires.insert(0, validators.IS_NOT_IN_DB(db, field))
    excluded_fields = ['string', 'upload', 'text', 'password', 'boolean']
    if (field.notnull or field.unique) and not field_type in 
excluded_fields:
        requires.insert(0, validators.IS_NOT_EMPTY())
    elif not field.notnull and not field.unique and requires:
        requires[0] = validators.IS_EMPTY_OR(requires[0], null='' if field 
in ('string', 'text', 'password') else None)
    return requires
    """
    if field.unique:
        requires.append(validators.IS_NOT_IN_DB(db, field))
    sff = ['in', 'do', 'da', 'ti', 'de', 'bo']
    if field.notnull and not field_type[:2] in sff:
        requires.append(validators.IS_NOT_EMPTY())
    elif not field.notnull and field_type[:2] in sff and requires:
        requires[0] = validators.IS_EMPTY_OR(requires[0])
    return requires


Dana ponedjeljak, 30. svibnja 2016. u 15:33:20 UTC+2, korisnik Leonel 
Câmara napisao je:
>
> That doesn't make any sense Adam. You say your field is an integer, so
>
> null='' if field in ('string', 'text', 'password') else None
>
> is the same as
>
> null=None
>
> Which is the default value for null in IS_EMPTY_OR()
>
> So your change shouldn't have many any difference whatsoever, note that by 
> changing that you will also make forms put NULL values in string fields 
> where you would probably want an empty string.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to