[web2py] Re: Error in GAE TypeError: ConjunctionNode()

2015-08-14 Thread Jacinto Parga
It also happens width some SQLFORM.grid:

form = SQLFORM.grid(db.t_familiares, fields=fields,create=False)

The Traceback:

Traceback (most recent call last):
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/restricted.py
, line 227 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Frestricted.pyline=227
, in restricted
exec ccode in environment
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/applications/CAS/controllers/gestor.py
, line 404 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=404
, in module
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/globals.py
, line 412 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fglobals.pyline=412
, in lambda
self._caller = lambda f: f()
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/tools.py
, line 3769 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Ftools.pyline=3769
, in f
return action(*a, **b)
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/applications/CAS/controllers/gestor.py
, line 31 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=31
, in familia_manage
form = SQLFORM.grid(db.t_familiares, fields=fields,create=False)
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/sqlhtml.py
, line 2456 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fsqlhtml.pyline=2456
, in grid
search_menu = SQLFORM.search_menu(sfields, prefix=prefix)
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/sqlhtml.py
, line 1882 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fsqlhtml.pyline=1882
, in search_menu
_class='form-control',
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/validators.py
, line 586 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fvalidators.pyline=586
, in options
self.build_set()
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/validators.py
, line 572 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fvalidators.pyline=572
, in build_set
records = self.dbset(table).select(*fields, **dd)
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/packages/dal/pydal/objects.py
, line 2026 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fobjects.pyline=2026
, in select
return adapter.select(self.query,fields,attributes)
  File 
/base/data/home/apps/s~clubatletismosada/2.386424209805371251/gluon/packages/dal/pydal/adapters/google_adapters.py
, line 484 
https://console.developers.google.com/project/clubatletismosada/clouddev/debug/resolve_location?appModule=defaultappVersion=2timestampNanos=143954268392200file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386424209805371251%2Fgluon%2Fpackages%2Fdal%2Fpydal%2Fadapters%2Fgoogle_adapters.pyline=484
, in select
(items, tablename, fields) = 

[web2py] Re: Error in GAE TypeError: ConjunctionNode()

2015-08-14 Thread Jacinto Parga
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=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Frestricted.pyline=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=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=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=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Fglobals.pyline=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=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fgluon%2Ftools.pyline=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=defaultappVersion=2timestampNanos=143946559800300file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~clubatletismosada%2F2.386403586504283664%2Fapplications%2FCAS%2Fcontrollers%2Fgestor.pyline=12,
  
 in index_gestor table_name='seleccion_socios') File 
 /base/data/home/apps/s~clubatletismosada/2.386403586504283664/gluon/sqlhtml.py,