I surrender width *IS_IN_DB* and GAE

I finally solved it width a workaround using *IS_IN_SET:*

First I get rid off IS_IN_DB in my models requirements

titulares = db(db.auth_user.tipo_usuario=='Titular')
db.t_familiares.f_titular.requires= 
(IS_IN_DB(titulares,'auth_user.id','%(last_name)s'+', '+ '%(first_name)s'+' 
- '+ '%(f_numero_socio)s',sort=True))

Then I build a IS_IN_SET equivalent in the controllers

titulares 
=db(db.auth_user.tipo_usuario=='Titular').select(orderby=db.auth_user.last_name)
    titu = []
    for titulares in titulares:
        titu.append((titulares.id,titulares.last_name + ' ' + 
titulares.first_name + '- ' +titulares.f_numero_socio))
    db.t_familiares.f_titular.requires= IS_IN_SET(titu)
    form = SQLFORM(db.t_familiares)

So *titulares.id* is the value I get and *titulares.last_name + '  ' 
+titulares.first_name + '-  ' +titulares.f_numero_socio *is the dropdown 
value

It seems to work fine.

May be someone has a better solution

El jueves, 13 de agosto de 2015, 13:48:35 (UTC+2), Jacinto Parga escribió:
>
> I have an aplication deployed in GAE tha has been running for months with 
> no problem, but in the last deployment in GAE, it has raised a new error:
>
> TypeError: ConjunctionNode() expects Node instances as arguments; received 
> a non-Node instance None
>
> The error has to do with *IS_IN_DB* validator, and is has appeared in the 
> last deployment (today). It worked fine until now.
>
> This is the code: 
>
> def index_gestor():
>     titulares = db(db.auth_user.tipo_usuario=='Titular')
>     form = SQLFORM.factory(
>         Field('socio', db.auth_user, requires = IS_IN_DB(titulares,'
> auth_user.id','%(last_name)s'+', '+ '%(first_name)s'+' - '+ 
> '%(f_numero_socio)s',sort=True)), 
>         Field('consulta', type='string', requires = 
> IS_IN_SET(['Familiares', 'Movimientos','Pedidos']),default='Familiares'),
>         buttons=[TAG.button('CONSULTAR',_type="submit", _class="btn 
> btn-warning btn-large")],
>         table_name='seleccion_socios')
>     if form.process().accepted:
>         if form.vars.consulta == 'Familiares':
>           
>  
> redirect(URL("gestor","familiares_socio_manage.html",args=[form.vars.socio],user_signature=True))
>         elif form.vars.consulta == 'Movimientos':
>           
>  
> redirect(URL("gestor","cuenta_socio_manage.html",args=[form.vars.socio],user_signature=True))
>         elif form.vars.consulta == 'Pedidos':
>           
>  
> redirect(URL("gestor_productos","pedidos_por_socio",args=[form.vars.socio],user_signature=True))
>     
>     return locals()
>
> The problem is with the line  Field('socio', db.auth_user, requires = 
> IS_IN_DB(titulares,'auth_user.id','%(last_name)s'+', '+ 
> '%(first_name)s'+' - '+ '%(f_numero_socio)s',sort=True)), 
>
> This is the ticket: 
>
> Traceback (most recent call last): File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/restricted.py",
>  
> line 227 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Frestricted.py&line=227>,
>  
> in restricted exec ccode in environment File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/applications/CAS/controllers/gestor.py",
>  
> line 400 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.py&line=400>,
>  
> in <module> File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/globals.py",
>  
> line 412 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fglobals.py&line=412>,
>  
> in <lambda> self._caller = lambda f: f() File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/tools.py",
>  
> line 3769 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Ftools.py&line=3769>,
>  
> in f return action(*a, **b) File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/applications/CAS/controllers/gestor.py",
>  
> line 12 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.py&line=12>,
>  
> in index_gestor table_name='seleccion_socios') File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/sqlhtml.py",
>  
> line 1771 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fsqlhtml.py&line=1771>,
>  
> in factory **attributes) File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/sqlhtml.py",
>  
> line 1259 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fsqlhtml.py&line=1259>,
>  
> in __init__ inp = self.widgets.options.widget(field, default) File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/sqlhtml.py",
>  
> line 313 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fsqlhtml.py&line=313>,
>  
> in widget options = requires[0].options() File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/validators.py",
>  
> line 586 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fvalidators.py&line=586>,
>  
> in options self.build_set() File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/validators.py",
>  
> line 572 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fvalidators.py&line=572>,
>  
> in build_set records = self.dbset(table).select(*fields, **dd) File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/packages/dal/pydal/objects.py",
>  
> line 2026 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fobjects.py&line=2026>,
>  
> in select return adapter.select(self.query,fields,attributes) File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 484 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fadapters%2Fgoogle_adapters.py&line=484>,
>  
> in select (items, tablename, fields) = 
> self.select_raw(query,fields,attributes) File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 376 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fadapters%2Fgoogle_adapters.py&line=376>,
>  
> in select_raw filters = self.expand(query) File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 237 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fadapters%2Fgoogle_adapters.py&line=237>,
>  
> in expand return expression.op(expression.first, expression.second) File 
> "/base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/packages/dal/pydal/adapters/google_adapters.py",
>  
> line 257 
> <https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=default&appVersion=2&timestampNanos=1439465598003000000&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fadapters%2Fgoogle_adapters.py&line=257>,
>  
> in AND return ndb.AND(first, second) File 
> "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/query.py",
>  
> line 558, in __new__ ' received a non-Node instance %r' % node) TypeError: 
> ConjunctionNode() expects Node instances as arguments; received a non-Node 
> instance None
>
>
> This is the first hint I've found: 
>
>
> https://cloud.google.com/appengine/docs/python/refdocs/modules/google/appengine/ext/ndb/query
>
> Any help would be appreciated.
>

-- 
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