Should be

Field('changed_fields', 'list:string', default=[],
     requires=IS_IN_SET(['explanation', 'output'],multiple=True)
),

for multiple=True, IS_NOT_EMPTY is implicit and confuses web2py

On Sep 25, 1:39 pm, Jurgis Pralgauskis <jurgis.pralgaus...@gmail.com>
wrote:
> hello I get the same problem for list:string or list:integer on GAE
> using  version 1.85.3
>
> note: I think now, that the way I defined requires here is not needed,
> but anyway the errorreporting should handle it more fluently :)
>
> if from appadmin I try to insert recrod with
>
> Field('changed_fields', 'list:string', default=[],
>      requires=IS_EMPTY_OR(IS_IN_SET(['explanation', 'output'],
> multiple=True))
> ),
>
> and if I dont select anything for this field, I get:
> Internal error
> Ticket issued: unknown
>
> otherwise it inserts ok.
> on nonGAE it works without complaints
>
> I'd expect Validation error message instead.
>
> on terminal I can see:
> ERROR    2010-09-25 07:30:12,628 restricted.py:151] Traceback (most
> recent call last):
>   File "/media/data/veikla/coding/web2py_gae_test/gluon/
> restricted.py", line 188, in restricted
>     exec ccode in environment
>   File "/media/data/veikla/coding/web2py_gae_test/applications/
> CodeByExample/controllers/appadmin.py:insert", line 410, in <module>
>   File "/media/data/veikla/coding/web2py_gae_test/gluon/globals.py",
> line 96, in <lambda>
>     self._caller = lambda f: f()
>   File "/media/data/veikla/coding/web2py_gae_test/applications/
> CodeByExample/controllers/appadmin.py:insert", line 125, in insert
>   File "/media/data/veikla/coding/web2py_gae_test/gluon/sqlhtml.py",
> line 1103, in accepts
>     self.vars.id = self.table.insert(**fields)
>   File "/media/data/veikla/coding/web2py_gae_test/gluon/contrib/
> gql.py", line 296, in insert
>     tmp = self._tableobj(**fields)
>   File "/media/data/veikla/coding/google_appengine/google/appengine/
> ext/db/__init__.py", line 813, in __init__
>     prop.__set__(self, value)
>   File "/media/data/veikla/coding/google_appengine/google/appengine/
> ext/db/__init__.py", line 542, in __set__
>     value = self.validate(value)
>   File "/media/data/veikla/coding/google_appengine/google/appengine/
> ext/db/__init__.py", line 3013, in validate
>     value = super(ListProperty, self).validate(value)
>   File "/media/data/veikla/coding/google_appengine/google/appengine/
> ext/db/__init__.py", line 569, in validate
>     raise BadValueError('Property %s is required' % self.name)
> BadValueError: Property changed_fields is required
>
> ---
> ps.: later I thought that  IS_EMPTY_OR is no use here -- if list is
> empty then it is empty itself :)
> but IS_EMPY allows to have None value as I suppose.
> anyway after removing this constraint and changing None to [],
> everything seems to work fluently on both GAE and nonGAE.
>
> by the way, when trying to import from csv with IS_EMPTY_OR, I was
> getting flash message
> "Property changed_fields is required"
> where there is None for this field

Reply via email to