[web2py] Re: Problems - Changes on SQLTABLE? Upgraded to 2.9.4-stable

2014-03-13 Thread drayco
We use extensive SQLTABLE and in this moment we have a lot of errors 
similar to

File /home/drayco/web2py/gluon/sqlhtml.py, line 2929, in __init__
columns = 
['.'.join(sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match(c).groups()) for c in 
sqlrows.colnames]
AttributeError: 'NoneType' object has no attribute 'groups'

All code work with web2py 2.8.3 but when we upgrade to web2py 2.9.4, 
This is our code
totalPagos = 
SQLTABLE(db((db.pagos.created_oninicio)(db.pagos.created_onfin)).\
  select(db.pagos.id.count()), 
headers={'COUNT(pagos.id)':'Total Pagos'})
We are in the similar situation

El jueves, 13 de marzo de 2014 09:49:01 UTC-6, Fcosqui escribió:

 Hi !

 I have 2.9.4-stable version on my Server1 and 2.8.2-stable version on my 
 Server2. 

 the same Application and query on Server1 and Server2:

 rows = SQLTABLE(db(db.info).select(db.info.name, db.info.number.count(), 
 orderby=db.info.number, groupby=db.info.number))

 Server2 : Correct answer

 Server1 : type 'exceptions.AttributeError' 'NoneType' object has no 
 attribute 'groups'


 ¿¿??.


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


[web2py] Re: Problem with upgrade to 2.9.4 with SQLTABLE

2014-03-11 Thread drayco
If we use the suggestion niphlod

count = db.pagos.count()
totalPagos = 
SQLTABLE(db((db.pagos.created_oninicio)(db.pagos.created_onfin)).\
  select(count), headers={count:'Total Pagos'})

We get the following error

Error snapshot [image: help] 
https://sys.luzo.mx/admin/default/ticket/movil/189.242.175.32.2014-03-11.17-43-07.e99c-2259-4da6-83d9-dd7f95341afe#
 

type 'exceptions.AttributeError'('Table' object has no attribute 'count') 
We are reviewing the documentation, however we did not find any example to 
clarify that we have to make it work, as in past versions

El viernes, 7 de marzo de 2014 14:00:40 UTC-6, drayco escribió:

 All code work with web2py 2.8.3 but when we upgrade to web2py 2.9.4, we 
 use extensive SQLTABLE and in this moment we have a lot of errors similar to

 File /home/drayco/webapps/newconfig/web2py/gluon/sqlhtml.py, line 2929, in 
 __init__
 columns = 
 ['.'.join(sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match(c).groups()) for c 
 in sqlrows.colnames]
 AttributeError: 'NoneType' object has no attribute 'groups'


 This is our code

 totalPagos = 
 SQLTABLE(db((db.pagos.created_oninicio)(db.pagos.created_onfin)).\
   select(db.pagos.id.count()), headers={'COUNT(
 pagos.id)':'Total Pagos'})

 What can we do?

 Can you help me please?


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


[web2py] Re: Problem with upgrade to 2.9.4 with SQLTABLE

2014-03-11 Thread drayco
Does drayco want to display the count of all the pages in the database, or 
the count of all the pages in the selection?
Only the selection 

I thought the latter from reading his message, but your suggestion counts 
th former, does it not?
Yes, it has 4 years old, something like that



El viernes, 7 de marzo de 2014 14:00:40 UTC-6, drayco escribió:

 All code work with web2py 2.8.3 but when we upgrade to web2py 2.9.4, we 
 use extensive SQLTABLE and in this moment we have a lot of errors similar to

 File /home/drayco/webapps/newconfig/web2py/gluon/sqlhtml.py, line 2929, in 
 __init__
 columns = 
 ['.'.join(sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match(c).groups()) for c 
 in sqlrows.colnames]
 AttributeError: 'NoneType' object has no attribute 'groups'


 This is our code

 totalPagos = 
 SQLTABLE(db((db.pagos.created_oninicio)(db.pagos.created_onfin)).\
   select(db.pagos.id.count()), headers={'COUNT(
 pagos.id)':'Total Pagos'})

 What can we do?

 Can you help me please?


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


[web2py] Re: Problem with upgrade to 2.9.4 with SQLTABLE

2014-03-10 Thread drayco
With the change, this is the result

  File /home/drayco/web2py/applications/movil/controllers/cobros.py 
https://sys.luzo.mx/admin/default/edit/movil/controllers/cobros.py, line 335, 
in pagos
select(db.pagos.id.count()), headers={db.pagos.id.count():'Total Pagos'})
  File /home/drayco/web2py/gluon/sqlhtml.py, line 2929, in __init__
columns = 
['.'.join(sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match(c).groups()) for c in 
sqlrows.colnames]
AttributeError: 'NoneType' object has no attribute 'groups'


But the problem persist, do you have other idea?

And repeat, that kind of code works in web2py 2.8.3

El viernes, 7 de marzo de 2014 14:00:40 UTC-6, drayco escribió:

 All code work with web2py 2.8.3 but when we upgrade to web2py 2.9.4, we 
 use extensive SQLTABLE and in this moment we have a lot of errors similar to

 File /home/drayco/webapps/newconfig/web2py/gluon/sqlhtml.py, line 2929, in 
 __init__
 columns = 
 ['.'.join(sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match(c).groups()) for c 
 in sqlrows.colnames]
 AttributeError: 'NoneType' object has no attribute 'groups'


 This is our code

 totalPagos = 
 SQLTABLE(db((db.pagos.created_oninicio)(db.pagos.created_onfin)).\
   select(db.pagos.id.count()), headers={'COUNT(
 pagos.id)':'Total Pagos'})

 What can we do?

 Can you help me please?


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


[web2py] Re: Problem with upgrade to 2.9.4 with SQLTABLE

2014-03-10 Thread drayco
Variables c 'COUNT(pagos.id)'  sqlrows.db DAL 
uri=mysql:**@127.0.0.1/drayco_ol  ).groups undefined  
sqlrows.colnames ['COUNT(pagos.id)']  
sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD _sre.SRE_Pattern object  
'.'.join undefined  sqlrows.db._adapter gluon.dal.MySQLAdapter object  
sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match built-in method match of 
_sre.SRE_Pattern object  sqlrows Rows (1)  columns None




El viernes, 7 de marzo de 2014 14:00:40 UTC-6, drayco escribió:

 All code work with web2py 2.8.3 but when we upgrade to web2py 2.9.4, we 
 use extensive SQLTABLE and in this moment we have a lot of errors similar to

 File /home/drayco/webapps/newconfig/web2py/gluon/sqlhtml.py, line 2929, in 
 __init__
 columns = 
 ['.'.join(sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match(c).groups()) for c 
 in sqlrows.colnames]
 AttributeError: 'NoneType' object has no attribute 'groups'


 This is our code

 totalPagos = 
 SQLTABLE(db((db.pagos.created_oninicio)(db.pagos.created_onfin)).\
   select(db.pagos.id.count()), headers={'COUNT(
 pagos.id)':'Total Pagos'})

 What can we do?

 Can you help me please?


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


[web2py] Problem with upgrade to 2.9.4 with SQLTABLE

2014-03-07 Thread drayco
All code work with web2py 2.8.3 but when we upgrade to web2py 2.9.4, we use 
extensive SQLTABLE and in this moment we have a lot of errors similar to

File /home/drayco/webapps/newconfig/web2py/gluon/sqlhtml.py, line 2929, in 
__init__
columns = 
['.'.join(sqlrows.db._adapter.REGEX_TABLE_DOT_FIELD.match(c).groups()) for c in 
sqlrows.colnames]
AttributeError: 'NoneType' object has no attribute 'groups'


This is our code

totalPagos = 
SQLTABLE(db((db.pagos.created_oninicio)(db.pagos.created_onfin)).\
  select(db.pagos.id.count()), 
headers={'COUNT(pagos.id)':'Total Pagos'})

What can we do?

Can you help me please?

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


[web2py] help, how enable cron in webfaction with wgsi and apache2?

2012-12-05 Thread drayco
In file wgsihandler.py

# change these parameters as required
LOGGING = False
SOFTCRON = True

What does i miss?

-- 





[web2py] help with IS_IN_DB?

2012-03-28 Thread drayco
I can try to show in form of input and output a dbset, but i want to modify 
prices, because it depends of store

In model

if store.store_id7:
armazones = db((db.eyewear.observaciones==
'')(db.eyewear.modelo!='SOLAR'))
elif store.store_id6:
armazones = db((db.eyewear.observaciones!='2DA JORNADA 2010'))
else:
armazones = db(db.eyewear.id0)

interes=0.0
if store.store_id==9:
interes=1.25
elif store.store_id9:
interes=1.10

if interes0.0:
i=0
for armazon in armazones:

armazones[i].precio=armazon.precio*interes+(armazon.precio*interes)%10
i=i+1

In definition of table

db.define_table(notas,
Field(store_id,db.stores, label='Sucursal',comment='Es a la que se 
encuentra asignado'),
Field('nota', 'integer', default=None, 
writable=False,label='Remisión(Sistema)',comment='Asignado por el sistema'),
Field('armazon1',db.eyewear, 
default=None,requires=IS_NULL_OR(IS_IN_DB(armazones,'eyewear.id','%(marca)s 
%(modelo)s %(color)s %(caract1)s $%(precio)s'))),
Field('modelo1','string', default=None, 
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres 
alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo armazon1'),
Field('color1','string', default=None, 
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser caracteres 
alfanumericos, sin espacios en blanco ó ñ!')),label='Color(es) armazon1'),
Field('obser1','string', default=None, label='Observaciones 
1',comment='Para el laboratorio'),
Field('lente1',db.lentes, 
default=None,requires=IS_NULL_OR(IS_IN_DB(glases,'lentes.id','%(tecnoGradua)s 
%(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $%(promo)s'))),
Field('soloLoC1','string', 
default=None,requires=IS_NULL_OR(IS_IN_SET(soloLoC)), label='Lejos ó Cerca 
1'),
Field('tinte1','string', default=None, 
requires=IS_NULL_OR(IS_IN_SET(tintes))),
Field(total, double, default=0, writable=False),
Field(descuento, integer, default=0, 
requires=IS_INT_IN_RANGE(0,41,error_message='Debe ser Numero positivo entre 
0 y 40'), comment='15% maximo permitido'),
Field(anticipo, double, default=0, 
requires=[IS_NOT_EMPTY(error_message='No puede estar 
vacio'),IS_FLOAT_IN_RANGE(0.0,2.0,error_message='Debe ser un numero 
positivo entre 0 y 2')],comment='35% minimo para descuento'),
Field(pagos, double, default=0, writable=False),
Field(saldo, double, default=0, writable=False),
)

db.notas.store_id.represent = lambda value: '%(id)s.- %(store)s' % 
db.stores(value)  if value else ''
db.notas.armazon1.represent = lambda value: '%(marca)s %(modelo)s %(color)s 
%(caract1)s $%(promo)s' % db.eyewear(value) if value else ''
db.notas.lente1.represent = lambda value: '%(tecnoGradua)s %(material)s 
%(tipo)s %(tecnoVisual)s %(tratamiento)s $%(promo)s' % db.lentes(value) if 
value else ''

However, only show data of db not of dbset

Can you help me?
Is it better is_in_set or sqlform.factory?



[web2py] Help with vitrualfields

2011-09-16 Thread drayco
Hi, I want to display the porcentaje of some fields

I put this in the end of model

db.define_table(notas,
Field(total, double, default=0, writable=False),
Field(anticipo, double, default=0,
requires=[IS_NOT_EMPTY(error_message='No puede estar
vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero
positivo entre 0 y 1')],comment='40% minimo para descuento'),
Field(pagos, double, default=0, writable=False),
Field(saldo, double, default=0, writable=False))

class Indices(object):
def pcobrado(self):#Porcentaje Cobrado
porcentaje=100
if self.notas.total0:
porcentaje = (self.notas.anticipo+self.notas.pagos)*100/
self.notas.total
return porcentaje

db.notas.virtualfields.append(Indices())

And in the controller this

All =
SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.active==True)).
\
 
select(db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),db.notas.total.sum()/
db.notas.id.count(),db.notas.pcobrado().sum()/db.notas.id.count())/,\
 
headers={'COUNT(notas.id)':'Num.Notas','SUM(notas.total)':'Venta
Neta','SUM(notas.anticipo)':'Anticipos','SUM(notas.pagos)':'Pagos','SUM(notas.saldo)':'Saldos','SUM(notas.total)/
COUNT(notas.id)':'Promedio','SUM(notas.pcobrado())/
COUNT(notas.id)':'Cobrado'})

Can I do this with virtualfields?

because, with trunk version of web2py, tell me that pcobrado doesn't
exist



[web2py] Re: ReCaptcha stopped working

2011-04-28 Thread drayco
equals

On 28 abr, 12:46, Vasile Ermicioi elff...@gmail.com wrote:
 same for me, recaptcha stopped working


[web2py] Re: Code insert-er for Pydev Eclipse users

2011-04-27 Thread drayco
Thank's a lot.

On 27 abr, 16:21, pierreth pierre.thibau...@gmail.com wrote:
 OK I see,

 This way, Pydev automatically had the missing imports when we are
 coding. Personally, I added the library project by project so the
 feature is working for me too.

 But this does not solve the problem of the missing imports for
 existing code if code analysis is activated (Window  Pydev  Editor 
 Code Analysis  Option tab  Do Code Analysis checkbox). The script
 add the missing imports so you don't have to add them manually. I
 guess you work without the Pydev code analysis.

 It could also be a good reference for people beginning with web2py.

 On 27 avr, 14:04, danto web2py.n...@gmail.com wrote:







  I still don't know what issues are all talking about regarding pydev and
  web2py. I'm using it on archlinux and imports, autocomplete and functions
  are all working pretty well.

  just go to:

  window  preferences  pydev  interpreter-python  libraries

  and add a [new folder] in system pythonpath pointing to the web2py/gluon
  folder of your web2py installation.

  please tell me if this (kind of obvious) thing works for you or I may be
  missing some more magic from web2py (?). I have autocomplete from DAL and
  even from HTML helpers atm

  regards


[web2py] Re: MySQL, migration, and lower()

2011-04-20 Thread drayco
1.- Put in your model in every table fake_migrate=True
2.- Remove your *name_of_your_table.table
3.- Run web2py and go to admin application database
4.- Remove fake_migrate

Your rebuild your  *name_of_your_table.table

On 20 abr, 14:15, Praneeth Bodduluri life...@gmail.com wrote:
 1) If you have no other schema changes a simpler solution would be to
 just change all your table names manually to lower.
 2) Hook the new version to a blank db and let it generate a dummy sql
 table. swap the table with the one you changed the table names in step
 1 - after turning off web2py i.e.

 --
 Praneeth
 IRC: lifeeth

 On Thu, Apr 21, 2011 at 12:32 AM, robe...@captivation.com

 gummywubb...@gmail.com wrote:
  Hi Everybody,

  Yesterday evening I ran into some issues updating an app from 1.89.6
  to 1.94.5 -- specifically with case sensitivity in migrating tables.
  This occurs on an ubuntu ec2 instance, running mysql as installed by
  'aptitude install mysql-server' and accepting defaults.

  An example.

  The field is defined in models with

                     Field('splatToken'),

  The .table file before the migration contains

  p9
  sS'splatToken'

  The .table file after the first execution contains

  p9
  sS'splattoken'

  The next execution yields an exception in DAL.py migrate_table
  triggered off this test:
                   and not isinstance(table[key].type, SQLCustomType) \

  I was able to bypass the issue and continue by removing the .lower()
  calls in the sql_fields* assignments up above.

  So, my app is running as it needs to be, but this really feels like a
  band-aid and incorrect solution. In searching this groups archives,
  I've seen some similar issues, but they all seem to have been resolved
  a few months ago.

  Advice? Thoughts? Questions?

  Cheers,
  :R


[web2py] Re: MySQL, migration, and lower()

2011-04-20 Thread drayco
It's work for me

On 20 abr, 23:46, drayco antrod...@gmail.com wrote:
 1.- Put in your model in every table fake_migrate=True
 2.- Remove your *name_of_your_table.table
 3.- Run web2py and go to admin application database
 4.- Remove fake_migrate

 Your rebuild your  *name_of_your_table.table

 On 20 abr, 14:15, Praneeth Bodduluri life...@gmail.com wrote:

  1) If you have no other schema changes a simpler solution would be to
  just change all your table names manually to lower.
  2) Hook the new version to a blank db and let it generate a dummy sql
  table. swap the table with the one you changed the table names in step
  1 - after turning off web2py i.e.

  --
  Praneeth
  IRC: lifeeth

  On Thu, Apr 21, 2011 at 12:32 AM, robe...@captivation.com

  gummywubb...@gmail.com wrote:
   Hi Everybody,

   Yesterday evening I ran into some issues updating an app from 1.89.6
   to 1.94.5 -- specifically with case sensitivity in migrating tables.
   This occurs on an ubuntu ec2 instance, running mysql as installed by
   'aptitude install mysql-server' and accepting defaults.

   An example.

   The field is defined in models with

                      Field('splatToken'),

   The .table file before the migration contains

   p9
   sS'splatToken'

   The .table file after the first execution contains

   p9
   sS'splattoken'

   The next execution yields an exception in DAL.py migrate_table
   triggered off this test:
                    and not isinstance(table[key].type, SQLCustomType) \

   I was able to bypass the issue and continue by removing the .lower()
   calls in the sql_fields* assignments up above.

   So, my app is running as it needs to be, but this really feels like a
   band-aid and incorrect solution. In searching this groups archives,
   I've seen some similar issues, but they all seem to have been resolved
   a few months ago.

   Advice? Thoughts? Questions?

   Cheers,
   :R


[web2py] curious case of crud.search

2011-04-07 Thread drayco
In version web2py trunk in 10.10 and mysql ubuntu

If I run this code, everything works fine

def buscar_notas():
form, results = crud.search( db.notas,
   query =
(db.notas.id0)(db.notas.active==True),
   queries = ['equals', 'not equal', 'contains'],
   query_labels={'equals':'Igual a','not
equal':'No igual a','contains':'Contiene'},
   #fields =
[db.notas.nota,db.notas.folio,db.notas.first_name,db.notas.last_name,db.notas.end_name,
\
   #
db.notas.armazon1,db.notas.lente1,db.notas.lc4,db.notas.total,db.notas.anticipo,db.notas.pagos,db.notas.saldo,
\
   #
db.notas.vendedor,db.notas.optometrista,db.notas.garantia,db.notas.vale],
   field_labels =
{'nota':'Num.Nota','folio':'Num.Folio','first_name':'Nombre(s)','last_name':'Apel.Pater.','end_name':'Apel.Mater.',
\
'armazon1':'Armazon1',
'lente1':'Lente1','lc4':'L/C
4','total':'Total','anticipo':'Anticipo','pagos':'Pagos','saldo':'Saldo',
\
 
'vendedor':'Vendedor','optometrista':'Optometrista','garantia':'Garantia',
'vale':'Vale'},
   zero='Por favor, seleccione al menos una')
return dict(form=form, results=results)

But when I remove the comments, this is the error

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 189, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/movil/controllers/ventas.py,
line 1092, in module
  File /home/drayco/web2py/gluon/globals.py, line 124, in lambda
self._caller = lambda f: f()
  File /home/drayco/web2py/gluon/tools.py, line 2373, in f
return action(*a, **b)
  File /home/drayco/web2py/applications/movil/controllers/ventas.py,
line 1089, in buscar_notas
zero='Por favor, seleccione al menos una')
  File /home/drayco/web2py/gluon/tools.py, line 3139, in search
field = table[field]
  File /home/drayco/web2py/gluon/dal.py, line 4323, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'notas.nota'

The field to which it refers is defined in the model and database

Any advice on how to make it work?


[web2py] Compatibility issues between versions 1.89.5 and 1.94.6 with legacy applications

2011-03-31 Thread drayco
Good morning to all, our case is as follows, in the production site
have web2py 1.89.5 and MySQL, all our applications are operating
properly.

Now we would like to upgrade to version 1.94.6, however we have
compatibility issues with the new version of the dal, these are the
details.

db.define_table('benefs2',
Field('names', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Benef. Nombre(s)'),
Field('apelPater', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Benef. Apel. Pater.'),
Field('apelMater', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Benef. Apel. Mater.'),
Field('rfc', 'string', requires=[IS_UPPER(),
IS_NOT_EMPTY(error_message='No puede estar vacio'),\
IS_LENGTH(13,error_message='El tamaño debe ser de 13
caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos!'), \
IS_NOT_IN_DB(db,'benefs2.rfc',error_message='El RFC ya
existe')], label='Benef. RFC'),
 
Field('sexo','string',requires=IS_IN_SET(['femenino','masculino']),
label='Benef. Sexo'),
 
Field('enfermedades',db.enfermedades,requires=IS_IN_DB(db,'enfermedades.id','%
(names)s'), label='Benef. Enfermedad',readable=False),
Field('namesWorked', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Trabajador Nombre(s)'),
Field('apelPaterWorked', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Trabajador Apel.Pater.'),
Field('apelMaterWorked', 'string',
requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
vacio')], label='Trabajador Apel.Mater.'),
Field('rfcWorked', 'string', requires=[IS_UPPER(),
IS_NOT_EMPTY(error_message='No puede estar vacio'),\
IS_LENGTH(13,error_message='El tamaño debe ser de 13
caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos!'), \
IS_NOT_IN_DB(db,'benefs2.rfcWorked',error_message='El RFC ya
existe')], label='Trabajador RFC'),
IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')],
label='Trabajador Tel.Trabajo'),
 
Field('sexoWorked','string',requires=IS_IN_SET(['femenino','masculino']),
label='Trabajador Sexo'),
Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
Naucalpan']),label='Trabajador SubDir.'))

Could you help?, thanks in advance for your excellent work.

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 189, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/init/models/db.py, line 334,
in module
Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
Naucalpan']),label='Trabajador SubDir.'))
  File /home/drayco/web2py/gluon/dal.py, line 3973, in define_table
polymodel=polymodel)
  File /home/drayco/web2py/gluon/dal.py, line 611, in create_table
fake_migrate=fake_migrate)
  File /home/drayco/web2py/gluon/dal.py, line 655, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
  File /home/drayco/web2py/gluon/dal.py, line 4323, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'sexoworked'

Code listing

4318.
4319.
4320.
4321.
4322.
4323.

4324.
4325.
4326.
4327.
return rows[0]
return None
elif str(key).isdigit():
return self._db(self.id ==
key).select(limitby=(0,1)).first()
elif key:
return dict.__getitem__(self, str(key))


def __call__(self, key=DEFAULT, **kwargs):
if key!=DEFAULT:
if isinstance(key, Query):



[web2py] Re: Compatibility issues between versions 1.89.5 and 1.94.6 with legacy applications

2011-03-31 Thread drayco
Please, we want you to help us confirm

We have reviewed and benefs2.table SQL.LOG and we observe that the
field sexoWorked is defined according to the model.

However, when reviewing the MySQL database we see that the field is
defined as sexoworked. As you say

In this case it would be best to migrate all the code, model,
controllers and views?

We would have to change and xxxbenefs2.table SQL.LOG manually?

Or is there another alternative?
On Mar 31, 12:17 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 The problem is this:

 You defined Field('sexoWorked')

 but you are using sexoworked in your code. Some versions of web2py
 were forgiving about that but it resulted in a problem because SQL is
 not always case agnostic. You need to make sure you use the same case
 in the table definitions and in the code.

 Attention: if you change the case in models that may trigger a
 migration and data loss unless you convert the .table files. I will be
 happy to do that for you if needed.

 Massimo

 On Mar 31, 1:03 pm, drayco antrod...@gmail.com wrote:







  Good morning to all, our case is as follows, in the production site
  have web2py 1.89.5 and MySQL, all our applications are operating
  properly.

  Now we would like to upgrade to version 1.94.6, however we have
  compatibility issues with the new version of the dal, these are the
  details.

  db.define_table('benefs2',
      Field('names', 'string',
  requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
  vacio')], label='Benef. Nombre(s)'),
      Field('apelPater', 'string',
  requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
  vacio')], label='Benef. Apel. Pater.'),
      Field('apelMater', 'string',
  requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
  vacio')], label='Benef. Apel. Mater.'),
      Field('rfc', 'string', requires=[IS_UPPER(),
  IS_NOT_EMPTY(error_message='No puede estar vacio'),\
          IS_LENGTH(13,error_message='El tamaño debe ser de 13
  caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos!'), \
          IS_NOT_IN_DB(db,'benefs2.rfc',error_message='El RFC ya
  existe')], label='Benef. RFC'),

  Field('sexo','string',requires=IS_IN_SET(['femenino','masculino']),
  label='Benef. Sexo'),

  Field('enfermedades',db.enfermedades,requires=IS_IN_DB(db,'enfermedades.id' 
  ,'%
  (names)s'), label='Benef. Enfermedad',readable=False),
      Field('namesWorked', 'string',
  requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
  vacio')], label='Trabajador Nombre(s)'),
      Field('apelPaterWorked', 'string',
  requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
  vacio')], label='Trabajador Apel.Pater.'),
      Field('apelMaterWorked', 'string',
  requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
  vacio')], label='Trabajador Apel.Mater.'),
      Field('rfcWorked', 'string', requires=[IS_UPPER(),
  IS_NOT_EMPTY(error_message='No puede estar vacio'),\
          IS_LENGTH(13,error_message='El tamaño debe ser de 13
  caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos!'), \
          IS_NOT_IN_DB(db,'benefs2.rfcWorked',error_message='El RFC ya
  existe')], label='Trabajador RFC'),
  IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')],
  label='Trabajador Tel.Trabajo'),

  Field('sexoWorked','string',requires=IS_IN_SET(['femenino','masculino']),
  label='Trabajador Sexo'),
      Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
  y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
  Naucalpan']),label='Trabajador SubDir.'))

  Could you help?, thanks in advance for your excellent work.

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 189, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/init/models/db.py, line 334,
  in module
      Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
  y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
  Naucalpan']),label='Trabajador SubDir.'))
    File /home/drayco/web2py/gluon/dal.py, line 3973, in define_table
      polymodel=polymodel)
    File /home/drayco/web2py/gluon/dal.py, line 611, in create_table
      fake_migrate=fake_migrate)
    File /home/drayco/web2py/gluon/dal.py, line 655, in migrate_table
      and not isinstance(table[key].type, SQLCustomType) \
    File /home/drayco/web2py/gluon/dal.py, line 4323, in __getitem__
      return dict.__getitem__(self, str(key))
  KeyError: 'sexoworked'

  Code listing

  4318.
  4319.
  4320.
  4321.
  4322.
  4323.

  4324.
  4325.
  4326.
  4327.
                  return rows[0]
              return None
          elif str(key).isdigit():
              return self._db(self.id ==
  key).select(limitby=(0,1)).first()
          elif key:
  return dict.__getitem__(self, str(key))

      def __call__(self, key=DEFAULT, **kwargs):
          if key

[web2py] Re: Compatibility issues between versions 1.89.5 and 1.94.6 with legacy applications

2011-03-31 Thread drayco
Sorry, my bad, I view other older db.

well, this is my true

We have reviewed and benefs2.table SQL.LOG and we observe that the
field sexoWorked is defined according to the model.

We have reviewed all our model,controllers and views and we observe
that the field sexoWorked is refer according to the model

And when reviewing the MySQL database we see that the field is
defined as sexoWorked.

Any advice?

On Mar 31, 12:47 pm, drayco antrod...@gmail.com wrote:
 Please, we want you to help us confirm

 We have reviewed and benefs2.table SQL.LOG and we observe that the
 field sexoWorked is defined according to the model.

 However, when reviewing the MySQL database we see that the field is
 defined as sexoworked. As you say

 In this case it would be best to migrate all the code, model,
 controllers and views?

 We would have to change and xxxbenefs2.table SQL.LOG manually?

 Or is there another alternative?
 On Mar 31, 12:17 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  The problem is this:

  You defined Field('sexoWorked')

  but you are using sexoworked in your code. Some versions of web2py
  were forgiving about that but it resulted in a problem because SQL is
  not always case agnostic. You need to make sure you use the same case
  in the table definitions and in the code.

  Attention: if you change the case in models that may trigger a
  migration and data loss unless you convert the .table files. I will be
  happy to do that for you if needed.

  Massimo

  On Mar 31, 1:03 pm, drayco antrod...@gmail.com wrote:

   Good morning to all, our case is as follows, in the production site
   have web2py 1.89.5 and MySQL, all our applications are operating
   properly.

   Now we would like to upgrade to version 1.94.6, however we have
   compatibility issues with the new version of the dal, these are the
   details.

   db.define_table('benefs2',
       Field('names', 'string',
   requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
   vacio')], label='Benef. Nombre(s)'),
       Field('apelPater', 'string',
   requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
   vacio')], label='Benef. Apel. Pater.'),
       Field('apelMater', 'string',
   requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
   vacio')], label='Benef. Apel. Mater.'),
       Field('rfc', 'string', requires=[IS_UPPER(),
   IS_NOT_EMPTY(error_message='No puede estar vacio'),\
           IS_LENGTH(13,error_message='El tamaño debe ser de 13
   caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
   caracteres alfanumericos!'), \
           IS_NOT_IN_DB(db,'benefs2.rfc',error_message='El RFC ya
   existe')], label='Benef. RFC'),

   Field('sexo','string',requires=IS_IN_SET(['femenino','masculino']),
   label='Benef. Sexo'),

   Field('enfermedades',db.enfermedades,requires=IS_IN_DB(db,'enfermedades.id'
,'%
   (names)s'), label='Benef. Enfermedad',readable=False),
       Field('namesWorked', 'string',
   requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
   vacio')], label='Trabajador Nombre(s)'),
       Field('apelPaterWorked', 'string',
   requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
   vacio')], label='Trabajador Apel.Pater.'),
       Field('apelMaterWorked', 'string',
   requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
   vacio')], label='Trabajador Apel.Mater.'),
       Field('rfcWorked', 'string', requires=[IS_UPPER(),
   IS_NOT_EMPTY(error_message='No puede estar vacio'),\
           IS_LENGTH(13,error_message='El tamaño debe ser de 13
   caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
   caracteres alfanumericos!'), \
           IS_NOT_IN_DB(db,'benefs2.rfcWorked',error_message='El RFC ya
   existe')], label='Trabajador RFC'),
   IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')],
   label='Trabajador Tel.Trabajo'),

   Field('sexoWorked','string',requires=IS_IN_SET(['femenino','masculino']),
   label='Trabajador Sexo'),
       Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
   y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
   Naucalpan']),label='Trabajador SubDir.'))

   Could you help?, thanks in advance for your excellent work.

   Traceback (most recent call last):
     File /home/drayco/web2py/gluon/restricted.py, line 189, in
   restricted
       exec ccode in environment
     File /home/drayco/web2py/applications/init/models/db.py, line 334,
   in module
       Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
   y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
   Naucalpan']),label='Trabajador SubDir.'))
     File /home/drayco/web2py/gluon/dal.py, line 3973, in define_table
       polymodel=polymodel)
     File /home/drayco/web2py/gluon/dal.py, line 611, in create_table
       fake_migrate=fake_migrate)
     File /home/drayco/web2py/gluon/dal.py, line 655, in migrate_table
       and not isinstance(table[key].type

[web2py] Re: Compatibility issues between versions 1.89.5 and 1.94.6 with legacy applications

2011-03-31 Thread drayco
Thanks.

We put fake_migrate = True at all and we got it define_table

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 189, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/init/models/db.py, line 334,
in module
Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
Naucalpan']),label='Trabajador SubDir.'),fake_migrate=True)
  File /home/drayco/web2py/gluon/dal.py, line 3973, in define_table
polymodel=polymodel)
  File /home/drayco/web2py/gluon/dal.py, line 611, in create_table
fake_migrate=fake_migrate)
  File /home/drayco/web2py/gluon/dal.py, line 655, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
  File /home/drayco/web2py/gluon/dal.py, line 4323, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'sexoworked'

We place above some similar cases in which they had resolved, this is
the link
http://groups.google.com/group/web2py/browse_thread/thread/b7388100e245cc91/c1e8f4af18575004?hl=en#c1e8f4af18575004

If not too much trouble, could you give other advice?

On Mar 31, 1:06 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 if mysql is not in case sensitive model, you just set all
 define_table(...,fake_migrate=True), make sure the table and fields
 are consistent everywhere, run it once (the .table will be rebuilt)
 and than remove the fake_migrate=True from the define_tables.

 On Mar 31, 2:00 pm, drayco antrod...@gmail.com wrote:







  Sorry, my bad, I view other older db.

  well, this is my true

  We have reviewed and benefs2.table SQL.LOG and we observe that the
  field sexoWorked is defined according to the model.

  We have reviewed all our model,controllers and views and we observe
  that the field sexoWorked is refer according to the model

  And when reviewing the MySQL database we see that the field is
  defined as sexoWorked.

  Any advice?

  On Mar 31, 12:47 pm, drayco antrod...@gmail.com wrote:

   Please, we want you to help us confirm

   We have reviewed and benefs2.table SQL.LOG and we observe that the
   field sexoWorked is defined according to the model.

   However, when reviewing the MySQL database we see that the field is
   defined as sexoworked. As you say

   In this case it would be best to migrate all the code, model,
   controllers and views?

   We would have to change and xxxbenefs2.table SQL.LOG manually?

   Or is there another alternative?
   On Mar 31, 12:17 pm, Massimo Di Pierro massimo.dipie...@gmail.com
   wrote:

The problem is this:

You defined Field('sexoWorked')

but you are using sexoworked in your code. Some versions of web2py
were forgiving about that but it resulted in a problem because SQL is
not always case agnostic. You need to make sure you use the same case
in the table definitions and in the code.

Attention: if you change the case in models that may trigger a
migration and data loss unless you convert the .table files. I will be
happy to do that for you if needed.

Massimo

On Mar 31, 1:03 pm, drayco antrod...@gmail.com wrote:

 Good morning to all, our case is as follows, in the production site
 have web2py 1.89.5 and MySQL, all our applications are operating
 properly.

 Now we would like to upgrade to version 1.94.6, however we have
 compatibility issues with the new version of the dal, these are the
 details.

 db.define_table('benefs2',
     Field('names', 'string',
 requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
 vacio')], label='Benef. Nombre(s)'),
     Field('apelPater', 'string',
 requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
 vacio')], label='Benef. Apel. Pater.'),
     Field('apelMater', 'string',
 requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
 vacio')], label='Benef. Apel. Mater.'),
     Field('rfc', 'string', requires=[IS_UPPER(),
 IS_NOT_EMPTY(error_message='No puede estar vacio'),\
         IS_LENGTH(13,error_message='El tamaño debe ser de 13
 caracteres alfanumericos'),IS_ALPHANUMERIC(error_message='¡Deben ser
 caracteres alfanumericos!'), \
         IS_NOT_IN_DB(db,'benefs2.rfc',error_message='El RFC ya
 existe')], label='Benef. RFC'),

 Field('sexo','string',requires=IS_IN_SET(['femenino','masculino']),
 label='Benef. Sexo'),

 Field('enfermedades',db.enfermedades,requires=IS_IN_DB(db,'enfermedades.id'
  ,'%
 (names)s'), label='Benef. Enfermedad',readable=False),
     Field('namesWorked', 'string',
 requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
 vacio')], label='Trabajador Nombre(s)'),
     Field('apelPaterWorked', 'string',
 requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
 vacio')], label='Trabajador Apel.Pater.'),
     Field('apelMaterWorked', 'string

[web2py] Re: Compatibility issues between versions 1.89.5 and 1.94.6 with legacy applications

2011-03-31 Thread drayco
Ok, We change to sexoworked and we got this

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 189, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/init/models/db.py, line 334,
in module
Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
Naucalpan']),label='Trabajador SubDir.'),fake_migrate=True)
  File /home/drayco/web2py/gluon/dal.py, line 3973, in define_table
polymodel=polymodel)
  File /home/drayco/web2py/gluon/dal.py, line 611, in create_table
fake_migrate=fake_migrate)
  File /home/drayco/web2py/gluon/dal.py, line 655, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
  File /home/drayco/web2py/gluon/dal.py, line 4323, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'nivel_educativo'

If not too much trouble, could you give other advice?

On Mar 31, 1:34 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Did you also change the case in the model to make sure the same case
 is used consistently?

 On Mar 31, 2:29 pm, drayco antrod...@gmail.com wrote:







  Thanks.

  We put fake_migrate = True at all and we got it define_table

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 189, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/init/models/db.py, line 334,
  in module
      Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
  y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
  Naucalpan']),label='Trabajador SubDir.'),fake_migrate=True)
    File /home/drayco/web2py/gluon/dal.py, line 3973, in define_table
      polymodel=polymodel)
    File /home/drayco/web2py/gluon/dal.py, line 611, in create_table
      fake_migrate=fake_migrate)
    File /home/drayco/web2py/gluon/dal.py, line 655, in migrate_table
      and not isinstance(table[key].type, SQLCustomType) \
    File /home/drayco/web2py/gluon/dal.py, line 4323, in __getitem__
      return dict.__getitem__(self, str(key))
  KeyError: 'sexoworked'

  We place above some similar cases in which they had resolved, this is
  the 
  linkhttp://groups.google.com/group/web2py/browse_thread/thread/b7388100e2...

  If not too much trouble, could you give other advice?

  On Mar 31, 1:06 pm, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   if mysql is not in case sensitive model, you just set all
   define_table(...,fake_migrate=True), make sure the table and fields
   are consistent everywhere, run it once (the .table will be rebuilt)
   and than remove the fake_migrate=True from the define_tables.

   On Mar 31, 2:00 pm, drayco antrod...@gmail.com wrote:

Sorry, my bad, I view other older db.

well, this is my true

We have reviewed and benefs2.table SQL.LOG and we observe that the
field sexoWorked is defined according to the model.

We have reviewed all our model,controllers and views and we observe
that the field sexoWorked is refer according to the model

And when reviewing the MySQL database we see that the field is
defined as sexoWorked.

Any advice?

On Mar 31, 12:47 pm, drayco antrod...@gmail.com wrote:

 Please, we want you to help us confirm

 We have reviewed and benefs2.table SQL.LOG and we observe that the
 field sexoWorked is defined according to the model.

 However, when reviewing the MySQL database we see that the field is
 defined as sexoworked. As you say

 In this case it would be best to migrate all the code, model,
 controllers and views?

 We would have to change and xxxbenefs2.table SQL.LOG manually?

 Or is there another alternative?
 On Mar 31, 12:17 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:

  The problem is this:

  You defined Field('sexoWorked')

  but you are using sexoworked in your code. Some versions of web2py
  were forgiving about that but it resulted in a problem because SQL 
  is
  not always case agnostic. You need to make sure you use the same 
  case
  in the table definitions and in the code.

  Attention: if you change the case in models that may trigger a
  migration and data loss unless you convert the .table files. I will 
  be
  happy to do that for you if needed.

  Massimo

  On Mar 31, 1:03 pm, drayco antrod...@gmail.com wrote:

   Good morning to all, our case is as follows, in the production 
   site
   have web2py 1.89.5 and MySQL, all our applications are operating
   properly.

   Now we would like to upgrade to version 1.94.6, however we have
   compatibility issues with the new version of the dal, these are 
   the
   details.

   db.define_table('benefs2',
       Field('names', 'string',
   requires=[IS_UPPER(),IS_NOT_EMPTY(error_message='No puede estar
   vacio')], label='Benef

[web2py] Re: Compatibility issues between versions 1.89.5 and 1.94.6 with legacy applications

2011-03-31 Thread drayco
Hi Dr.Massimo

Following your advice, we changed in the model, all of fields names
that use upper case with lower case, and we use fake_migrate = True
and now we work with web2py 1.94.6

 Thank you very much.

On Mar 31, 1:52 pm, drayco antrod...@gmail.com wrote:
 Ok, We change to sexoworked and we got this

 Traceback (most recent call last):
   File /home/drayco/web2py/gluon/restricted.py, line 189, in
 restricted
     exec ccode in environment
   File /home/drayco/web2py/applications/init/models/db.py, line 334,
 in module
     Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
 y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
 Naucalpan']),label='Trabajador SubDir.'),fake_migrate=True)
   File /home/drayco/web2py/gluon/dal.py, line 3973, in define_table
     polymodel=polymodel)
   File /home/drayco/web2py/gluon/dal.py, line 611, in create_table
     fake_migrate=fake_migrate)
   File /home/drayco/web2py/gluon/dal.py, line 655, in migrate_table
     and not isinstance(table[key].type, SQLCustomType) \
   File /home/drayco/web2py/gluon/dal.py, line 4323, in __getitem__
     return dict.__getitem__(self, str(key))
 KeyError: 'nivel_educativo'

 If not too much trouble, could you give other advice?

 On Mar 31, 1:34 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Did you also change the case in the model to make sure the same case
  is used consistently?

  On Mar 31, 2:29 pm, drayco antrod...@gmail.com wrote:

   Thanks.

   We put fake_migrate = True at all and we got it define_table

   Traceback (most recent call last):
     File /home/drayco/web2py/gluon/restricted.py, line 189, in
   restricted
       exec ccode in environment
     File /home/drayco/web2py/applications/init/models/db.py, line 334,
   in module
       Field('subdireccion','string',requires=IS_IN_SET(['Nezahualcóyotl
   y Chalco','Ecatepec y Tecámac','Cuautitlán Izcalli y
   Naucalpan']),label='Trabajador SubDir.'),fake_migrate=True)
     File /home/drayco/web2py/gluon/dal.py, line 3973, in define_table
       polymodel=polymodel)
     File /home/drayco/web2py/gluon/dal.py, line 611, in create_table
       fake_migrate=fake_migrate)
     File /home/drayco/web2py/gluon/dal.py, line 655, in migrate_table
       and not isinstance(table[key].type, SQLCustomType) \
     File /home/drayco/web2py/gluon/dal.py, line 4323, in __getitem__
       return dict.__getitem__(self, str(key))
   KeyError: 'sexoworked'

   We place above some similar cases in which they had resolved, this is
   the 
   linkhttp://groups.google.com/group/web2py/browse_thread/thread/b7388100e2...

   If not too much trouble, could you give other advice?

   On Mar 31, 1:06 pm, Massimo Di Pierro massimo.dipie...@gmail.com
   wrote:

if mysql is not in case sensitive model, you just set all
define_table(...,fake_migrate=True), make sure the table and fields
are consistent everywhere, run it once (the .table will be rebuilt)
and than remove the fake_migrate=True from the define_tables.

On Mar 31, 2:00 pm, drayco antrod...@gmail.com wrote:

 Sorry, my bad, I view other older db.

 well, this is my true

 We have reviewed and benefs2.table SQL.LOG and we observe that the
 field sexoWorked is defined according to the model.

 We have reviewed all our model,controllers and views and we observe
 that the field sexoWorked is refer according to the model

 And when reviewing the MySQL database we see that the field is
 defined as sexoWorked.

 Any advice?

 On Mar 31, 12:47 pm, drayco antrod...@gmail.com wrote:

  Please, we want you to help us confirm

  We have reviewed and benefs2.table SQL.LOG and we observe that 
  the
  field sexoWorked is defined according to the model.

  However, when reviewing the MySQL database we see that the field is
  defined as sexoworked. As you say

  In this case it would be best to migrate all the code, model,
  controllers and views?

  We would have to change and xxxbenefs2.table SQL.LOG manually?

  Or is there another alternative?
  On Mar 31, 12:17 pm, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   The problem is this:

   You defined Field('sexoWorked')

   but you are using sexoworked in your code. Some versions of 
   web2py
   were forgiving about that but it resulted in a problem because 
   SQL is
   not always case agnostic. You need to make sure you use the same 
   case
   in the table definitions and in the code.

   Attention: if you change the case in models that may trigger a
   migration and data loss unless you convert the .table files. I 
   will be
   happy to do that for you if needed.

   Massimo

   On Mar 31, 1:03 pm, drayco antrod...@gmail.com wrote:

Good morning to all, our case is as follows, in the production 
site
have web2py 1.89.5 and MySQL, all our applications

[web2py] Re: Can any help me with new dal in trunk?

2011-02-04 Thread drayco
Goodnight to everybody

I think my problem with legacy databases with mysql is finished.
Change the driver SQLDB by DAL and now, my old application left to
give me the problem that I described above with web2py trunk version.
Thank you very much everybody and my apologize because I didn't see
that.
Now, I have a problem with one database that it didn't is legacy
database in the same old application
This is the issue

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/iscada/models/db.py, line
85, in module
Field('creadoPor', db.auth_user, default=current_user_id,
label='Creado por', writable=False, readable=False),
  File /home/drayco/web2py/gluon/dal.py, line 3510, in __getattr__
return self[key]
  File /home/drayco/web2py/gluon/dal.py, line 3504, in __getitem__
return dict.__getitem__(self, str(key).lower())
KeyError: 'auth_user'

Anyone have any advice on how to overcome it?
Thanks in advance

On Feb 2, 12:44 am, Fran francisb...@gmail.com wrote:
 This is now fixed in Trunk - thanks Massimo :)

 F


[web2py] Re: Can any help me with new dal in trunk?

2011-01-31 Thread drayco
Hi DenesL, This old application works now with with web2py 1.83.2 and
mysql in RedHat 5.5 with 64 bits

However, with web2py in trunk and mysql it doesn't works

De hecho en esta liga, te agradecí que sin querer me solucionaste un
problema :D

http://groups.google.com/group/web2py/browse_thread/thread/789387057d5e4716/03369058c0e06310#03369058c0e06310

Es una aplicación que tiene 2 bases de datos legadas y una tercera en
la cual se tienen los datos con los cuales se pueden generar ligas
entre las 2 bases legadas y dar los servicios web que informan a otras
aplicaciones el contenido de las 2 legadas. Suena raro pero eso
necesitan en la escuela en la que trabajo en México.

Gracias de antemano

On Jan 28, 4:15 pm, DenesL denes1...@yahoo.ca wrote:
 Are you sure it worked before?
 As far as I know mysql is not supported for legacy DBs using
 primarykey.

 On Jan 28, 5:04 pm, drayco antrod...@gmail.com wrote:

  Hi, I updated my trunk version

  However, The same issue is still

  This is the new traceback

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 188, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
  16, in module
      migrate = False)
    File /home/drayco/web2py/gluon/dal.py, line 3471, in define_table
      sequence_name=sequence_name))
    File /home/drayco/web2py/gluon/dal.py, line 3755, in __init__
      primarykey must be a list of fields from table '%s  % tablename
  SyntaxError: primarykey must be a list of fields from table
  'med_dnpmst_4

  SnapShot

  type 'exceptions.SyntaxError'(primarykey must be a list of fields
  from table 'med_dnpmst_4 )

  File /home/drayco/web2py/gluon/dal.py in __init__ at line 3755

  Function argument list

  (self=Table {'indice': gluon.dal.Field object at 0x2...ractual':
  gluon.dal.Field object at 0x25b25d0}, db=DAL {'_lastsql': SET
  sql_mode='NO_BACKSLASH_ES...tables': [], '_migrate': True,
  '_pool_size': 10}, tablename='med_dnpmst_4',
  *fields=[gluon.dal.Field object, gluon.dal.Field object,
  gluon.dal.Field object, gluon.dal.Field object, gluon.dal.Field
  object, gluon.dal.Field object, gluon.dal.Field object],
  **args={'primarykey': ['DireccionUTR', 'Indice'], 'sequence_name':
  None, 'trigger_name': None})

  Code listing

  3750.
  3751.
  3752.
  3753.
  3754.
  3755.

  3756.
  3757.
  3758.
  3759.

          if hasattr(self,'_primarykey'):
              for k in self._primarykey:
                  if k not in self.fields:
                      raise SyntaxError, \
  primarykey must be a list of fields from table '%s  % tablename

                  else:
                      self[k].notnull = True

  On Jan 28, 8:35 am, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   this should now be fixed in trunk

   On Jan 8, 2:58 pm, Thadeus Burgess thade...@thadeusb.com wrote:

 All I know is that tables are issued as lowercase, but you can still 
access
your table as an uppercase attribute.

There is an inconsistency in the DAL somewhere because of this... 
Somewhere
it is forgetting to convert to lower case. I don't know why converting 
table
names to lower case is forced in web2py and I disagree with it.

for example:

db = DAL()
db.define_table('TableA', Field('Superman'))
# CREATE TABLE tablea WITH FIELDS superman
db(db.TableA.Superman == clark).select().first().Superman
# SELECT * FROM tablea WHERE superman=clark

--
Thadeus

On Sat, Jan 8, 2011 at 1:17 AM, mart msenecal...@gmail.com wrote:
 really? I didn't know, thanks for pointing that out...

 just out of curiosity

 in

 in __getitem__
    return dict.__getitem__(self, str(key))
 KeyError: 'tecnogradua'

 don't the attribute lookups get done by python ultimately?  Just
 trying to understand...
 how could this have worked if doing x.__getitem__ ? Even if dal does a
 string.lower() or something, once the table is named and created,
 would something (outside of migrate) not catch that error and set off
 the alarm even before any change need to happen?

 Thanks,
 Mart :)

 On Jan 8, 1:44 am, Thadeus Burgess thade...@thadeusb.com wrote:
  I can also confirm this is a bug with the new DAL.

  It is only caused when using upper case characters in the table or 
  field
  names. It seems that web2py converts all of the tablenames to lower 
  case
  when issuing the SQL (so your actual tables are lower regardless of 
  what
 you
  specify in the python). There is something in the migrations that 
  cause
 this
  to come up, because it will work just fine one run and crash on 
  another
 run
  after changing some unrelated tables.

  I don't think the DAL should force the tables to lowercase.

  --
  Thadeus

  On Sat, Jan 8, 2011 at 12:38 AM, mart msenecal...@gmail.com

[web2py] Re: Can any help me with new dal in trunk?

2011-01-28 Thread drayco
Hi, I updated my trunk version

However, The same issue is still

This is the new traceback

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
16, in module
migrate = False)
  File /home/drayco/web2py/gluon/dal.py, line 3471, in define_table
sequence_name=sequence_name))
  File /home/drayco/web2py/gluon/dal.py, line 3755, in __init__
primarykey must be a list of fields from table '%s  % tablename
SyntaxError: primarykey must be a list of fields from table
'med_dnpmst_4

SnapShot

type 'exceptions.SyntaxError'(primarykey must be a list of fields
from table 'med_dnpmst_4 )

File /home/drayco/web2py/gluon/dal.py in __init__ at line 3755

Function argument list

(self=Table {'indice': gluon.dal.Field object at 0x2...ractual':
gluon.dal.Field object at 0x25b25d0}, db=DAL {'_lastsql': SET
sql_mode='NO_BACKSLASH_ES...tables': [], '_migrate': True,
'_pool_size': 10}, tablename='med_dnpmst_4',
*fields=[gluon.dal.Field object, gluon.dal.Field object,
gluon.dal.Field object, gluon.dal.Field object, gluon.dal.Field
object, gluon.dal.Field object, gluon.dal.Field object],
**args={'primarykey': ['DireccionUTR', 'Indice'], 'sequence_name':
None, 'trigger_name': None})

Code listing

3750.
3751.
3752.
3753.
3754.
3755.

3756.
3757.
3758.
3759.

if hasattr(self,'_primarykey'):
for k in self._primarykey:
if k not in self.fields:
raise SyntaxError, \
primarykey must be a list of fields from table '%s  % tablename

else:
self[k].notnull = True

On Jan 28, 8:35 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 this should now be fixed in trunk

 On Jan 8, 2:58 pm, Thadeus Burgess thade...@thadeusb.com wrote:

   All I know is that tables are issued as lowercase, but you can still access
  your table as an uppercase attribute.

  There is an inconsistency in the DAL somewhere because of this... Somewhere
  it is forgetting to convert to lower case. I don't know why converting table
  names to lower case is forced in web2py and I disagree with it.

  for example:

  db = DAL()
  db.define_table('TableA', Field('Superman'))
  # CREATE TABLE tablea WITH FIELDS superman
  db(db.TableA.Superman == clark).select().first().Superman
  # SELECT * FROM tablea WHERE superman=clark

  --
  Thadeus

  On Sat, Jan 8, 2011 at 1:17 AM, mart msenecal...@gmail.com wrote:
   really? I didn't know, thanks for pointing that out...

   just out of curiosity

   in

   in __getitem__
      return dict.__getitem__(self, str(key))
   KeyError: 'tecnogradua'

   don't the attribute lookups get done by python ultimately?  Just
   trying to understand...
   how could this have worked if doing x.__getitem__ ? Even if dal does a
   string.lower() or something, once the table is named and created,
   would something (outside of migrate) not catch that error and set off
   the alarm even before any change need to happen?

   Thanks,
   Mart :)

   On Jan 8, 1:44 am, Thadeus Burgess thade...@thadeusb.com wrote:
I can also confirm this is a bug with the new DAL.

It is only caused when using upper case characters in the table or field
names. It seems that web2py converts all of the tablenames to lower case
when issuing the SQL (so your actual tables are lower regardless of what
   you
specify in the python). There is something in the migrations that cause
   this
to come up, because it will work just fine one run and crash on another
   run
after changing some unrelated tables.

I don't think the DAL should force the tables to lowercase.

--
Thadeus

On Sat, Jan 8, 2011 at 12:38 AM, mart msenecal...@gmail.com wrote:
 no, this is python...

 not sure how it could have worked before, but the key (technogradua)
 in .keys() is not being picked up... dal is simply pointing that out
 with the exception being thrown. I did notice when I made the switch
 that a few more of my mistakes got picked up (or it could be that I
 forgot that I changed something), but regardless... since switching to
 the latest DAL release and fixing my mistakes that it quickly picked
 up, I have had no problems (except those that I cause). I would simply
 take those exceptions for cash, change the case and enjoy one less
 exception ;)

 Mart :)

 On Jan 8, 1:19 am, drayco antrod...@gmail.com wrote:
  Ok, I understand your point.

  But this is a issue of DAL or what?

  because I only update web2py to trunk version

  On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote:

   Probably just being unhappy with the case :)

   tecnoGradua != tecnogradua

   Mart :)

   Field(tecnoGradua, 'string',

   On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:

Hi, this code works with web2py 1.89.5

[web2py] Re: Can any help me with new dal in trunk?

2011-01-27 Thread drayco
Hi, Now my old application is work's with trunk.

Thank's a lot to fix it.

Hi, Now one of my old application is work's with trunk version.

Thanks a lot to fix it.

However I obtain the same issue with mysql and legacy database, this
is other old application, this is the issue

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
16, in module
migrate = False)
  File /home/drayco/web2py/gluon/dal.py, line 3457, in define_table
sequence_name=sequence_name))
  File /home/drayco/web2py/gluon/dal.py, line 3741, in __init__
primarykey must be a list of fields from table '%s  % tablename
SyntaxError: primarykey must be a list of fields from table
'med_dnpmst_4

http://groups.google.com/group/web2py/browse_thread/thread/72e91e281e0610d8/099e21f098ae8501#099e21f098ae8501

How can I avoid this situation?

Thank's in advance

On Jan 18, 6:17 pm, drayco antrod...@gmail.com wrote:
 Hi, When we have available that change?

 And Can you give us a little example?

 Because, I'm testing my application on the trunk version and I keep
 getting the same error.

 On Jan 8, 4:40 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:

  We should have a flag to change this behavior DAL(...,lowercase=True).
  I would take a patch.

  On Jan 8, 2:58 pm, Thadeus Burgess thade...@thadeusb.com wrote:

    All I know is that tables are issued as lowercase, but you can still 
   access
   your table as an uppercase attribute.

   There is an inconsistency in the DAL somewhere because of this... 
   Somewhere
   it is forgetting to convert to lower case. I don't know why converting 
   table
   names to lower case is forced in web2py and I disagree with it.

   for example:

   db = DAL()
   db.define_table('TableA', Field('Superman'))
   # CREATE TABLE tablea WITH FIELDS superman
   db(db.TableA.Superman == clark).select().first().Superman
   # SELECT * FROM tablea WHERE superman=clark

   --
   Thadeus

   On Sat, Jan 8, 2011 at 1:17 AM, mart msenecal...@gmail.com wrote:
really? I didn't know, thanks for pointing that out...

just out of curiosity

in

in __getitem__
   return dict.__getitem__(self, str(key))
KeyError: 'tecnogradua'

don't the attribute lookups get done by python ultimately?  Just
trying to understand...
how could this have worked if doing x.__getitem__ ? Even if dal does a
string.lower() or something, once the table is named and created,
would something (outside of migrate) not catch that error and set off
the alarm even before any change need to happen?

Thanks,
Mart :)

On Jan 8, 1:44 am, Thadeus Burgess thade...@thadeusb.com wrote:
 I can also confirm this is a bug with the new DAL.

 It is only caused when using upper case characters in the table or 
 field
 names. It seems that web2py converts all of the tablenames to lower 
 case
 when issuing the SQL (so your actual tables are lower regardless of 
 what
you
 specify in the python). There is something in the migrations that 
 cause
this
 to come up, because it will work just fine one run and crash on 
 another
run
 after changing some unrelated tables.

 I don't think the DAL should force the tables to lowercase.

 --
 Thadeus

 On Sat, Jan 8, 2011 at 12:38 AM, mart msenecal...@gmail.com wrote:
  no, this is python...

  not sure how it could have worked before, but the key (technogradua)
  in .keys() is not being picked up... dal is simply pointing that out
  with the exception being thrown. I did notice when I made the switch
  that a few more of my mistakes got picked up (or it could be that I
  forgot that I changed something), but regardless... since switching 
  to
  the latest DAL release and fixing my mistakes that it quickly picked
  up, I have had no problems (except those that I cause). I would 
  simply
  take those exceptions for cash, change the case and enjoy one less
  exception ;)

  Mart :)

  On Jan 8, 1:19 am, drayco antrod...@gmail.com wrote:
   Ok, I understand your point.

   But this is a issue of DAL or what?

   because I only update web2py to trunk version

   On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote:

Probably just being unhappy with the case :)

tecnoGradua != tecnogradua

Mart :)

Field(tecnoGradua, 'string',

On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:

 Hi, this code works with web2py 1.89.5 with mysql

 but with web2py in trunk and mysql it dosent works.

 db.define_table(lentes,
     audit,
     Field(tecnoGradua, 'string',

requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
 de Graduaciones),
     Field(material

[web2py] Re: Using mysqldb instead of pymysql

2011-01-20 Thread drayco
Hi, I did my test with trunk version

this is the issue

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
16, in module
migrate = False)
  File /home/drayco/web2py/gluon/dal.py, line 3457, in define_table
sequence_name=sequence_name))
  File /home/drayco/web2py/gluon/dal.py, line 3741, in __init__
primarykey must be a list of fields from table '%s  % tablename
SyntaxError: primarykey must be a list of fields from table
'med_dnpmst_4

On Jan 18, 9:50 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I just included the latest pymysql in trunk. Does it make things
 better?

 On Jan 18, 6:05 pm, drayco antrod...@gmail.com wrote:

  Hi, I do this revert, thank's

  try:
      import MySQLdb
      drivers.append('MySQL')
  except ImportError:
      logger.debug('no MySQLdb driver')

  And

          self.pool_connection(lambda db=db,
                               user=credential_decoder(user),
                               password=credential_decoder(password),
                               host=host,
                               port=port,
                               charset=charset:
  MySQLdb.Connection(db=db,

  user=user,

  passwd=password,

  host=host,

  port=port,

  charset=charset,
                                                                ))
  In dal.py
  However, the error is still appear

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 188, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
  16, in module
      migrate = False)
    File /home/drayco/web2py/gluon/dal.py, line 3457, in define_table
      sequence_name=sequence_name))
    File /home/drayco/web2py/gluon/dal.py, line 3741, in __init__
      primarykey must be a list of fields from table '%s  % tablename
  SyntaxError: primarykey must be a list of fields from table
  'med_dnpmst_4

  Well I think this is a problem with compatibility.

  Do you have any suggestions?

  On Jan 14, 6:36 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:

   To test if the issue is with pymysql, you could edit the dal file to
   use mysqldb

  http://code.google.com/p/web2py/source/diff?spec=svnfc75444ca55590835...

   On Jan 13, 11:31 am, drayco antrod...@gmail.com wrote:

I need that some of you guys check this, in my case, Pymysql have some
issues with legacy databases (First, I think this issue is of new dal,
but I'm not sure)
However mysqldb, my application work well

this is my report:

   http://groups.google.com/group/web2py/browse_thread/thread/72e91e281e...

On Jan 12, 11:46 am, Vasile Ermicioi elff...@gmail.com wrote:

 hi,

 Massimo, there is a new  version of pymysql

 I think pymysql has a few advantages
 - being pure Python, PyMySQL is easily patched by gevent and the 
 likes to
 make it cooperative

http://code.google.com/p/pymysql/wiki/WhyPyMySQL

 I use it with web2py and works fine




[web2py] Re: Using mysqldb instead of pymysql

2011-01-18 Thread drayco
Hi, I do this revert, thank's

try:
import MySQLdb
drivers.append('MySQL')
except ImportError:
logger.debug('no MySQLdb driver')

And

self.pool_connection(lambda db=db,
 user=credential_decoder(user),
 password=credential_decoder(password),
 host=host,
 port=port,
 charset=charset:
MySQLdb.Connection(db=db,
 
user=user,
 
passwd=password,
 
host=host,
 
port=port,
 
charset=charset,
  ))
In dal.py
However, the error is still appear

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
16, in module
migrate = False)
  File /home/drayco/web2py/gluon/dal.py, line 3457, in define_table
sequence_name=sequence_name))
  File /home/drayco/web2py/gluon/dal.py, line 3741, in __init__
primarykey must be a list of fields from table '%s  % tablename
SyntaxError: primarykey must be a list of fields from table
'med_dnpmst_4

Well I think this is a problem with compatibility.

Do you have any suggestions?

On Jan 14, 6:36 pm, Luther Goh Lu Feng elf...@yahoo.com wrote:
 To test if the issue is with pymysql, you could edit the dal file to
 use mysqldb

 http://code.google.com/p/web2py/source/diff?spec=svnfc75444ca55590835...

 On Jan 13, 11:31 am, drayco antrod...@gmail.com wrote:

  I need that some of you guys check this, in my case, Pymysql have some
  issues with legacy databases (First, I think this issue is of new dal,
  but I'm not sure)
  However mysqldb, my application work well

  this is my report:

 http://groups.google.com/group/web2py/browse_thread/thread/72e91e281e...

  On Jan 12, 11:46 am, Vasile Ermicioi elff...@gmail.com wrote:

   hi,

   Massimo, there is a new  version of pymysql

   I think pymysql has a few advantages
   - being pure Python, PyMySQL is easily patched by gevent and the likes to
   make it cooperative

  http://code.google.com/p/pymysql/wiki/WhyPyMySQL

   I use it with web2py and works fine




[web2py] Re: Can any help me with new dal in trunk?

2011-01-18 Thread drayco
Hi, When we have available that change?

And Can you give us a little example?

Because, I'm testing my application on the trunk version and I keep
getting the same error.

On Jan 8, 4:40 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 We should have a flag to change this behavior DAL(...,lowercase=True).
 I would take a patch.

 On Jan 8, 2:58 pm, Thadeus Burgess thade...@thadeusb.com wrote:

   All I know is that tables are issued as lowercase, but you can still access
  your table as an uppercase attribute.

  There is an inconsistency in the DAL somewhere because of this... Somewhere
  it is forgetting to convert to lower case. I don't know why converting table
  names to lower case is forced in web2py and I disagree with it.

  for example:

  db = DAL()
  db.define_table('TableA', Field('Superman'))
  # CREATE TABLE tablea WITH FIELDS superman
  db(db.TableA.Superman == clark).select().first().Superman
  # SELECT * FROM tablea WHERE superman=clark

  --
  Thadeus

  On Sat, Jan 8, 2011 at 1:17 AM, mart msenecal...@gmail.com wrote:
   really? I didn't know, thanks for pointing that out...

   just out of curiosity

   in

   in __getitem__
      return dict.__getitem__(self, str(key))
   KeyError: 'tecnogradua'

   don't the attribute lookups get done by python ultimately?  Just
   trying to understand...
   how could this have worked if doing x.__getitem__ ? Even if dal does a
   string.lower() or something, once the table is named and created,
   would something (outside of migrate) not catch that error and set off
   the alarm even before any change need to happen?

   Thanks,
   Mart :)

   On Jan 8, 1:44 am, Thadeus Burgess thade...@thadeusb.com wrote:
I can also confirm this is a bug with the new DAL.

It is only caused when using upper case characters in the table or field
names. It seems that web2py converts all of the tablenames to lower case
when issuing the SQL (so your actual tables are lower regardless of what
   you
specify in the python). There is something in the migrations that cause
   this
to come up, because it will work just fine one run and crash on another
   run
after changing some unrelated tables.

I don't think the DAL should force the tables to lowercase.

--
Thadeus

On Sat, Jan 8, 2011 at 12:38 AM, mart msenecal...@gmail.com wrote:
 no, this is python...

 not sure how it could have worked before, but the key (technogradua)
 in .keys() is not being picked up... dal is simply pointing that out
 with the exception being thrown. I did notice when I made the switch
 that a few more of my mistakes got picked up (or it could be that I
 forgot that I changed something), but regardless... since switching to
 the latest DAL release and fixing my mistakes that it quickly picked
 up, I have had no problems (except those that I cause). I would simply
 take those exceptions for cash, change the case and enjoy one less
 exception ;)

 Mart :)

 On Jan 8, 1:19 am, drayco antrod...@gmail.com wrote:
  Ok, I understand your point.

  But this is a issue of DAL or what?

  because I only update web2py to trunk version

  On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote:

   Probably just being unhappy with the case :)

   tecnoGradua != tecnogradua

   Mart :)

   Field(tecnoGradua, 'string',

   On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:

Hi, this code works with web2py 1.89.5 with mysql

but with web2py in trunk and mysql it dosent works.

db.define_table(lentes,
    audit,
    Field(tecnoGradua, 'string',

   requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
de Graduaciones),
    Field(material, string, requires=IS_IN_SET(['MICA
 CR-39','ORMA
1.50','HIGH INDEX','THIN  LITE 1.67
ASFÉRICA','POLICARBONATO','CRISTAL'])),
    Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX 
COMFORT
NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT
   SHORT']))),
    Field(tecnoVisual,

   'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label=
 Tecnologia
de Visualización),
    Field(tratamiento,
   string,requires=IS_NULL_OR(IS_IN_SET(['CON
ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
    Field('limitup','double', writable=False, readable=False),
    Field('limitdown','double', writable=False, readable=False),
    Field(promo, double,
   requires=[IS_NOT_EMPTY(error_message='No
puede estar 
vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe
   ser
un numero positivo entre 0 y 1')], label='Precio de
   Promoción'),
    Field(precio, double, writable=False, readable=False),
    Field(costo, double, writable=False

[web2py] Re: Using mysqldb instead of pymysql

2011-01-12 Thread drayco
I need that some of you guys check this, in my case, Pymysql have some
issues with legacy databases (First, I think this issue is of new dal,
but I'm not sure)
However mysqldb, my application work well

this is my report:

http://groups.google.com/group/web2py/browse_thread/thread/72e91e281e0610d8/099e21f098ae8501?lnk=gstq=new+dal#099e21f098ae8501


On Jan 12, 11:46 am, Vasile Ermicioi elff...@gmail.com wrote:
 hi,

 Massimo, there is a new  version of pymysql

 I think pymysql has a few advantages
 - being pure Python, PyMySQL is easily patched by gevent and the likes to
 make it cooperative

 http://code.google.com/p/pymysql/wiki/WhyPyMySQL

 I use it with web2py and works fine


[web2py] Can any help me with new dal in trunk?

2011-01-07 Thread drayco
Hi, this code works with web2py 1.89.5 with mysql

but with web2py in trunk and mysql it dosent works.

db.define_table(lentes,
audit,
Field(tecnoGradua, 'string',
requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
de Graduaciones),
Field(material, string, requires=IS_IN_SET(['MICA CR-39','ORMA
1.50','HIGH INDEX','THIN  LITE 1.67
ASFÉRICA','POLICARBONATO','CRISTAL'])),
Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT
NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))),
Field(tecnoVisual,
'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label=Tecnologia
de Visualización),
Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON
ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
Field('limitup','double', writable=False, readable=False),
Field('limitdown','double', writable=False, readable=False),
Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No
puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser
un numero positivo entre 0 y 1')], label='Precio de Promoción'),
Field(precio, double, writable=False, readable=False),
Field(costo, double, writable=False, readable=False),
Field(observaciones,text, writable=False, readable=False))

This is the traceback

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/movil/models/db.py, line
272, in module
Field(observaciones,text, writable=False, readable=False))
  File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table
polymodel=polymodel)
  File /home/drayco/web2py/gluon/dal.py, line 551, in create_table
fake_migrate=fake_migrate)
  File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table
and not isinstance(table[key].type, SQLCustomType) \
  File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'tecnogradua'

Can I need to change something?


[web2py] Can any help me with new dal in trunk (2)?

2011-01-07 Thread drayco
Hi, this code works with web2py 1.83.2 and mysql

but,with web2py in trunk and mysql it doesn't works

cfedb.define_table('med_dnpmst_4',
Field('DireccionUTR', 'integer' , length = 6 ),
Field('Indice', 'id' ),
Field('ValorActual', 'double' ),
Field('Resolucion', 'integer' , length = 4 ),
Field('ClaveMaxyMinIngenieril', 'integer' , length = 1 ),
Field('BandaMuerta', 'double' ),
Field('Tipo', 'integer' , length = 1 ),
Field('ClaveMediciones', 'integer' , length = 6 ),
primarykey=['DireccionUTR','Indice'],
migrate = False)

This is the traceback

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/iscada/models/cfedb.py, line
16, in module
migrate = False)
  File /home/drayco/web2py/gluon/dal.py, line 3429, in define_table
sequence_name=sequence_name))
  File /home/drayco/web2py/gluon/dal.py, line 3713, in __init__
primarykey must be a list of fields from table '%s  % tablename
SyntaxError: primarykey must be a list of fields from table
'med_dnpmst_4

Can I need to change something?


[web2py] Re: Can any help me with new dal in trunk?

2011-01-07 Thread drayco
Ok, I understand your point.

But this is a issue of DAL or what?

because I only update web2py to trunk version

On Jan 8, 12:15 am, mart msenecal...@gmail.com wrote:
 Probably just being unhappy with the case :)

 tecnoGradua != tecnogradua

 Mart :)

 Field(tecnoGradua, 'string',

 On Jan 8, 12:57 am, drayco antrod...@gmail.com wrote:

  Hi, this code works with web2py 1.89.5 with mysql

  but with web2py in trunk and mysql it dosent works.

  db.define_table(lentes,
      audit,
      Field(tecnoGradua, 'string',
  requires=IS_IN_SET(['MONOFOCAL','BIFOCAL','MULTIFOCAL']),label=Num.
  de Graduaciones),
      Field(material, string, requires=IS_IN_SET(['MICA CR-39','ORMA
  1.50','HIGH INDEX','THIN  LITE 1.67
  ASFÉRICA','POLICARBONATO','CRISTAL'])),
      Field(tipo, string,requires=IS_NULL_OR(IS_IN_SET(['FLAT
  TOP','BLEND O YOUNGER','PROGRESIVOS','PROGRESIVOS VARILUX COMFORT
  NE','PROGRESIVOS COMPACTOS','PROGRESIVOS VARILUX COMFORT SHORT']))),
      Field(tecnoVisual,
  'string',requires=IS_NULL_OR(IS_IN_SET(['PHOTOGRAY','TRANSITIONS'])),label= 
  Tecnologia
  de Visualización),
      Field(tratamiento, string,requires=IS_NULL_OR(IS_IN_SET(['CON
  ANTIRREFLEJANTE','ESPEJEADO','CRIZAL FORTE','CRIZAL ALIZÉ']))),
      Field('limitup','double', writable=False, readable=False),
      Field('limitdown','double', writable=False, readable=False),
      Field(promo, double, requires=[IS_NOT_EMPTY(error_message='No
  puede estar vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser
  un numero positivo entre 0 y 1')], label='Precio de Promoción'),
      Field(precio, double, writable=False, readable=False),
      Field(costo, double, writable=False, readable=False),
      Field(observaciones,text, writable=False, readable=False))

  This is the traceback

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 188, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/movil/models/db.py, line
  272, in module
      Field(observaciones,text, writable=False, readable=False))
    File /home/drayco/web2py/gluon/dal.py, line 3441, in define_table
      polymodel=polymodel)
    File /home/drayco/web2py/gluon/dal.py, line 551, in create_table
      fake_migrate=fake_migrate)
    File /home/drayco/web2py/gluon/dal.py, line 595, in migrate_table
      and not isinstance(table[key].type, SQLCustomType) \
    File /home/drayco/web2py/gluon/dal.py, line 3778, in __getitem__
      return dict.__getitem__(self, str(key))
  KeyError: 'tecnogradua'

  Can I need to change something?




[web2py] Re: Can any help me with crud.archive?

2011-01-07 Thread drayco
Well, only a litle typo in page 324

db.define_table('notas_archive',
Field('current_record',db.notas),
db.notas)

However all it's works ok.

On Dec 8 2010, 7:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 which web2py version?

 On Dec 8, 6:30 pm, drayco antrod...@gmail.com wrote:

  Hi

  I have this in model

  #audit field group
  audit = db.Table(db,'audit',
      Field('unique_id', 'string',default=uuid.uuid4(), writable=False,
  readable=False),
      Field('active', 'boolean', default=True, writable=False,
  readable=False, label='Activo',comment='Desactiva para eliminar este
  registro'),
      Field('created_by', db.auth_user, default=user_id, writable=False,
  readable=False, label='Creado por'),
      Field('created_on', 'datetime', default=request.now,
  writable=False, readable=False, label='Creado el'),
      Field('modified_by', db.auth_user, default=user_id,
  update=user_id, writable=False, readable=False, label='Modificado
  por'),
      Field('modified_on', 'datetime', default=request.now,
  update=request.now, writable=False, readable=False, label='Modificado
  el'),
      Field('reason','string' ,default='nueva
  información',requires=IS_IN_SET(['cambio', 'nueva información',
  'corrección']), writable=False, readable=False, label='Razon'))

  db.define_table(notas,
      audit,
      Field(store_id,db.stores, default=store.store_id,
  writable=False, label='Sucursal',comment='A la que se encuentra
  asignado'),
      Field('nota', 'integer', default=None,
  writable=False,label='No.Nota(Sistema)',comment='Remisión generada por
  el Sistema'),
      Field('notaFisica','integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser
  Numero positivo entre 2500 y
  66500')),label='No.Nota(Elaborada)',comment='Remision'),
      Field('vale', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser
  Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento
  para Arm1/Len1'),
      Field('folio', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe
  ser Numero positivo entre 11 y 191999')),label='Num.Folio'),
      Field('first_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'),
      Field('last_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'),
      Field('end_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'),
      Field('tel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Casa'),
      Field('tel1','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Trabajo'),
      Field('cel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Celular',comment='Sin 044'),
      Field('email','string', default=None,
  requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'),
      Field('armazon1',db.eyewear,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s %
  (modelo)s %(color)s %(caract1)s $%(promo)s'))),
      Field('modelo1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo
  armazon1'),
      Field('color1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó
  ñ!')),label='Color(es) armazon1'),
      Field('lente1',db.lentes,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','%
  (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $%
  (promo)s'))),
      Field('soloLoC1','string',
  default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo
  para lejos'])), label='Lejos ó Cerca 1'),
      Field('tinte1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
      Field(vendedor,db.auth_user, default=user_id,
  requires=IS_NULL_OR(IS_IN_DB(vendedores,'auth_user.id','%(first_name)s
  %(last_name)s %(end_name)s'))),
      Field(total, double, default=0, writable=False),
      Field(anticipo, double, default=0,
  requires=[IS_NOT_EMPTY(error_message='No puede estar
  vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero
  positivo entre 0 y 1')]),
      Field(pagos, double, default=0, writable=False),
      Field(saldo, double, default=0, writable=False),
      Field(fechaEntrega, date,default=(request.now
  +datetime.timedelta(14)), label='Fecha de Entrega'),
      Field(optometrista,db.auth_user,
  default=None,requires=IS_NULL_OR(IS_IN_DB(optometristas,'auth_user.id','%
  (first_name)s %(last_name)s %(end_name)s'))),
      Field

[web2py] Can any help me with crud.create?

2010-12-09 Thread drayco
caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
Field('lc4',db.lc,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lc.id','%(tecnoGradua)s %
(marca)s %(duracion)s %(oftalmico)s %(cosmetico)s $%
(promo)s')),label='L/C (4)'),
Field('color4','string',default=None,
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
Field('lc5',db.lc,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lc.id','%(tecnoGradua)s %
(marca)s %(duracion)s %(oftalmico)s %(cosmetico)s $%
(promo)s')),label='L/C (5)'),
Field('color5','string',default=None,
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
Field(producto6,db.productos,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'productos.id','%
(producto)s %(modelo)s %(caract1)s %(caract2)s %(caract3)s %(caract4)s
$%(promo)s'))),
Field('cantidad6','integer',default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(0,1e100,error_message='Debe ser
Numero positivo')),label='Cantidad producto6',comment='más de 1'),
Field(producto7,db.productos,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'productos.id','%
(producto)s %(modelo)s %(caract1)s %(caract2)s %(caract3)s %(caract4)s
$%(promo)s'))),
Field('cantidad7','integer',default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(0,1e100,error_message='Debe ser
Numero positivo')),label='Cantidad producto7',comment='más de 1'),
Field(vendedor,db.auth_user, default=user_id,
requires=IS_NULL_OR(IS_IN_DB(vendedores,'auth_user.id','%(first_name)s
%(last_name)s %(end_name)s'))),
Field(total, double, default=0, writable=False),
Field(anticipo, double, default=0,
requires=[IS_NOT_EMPTY(error_message='No puede estar
vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero
positivo entre 0 y 1')]),
Field(pagos, double, default=0, writable=False),
Field(saldo, double, default=0, writable=False),
Field(fechaEntrega, date,default=(request.now
+datetime.timedelta(14)), label='Fecha de Entrega'),
Field(optometrista,db.auth_user,
default=None,requires=IS_NULL_OR(IS_IN_DB(optometristas,'auth_user.id','%
(first_name)s %(last_name)s %(end_name)s'))),
Field('retiOdEsf','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo
Der.Esf.'),
Field('retiOdCil','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-12.1,0)),label='Ojo
Der.Cil.'),
Field('retiOdEje','integer',
default=None,requires=IS_NULL_OR(IS_INT_IN_RANGE(0,181)),label='Ojo
Der.Eje'),
Field('retiOiEsf','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo
Izq.Esf.'),
Field('retiOiCil','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-12.1,0)),label='Ojo
Izq.Cil.'),
Field('retiOiEje','integer',
default=None,requires=IS_NULL_OR(IS_INT_IN_RANGE(0,181)),label='Ojo
Izq Eje'),
Field('adicion','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0.75,3.51)),label='Adición'),
Field('dipC','integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(35,85)), label='D.I.P.
Cerca(mm)'),
Field('dipL','integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(35,85)), label='D.I.P.
Lejos(mm)'),
Field('alt','integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(10,30)), label='Altura Centro
Óptico(mm)'),
Field('observaciones','string', default=None),
Field('diabetes','string', default=None),
Field('hipertension','string', default=None),
Field('garantia', 'integer', default=None, label='Garantia de la
Nota'),
Field('entregado','boolean', default=False, writable=False),
Field('entregadoEl', 'datetime', default=None, label='Entregado
el', writable=False))

This is the new track

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/opticaluz/models/db.py, line
444, in module
import webgrid
  File /home/drayco/web2py/site-packages/webgrid.py, line 15, in
module
from gluon.sql import Rows, Field, Set
ImportError: cannot import name Rows


[web2py] Re: Can any help me with crud.create?

2010-12-09 Thread drayco
Hi, this is the new traceback

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/opticaluz/controllers/
ventas.py, line 1086, in module
  File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
self._caller = lambda f: f()
  File /home/drayco/web2py/gluon/tools.py, line 2315, in f
return action(*a, **b)
  File /home/drayco/web2py/applications/opticaluz/controllers/
ventas.py, line 1056, in realizar_venta
return dict(form=crud.create(db.notas, next=URL(r=request,
f='leer_ventas'), onvalidation=procesing_nota,
onaccept=procesing_taller))
  File /home/drayco/web2py/gluon/tools.py, line 2889, in create
deletable=False,
  File /home/drayco/web2py/gluon/tools.py, line 2805, in update
formstyle=self.settings.formstyle
  File /home/drayco/web2py/gluon/sqlhtml.py, line 792, in __init__
inp = self.widgets.options.widget(field, default)
  File /home/drayco/web2py/gluon/sqlhtml.py, line 205, in widget
options = requires[0].options()
  File /home/drayco/web2py/gluon/validators.py, line 2350, in
_options
options = self.other.options()
  File /home/drayco/web2py/gluon/validators.py, line 424, in options
self.build_set()
  File /home/drayco/web2py/gluon/validators.py, line 408, in
build_set
records = self.dbset.select(*self.fields, **dd)
  File /home/drayco/web2py/gluon/dal.py, line 4369, in select
return self.db._adapter.select(self.query,fields,attributes)
  File /home/drayco/web2py/gluon/dal.py, line 976, in select
query = self._select(query,fields,attributes)
  File /home/drayco/web2py/gluon/dal.py, line 911, in _select
raise SyntaxError, 'Set: no tables selected'
SyntaxError: Set: no tables selected

On Dec 9, 9:17 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Should be fixed now.

 On Dec 9, 9:08 am, drayco antrod...@gmail.com wrote:

  Hi, in web2py 1.89.5 works but in trunk no

  This is in the controller

  def realizar_venta():
      return dict(form=crud.create(db.notas, next=URL(r=request,
  f='leer_ventas'), onvalidation=procesing_nota,
  onaccept=procesing_taller))

  This is in the model

  db.define_table(notas,
      audit,
      Field(store_id,db.stores, default=store.store_id,
  writable=False, label='Sucursal',comment='A la que se encuentra
  asignado'),
      Field('nota', 'integer', default=None,
  writable=False,label='No.Nota(Sistema)',comment='Remisión generada por
  el Sistema'),
      Field('notaFisica','integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser
  Numero positivo entre 2500 y
  66500')),label='No.Nota(Elaborada)',comment='Remision'),
      Field('vale', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser
  Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento
  para Arm1/Len1'),
      Field('folio', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe
  ser Numero positivo entre 11 y 191999')),label='Num.Folio'),
      Field('first_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'),
      Field('last_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'),
      Field('end_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'),
      Field('tel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Casa'),
      Field('tel1','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Trabajo'),
      Field('cel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Celular',comment='Sin 044'),
      Field('email','string', default=None,
  requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'),
      Field('armazon1',db.eyewear,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s %
  (modelo)s %(color)s %(caract1)s $%(promo)s'))),
      Field('modelo1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo
  armazon1'),
      Field('color1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó
  ñ!')),label='Color(es) armazon1'),
      Field('lente1',db.lentes,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','%
  (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $%
  (promo)s'))),
      Field('soloLoC1','string',
  default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo
  para lejos'])), label='Lejos ó Cerca 1'),
      Field('tinte1','string', default=None,
  requires=IS_NULL_OR

[web2py] Re: Can any help me with crud.create?

2010-12-09 Thread drayco
Hi, I send you the application that you request me. I develop that for
my wife business.

I use ubuntu 10.04, mysql, python 2.6 and web2py version in trunk
and in web2py 1.89.5 it works.

I hope this help you.

On Dec 9, 11:18 am, mdipierro mdipie...@cs.depaul.edu wrote:
 can you email me (confidentially) a minimalist app to reproduce the
 problem?

 On Dec 9, 9:08 am, drayco antrod...@gmail.com wrote:

  Hi, in web2py 1.89.5 works but in trunk no

  This is in the controller

  def realizar_venta():
      return dict(form=crud.create(db.notas, next=URL(r=request,
  f='leer_ventas'), onvalidation=procesing_nota,
  onaccept=procesing_taller))

  This is in the model

  db.define_table(notas,
      audit,
      Field(store_id,db.stores, default=store.store_id,
  writable=False, label='Sucursal',comment='A la que se encuentra
  asignado'),
      Field('nota', 'integer', default=None,
  writable=False,label='No.Nota(Sistema)',comment='Remisión generada por
  el Sistema'),
      Field('notaFisica','integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser
  Numero positivo entre 2500 y
  66500')),label='No.Nota(Elaborada)',comment='Remision'),
      Field('vale', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser
  Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento
  para Arm1/Len1'),
      Field('folio', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe
  ser Numero positivo entre 11 y 191999')),label='Num.Folio'),
      Field('first_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'),
      Field('last_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'),
      Field('end_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'),
      Field('tel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Casa'),
      Field('tel1','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Trabajo'),
      Field('cel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Celular',comment='Sin 044'),
      Field('email','string', default=None,
  requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'),
      Field('armazon1',db.eyewear,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s %
  (modelo)s %(color)s %(caract1)s $%(promo)s'))),
      Field('modelo1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo
  armazon1'),
      Field('color1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó
  ñ!')),label='Color(es) armazon1'),
      Field('lente1',db.lentes,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','%
  (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $%
  (promo)s'))),
      Field('soloLoC1','string',
  default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo
  para lejos'])), label='Lejos ó Cerca 1'),
      Field('tinte1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
      Field('armazon2',db.eyewear,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s %
  (modelo)s %(color)s %(caract1)s $%(promo)s'))),
      Field('modelo2','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo
  armazon2'),
      Field('color2','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó
  ñ!')),label='Color(es) armazon2'),
      Field('lente2',db.lentes,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','%
  (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $%
  (promo)s'))),
      Field('soloLoC2','string',
  default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo
  para lejos'])), label='Lejos ó Cerca 2'),
      Field('tinte2','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
      Field('armazon3',db.eyewear,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s %
  (modelo)s %(color)s %(caract1)s $%(promo)s'))),
      Field('modelo3','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo
  armazon3'),
      Field

[web2py] Can any help me with crud.search?

2010-12-08 Thread drayco
Hi

I have this code in the model:

db36.define_table('benefs2',
#Field('id','integer'),
Field('unique_id','string', writable=False, readable=False),
Field('active','string', writable=False, readable=False),
Field('creadoEl','datetime', writable=False, readable=False),
Field('creadoPor','integer', writable=False, readable=False),
Field('actualizadoEl','datetime', writable=False, readable=False),
Field('actualizadoPor','integer', writable=False, readable=False),
Field('reason','string', writable=False, readable=False),
Field('key_Registro','string', writable=False, readable=False),
Field('folio','integer'),
Field('dates2_id','integer', writable=False, readable=False),
Field('tramite','datetime'),
Field('entrega','datetime', writable=False, readable=False),
Field('regional_id','integer', writable=False, readable=False),
Field('coordinador_id','integer', writable=False, readable=False),
Field('parentesco','integer', writable=False, readable=False),
Field('names','string'),
Field('apelPater','string'),
Field('apelMater','string'),
Field('rfc','string'),
Field('sexo','string', writable=False, readable=False),
Field('enfermedades','integer', writable=False, readable=False),
Field('categoria','string', writable=False, readable=False),
Field('namesWorked','string'),
Field('apelPaterWorked','string'),
Field('apelMaterWorked','string'),
Field('rfcWorked','string'),
Field('domicilioWorked','string', writable=False, readable=False),
Field('cpWorked','integer', writable=False, readable=False),
Field('telWorked','double', writable=False, readable=False),
Field('celWorked','double', writable=False, readable=False),
Field('teltrabWorked','double', writable=False, readable=False),
Field('sexoWorked','string', writable=False, readable=False),
Field('delegacionCT','string', writable=False, readable=False),
Field('zona_Escolar','string', writable=False, readable=False),
Field('nivel_Educativo','string', writable=False, readable=False),
Field('subdireccion','string', writable=False, readable=False),
migrate=False)

and this code in the controller:

@auth.requires_membership('Ventas')
def buscar_benefs():
form, results = crud36.search( db36.benefs2,
queries = ['contains'],
query_labels={'contains':'Contiene'},
fields = [db36.benefs2.folio,
db36.benefs2.tramite,db36.benefs2.names,db36.benefs2.apelPater,db36.benefs2.apelMater,db36.benefs2.rfc,
\
 
db36.benefs2.namesWorked,db36.benefs2.apelPaterWorked,db36.benefs2.apelMaterWorked,db36.benefs2.rfcWorked],
field_labels = {'folio':'Folio',
'tramite':'Fecha de
Tramite','names':'Nombres','apelPater':'Apel.Pater.','apelMater':'Aperl.Mater',
'rfc':'RFC',\
 
'namesWorked':'Trab.Nombres','apelPaterWorked':'Trab.Apel.Pater.','apelMaterWorked':'Trab.Aperl.Mater',
'rfcWorked':'Trab.RFC'},
zero='Por favor, seleccione al menos una',
query =
(db36.benefs2.id0)(db36.benefs2.active=='T') )
return dict(form=form, results=results)

I need to put writable=False and readable=False in every field of the
model because crud.serch don't respect fields and field_labels

And I don't want to show the id and in other tables I don't want to
put in every field writable=False and readable=False.

Can any have some advice to avoid that issue?


[web2py] Can any help me with crud.archive?

2010-12-08 Thread drayco
Hi

I have this in model

#audit field group
audit = db.Table(db,'audit',
Field('unique_id', 'string',default=uuid.uuid4(), writable=False,
readable=False),
Field('active', 'boolean', default=True, writable=False,
readable=False, label='Activo',comment='Desactiva para eliminar este
registro'),
Field('created_by', db.auth_user, default=user_id, writable=False,
readable=False, label='Creado por'),
Field('created_on', 'datetime', default=request.now,
writable=False, readable=False, label='Creado el'),
Field('modified_by', db.auth_user, default=user_id,
update=user_id, writable=False, readable=False, label='Modificado
por'),
Field('modified_on', 'datetime', default=request.now,
update=request.now, writable=False, readable=False, label='Modificado
el'),
Field('reason','string' ,default='nueva
información',requires=IS_IN_SET(['cambio', 'nueva información',
'corrección']), writable=False, readable=False, label='Razon'))

db.define_table(notas,
audit,
Field(store_id,db.stores, default=store.store_id,
writable=False, label='Sucursal',comment='A la que se encuentra
asignado'),
Field('nota', 'integer', default=None,
writable=False,label='No.Nota(Sistema)',comment='Remisión generada por
el Sistema'),
Field('notaFisica','integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser
Numero positivo entre 2500 y
66500')),label='No.Nota(Elaborada)',comment='Remision'),
Field('vale', 'integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser
Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento
para Arm1/Len1'),
Field('folio', 'integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe
ser Numero positivo entre 11 y 191999')),label='Num.Folio'),
Field('first_name','string', default=None,
requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'),
Field('last_name','string', default=None,
requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'),
Field('end_name','string', default=None,
requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'),
Field('tel','double', default=None,
requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
Numero positivo')), label='Tel.Casa'),
Field('tel1','double', default=None,
requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
Numero positivo')), label='Tel.Trabajo'),
Field('cel','double', default=None,
requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
Numero positivo')), label='Tel.Celular',comment='Sin 044'),
Field('email','string', default=None,
requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'),
Field('armazon1',db.eyewear,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s %
(modelo)s %(color)s %(caract1)s $%(promo)s'))),
Field('modelo1','string', default=None,
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo
armazon1'),
Field('color1','string', default=None,
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos, sin espacios en blanco ó
ñ!')),label='Color(es) armazon1'),
Field('lente1',db.lentes,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','%
(tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $%
(promo)s'))),
Field('soloLoC1','string',
default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo
para lejos'])), label='Lejos ó Cerca 1'),
Field('tinte1','string', default=None,
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
Field(vendedor,db.auth_user, default=user_id,
requires=IS_NULL_OR(IS_IN_DB(vendedores,'auth_user.id','%(first_name)s
%(last_name)s %(end_name)s'))),
Field(total, double, default=0, writable=False),
Field(anticipo, double, default=0,
requires=[IS_NOT_EMPTY(error_message='No puede estar
vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero
positivo entre 0 y 1')]),
Field(pagos, double, default=0, writable=False),
Field(saldo, double, default=0, writable=False),
Field(fechaEntrega, date,default=(request.now
+datetime.timedelta(14)), label='Fecha de Entrega'),
Field(optometrista,db.auth_user,
default=None,requires=IS_NULL_OR(IS_IN_DB(optometristas,'auth_user.id','%
(first_name)s %(last_name)s %(end_name)s'))),
Field('retiOdEsf','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo
Der.Esf.'),
Field('retiOdCil','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-12.1,0)),label='Ojo
Der.Cil.'),
Field('retiOdEje','integer',
default=None,requires=IS_NULL_OR(IS_INT_IN_RANGE(0,181)),label='Ojo
Der.Eje'),
Field('retiOiEsf','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo
Izq.Esf.'),
Field('retiOiCil','double',

[web2py] Can any help me with SQLFORM.factory?

2010-12-08 Thread drayco
(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),db.notas.total.sum()/
db.notas.id.count(),\
orderby=~db.notas.id.count(),groupby=db.notas.vendedor),\
 
headers={'notas.vendedor':'Vendedor','COUNT(notas.id)':'Notas','SUM(notas.total)':'Total','SUM(notas.anticipo)':'Anticipo','SUM(notas.pagos)':'Pagos','SUM(notas.saldo)':'Saldo','SUM(notas.total)/
COUNT(notas.id)':'Promedio'})
totalcero =
SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id==Gerente.store_id)(db.notas.active==True)(db.notas.total==0)).
\
 
select(db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum()),
\
headers={'COUNT(notas.id)':'Notas',
'SUM(notas.total)':'Total', 'SUM(notas.anticipo)':'Anticipo',
'SUM(notas.pagos)':'Pagos', 'SUM(notas.saldo)':'Saldo'})
cero =
SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id
== Gerente.store_id)(db.notas.active==True)(db.notas.garantia!
=None)(db.notas.vale!=None)(db.notas.total==0)).\
 
select(db.notas.vendedor,db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),
\
orderby=~db.notas.id.count(),groupby=db.notas.vendedor),\
 
headers={'notas.vendedor':'Vendedor','COUNT(notas.id)':'Notas','SUM(notas.total)':'Total','SUM(notas.anticipo)':'Anticipo','SUM(notas.pagos)':'Pagos','SUM(notas.saldo)':'Saldo'})
elif form.errors:
response.flash='Error en el formulario'
else:
response.flash='Por favor conteste el formulario'
return dict(form=form,total=total, regs=regs,
totalcorte=totalcorte,cortesias=cortesias,
totalc=totalc,cancel=cancel,
totalgaran=totalgaran,garantias=garantias,inicio=inicio,fin=fin,totalcero=totalcero,cero=cero)

It work in web2py 1.89.5, however after update trunk version it didn't
work, it give me this error:

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 1417, in module
  File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
self._caller = lambda f: f()
  File /home/drayco/web2py/gluon/tools.py, line 2315, in f
return action(*a, **b)
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 265, in ventas
SQLField('fin','date',default=request.now.date()))
  File /home/drayco/web2py/gluon/tools.py, line 2315, in f
return action(*a, **b)
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 259, in form_factory
return SQLFORM(SQLDB(None).define_table(*a))
  File /home/drayco/web2py/gluon/sql.py, line 3204, in __init__
raise RuntimeError, Adapter not supported
RuntimeError: Adapter not supported

Can any have some advice to avoid that issue?


[web2py] Re: Can any help me with crud.archive?

2010-12-08 Thread drayco
Ups, my bad

I tested on web2py version 1.89.5 and trunk

On Dec 8, 7:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 which web2py version?

 On Dec 8, 6:30 pm, drayco antrod...@gmail.com wrote:

  Hi

  I have this in model

  #audit field group
  audit = db.Table(db,'audit',
      Field('unique_id', 'string',default=uuid.uuid4(), writable=False,
  readable=False),
      Field('active', 'boolean', default=True, writable=False,
  readable=False, label='Activo',comment='Desactiva para eliminar este
  registro'),
      Field('created_by', db.auth_user, default=user_id, writable=False,
  readable=False, label='Creado por'),
      Field('created_on', 'datetime', default=request.now,
  writable=False, readable=False, label='Creado el'),
      Field('modified_by', db.auth_user, default=user_id,
  update=user_id, writable=False, readable=False, label='Modificado
  por'),
      Field('modified_on', 'datetime', default=request.now,
  update=request.now, writable=False, readable=False, label='Modificado
  el'),
      Field('reason','string' ,default='nueva
  información',requires=IS_IN_SET(['cambio', 'nueva información',
  'corrección']), writable=False, readable=False, label='Razon'))

  db.define_table(notas,
      audit,
      Field(store_id,db.stores, default=store.store_id,
  writable=False, label='Sucursal',comment='A la que se encuentra
  asignado'),
      Field('nota', 'integer', default=None,
  writable=False,label='No.Nota(Sistema)',comment='Remisión generada por
  el Sistema'),
      Field('notaFisica','integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(2500,66500,error_message='Debe ser
  Numero positivo entre 2500 y
  66500')),label='No.Nota(Elaborada)',comment='Remision'),
      Field('vale', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(1,500,error_message='Debe ser
  Numero positivo entre 1 y 500')),label='Num.Vale',comment='Descuento
  para Arm1/Len1'),
      Field('folio', 'integer', default=None,
  requires=IS_NULL_OR(IS_INT_IN_RANGE(11,191999,error_message='Debe
  ser Numero positivo entre 11 y 191999')),label='Num.Folio'),
      Field('first_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Nombre(s)'),
      Field('last_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Paterno'),
      Field('end_name','string', default=None,
  requires=IS_NULL_OR(IS_UPPER()),label='Apellido Materno'),
      Field('tel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Casa'),
      Field('tel1','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Trabajo'),
      Field('cel','double', default=None,
  requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser
  Numero positivo')), label='Tel.Celular',comment='Sin 044'),
      Field('email','string', default=None,
  requires=IS_NULL_OR(IS_EMAIL()),comment='Para enviar copia(pdf)'),
      Field('armazon1',db.eyewear,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'eyewear.id','%(marca)s %
  (modelo)s %(color)s %(caract1)s $%(promo)s'))),
      Field('modelo1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!')),label='Modelo
  armazon1'),
      Field('color1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó
  ñ!')),label='Color(es) armazon1'),
      Field('lente1',db.lentes,
  default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lentes.id','%
  (tecnoGradua)s %(material)s %(tipo)s %(tecnoVisual)s %(tratamiento)s $%
  (promo)s'))),
      Field('soloLoC1','string',
  default=None,requires=IS_NULL_OR(IS_IN_SET(['Solo para cerca','Solo
  para lejos'])), label='Lejos ó Cerca 1'),
      Field('tinte1','string', default=None,
  requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
  caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
      Field(vendedor,db.auth_user, default=user_id,
  requires=IS_NULL_OR(IS_IN_DB(vendedores,'auth_user.id','%(first_name)s
  %(last_name)s %(end_name)s'))),
      Field(total, double, default=0, writable=False),
      Field(anticipo, double, default=0,
  requires=[IS_NOT_EMPTY(error_message='No puede estar
  vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero
  positivo entre 0 y 1')]),
      Field(pagos, double, default=0, writable=False),
      Field(saldo, double, default=0, writable=False),
      Field(fechaEntrega, date,default=(request.now
  +datetime.timedelta(14)), label='Fecha de Entrega'),
      Field(optometrista,db.auth_user,
  default=None,requires=IS_NULL_OR(IS_IN_DB(optometristas,'auth_user.id','%
  (first_name)s %(last_name)s %(end_name)s'))),
      Field('retiOdEsf','double',
  default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo

[web2py] Re: Can any help me with SQLFORM.factory?

2010-12-08 Thread drayco
Hi, I updated trunk version, but error still happens

this the track

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 1417, in module
  File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
self._caller = lambda f: f()
  File /home/drayco/web2py/gluon/tools.py, line 2315, in f
return action(*a, **b)
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 278, in ventas
if form.accepts(request.vars,session):
  File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
self.vars.id = self.table.insert(**fields)
  File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
return self._db._adapter.insert(self,self._listify(fields))
  File /home/drayco/web2py/gluon/sql.py, line 690, in insert
raise e
AttributeError: 'BaseAdapter' object has no attribute 'cursor'

On Dec 8, 9:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I think this is now fixed. Please give it a try.

 On Dec 8, 6:42 pm, drayco antrod...@gmail.com wrote:

  Hi this the code in the controller:

  def form_factory(*a):
      return SQLFORM(SQLDB(None).define_table(*a))

  def ventas():
      form=form_factory('myform',

  SQLField('inicio','date',default=request.now.date(),requires=IS_NOT_EMPTY()),
          SQLField('fin','date',default=request.now.date()))
      total=''
      regs=''
      totalcorte=''
      cortesias=''
      totalc=''
      cancel=''
      totalgaran=''
      garantias=''
      totalcero=''
      cero=''
      inicio = ''
      fin = ''
      if form.accepts(request.vars,session):
          response.flash='Formulario aceptado'
          from datetime import datetime
          inicio = datetime.strptime(str(form.vars.inicio) + 
  00:00:00, %Y-%m-%d %H:%M:%S)
          if form.vars.fin==None:
              fin = inicio
              fin = fin.replace(hour=23,minute=59,second=59)
          else:
              fin = datetime.strptime(str(form.vars.fin) +  23:59:59,
  %Y-%m-%d %H:%M:%S)
          Gerente = db.auth_user(user_id)
          total =
  SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id==Gerente.store_id)(db.notas.active==True)(db.notas.garantia==None)(db.notas.vale==None)).
  \

  select(db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),db.notas.total.sum()/
  db.notas.id.count()),\
              headers={'COUNT(notas.id)':'Num.Notas',
  'SUM(notas.total)':'Total', 'SUM(notas.anticipo)':'Anticipo',
  'SUM(notas.pagos)':'Pagos',
  'SUM(notas.saldo)':'Saldo','SUM(notas.total)/
  COUNT(notas.id)':'Promedio'})
          regs =
  SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id
  ==
  Gerente.store_id)(db.notas.active==True)(db.notas.garantia==None)(db.notas.vale==None)).
  \

  select(db.notas.vendedor,db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),db.notas.total.sum()/
  db.notas.id.count(),\
              orderby=~(db.notas.total.sum()/
  db.notas.id.count()),groupby=db.notas.vendedor),\

  headers={'notas.vendedor':'Vendedor','COUNT(notas.id)':'Num.Notas','SUM(notas.total)':'Total','SUM(notas.anticipo)':'Anticipo','SUM(notas.pagos)':'Pagos','SUM(notas.saldo)':'Saldo','SUM(notas.total)/
  COUNT(notas.id)':'Promedio'})
          totalc =
  SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id==Gerente.store_id)(db.notas.active==False)).
  \

  select(db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum()),
  \
              headers={'COUNT(notas.id)':'Num.Notas',
  'SUM(notas.total)':'Total', 'SUM(notas.anticipo)':'Anticipo',
  'SUM(notas.pagos)':'Pagos', 'SUM(notas.saldo)':'Saldo'})
          cancel =
  SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id
  == Gerente.store_id)(db.notas.active==False)).\

  select(db.notas.vendedor,db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),
  \
              orderby=~db.notas.id.count(),groupby=db.notas.vendedor),\

  headers={'notas.vendedor':'Vendedor','COUNT(notas.id)':'Notas','SUM(notas.total)':'Total','SUM(notas.anticipo)':'Anticipo','SUM(notas.pagos)':'Pagos','SUM(notas.saldo)':'Saldo'})
          totalcorte =
  SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id==Gerente.store_id)(db.notas.active==True)(db.notas.vale!
  =None)).\

  select(db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum()),
  \
              headers={'COUNT(notas.id)':'Num.Notas',
  'SUM(notas.total)':'Total', 'SUM(notas.anticipo)':'Anticipo',
  'SUM(notas.pagos)':'Pagos', 'SUM(notas.saldo)':'Saldo'})
          cortesias =
  SQLTABLE(db

[web2py] Re: Can any help me with SQLFORM.factory?

2010-12-08 Thread drayco
Hi, I updated trunk version, but error still happens, but now all my
functions that use crud.(search,read,create) doesn't work

this the track

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 1417, in module
  File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
self._caller = lambda f: f()
  File /home/drayco/web2py/gluon/tools.py, line 2315, in f
return action(*a, **b)
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 278, in ventas
if form.accepts(request.vars,session):
  File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
self.vars.id = self.table.insert(**fields)
  File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
return new_fields
  File /home/drayco/web2py/gluon/sql.py, line 690, in insert
query = self._insert(table,fields)
AttributeError: 'BaseAdapter' object has no attribute 'cursor'

On Dec 8, 9:48 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Thanks for your tests. One more time please.

 On Dec 8, 9:37 pm, drayco antrod...@gmail.com wrote:

  Hi, I updated trunk version, but error still happens

  this the track

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 188, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/opticaluz/controllers/
  gerencia.py, line 1417, in module
    File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
      self._caller = lambda f: f()
    File /home/drayco/web2py/gluon/tools.py, line 2315, in f
      return action(*a, **b)
    File /home/drayco/web2py/applications/opticaluz/controllers/
  gerencia.py, line 278, in ventas
      if form.accepts(request.vars,session):
    File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
      self.vars.id = self.table.insert(**fields)
    File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
      return self._db._adapter.insert(self,self._listify(fields))
    File /home/drayco/web2py/gluon/sql.py, line 690, in insert
      raise e
  AttributeError: 'BaseAdapter' object has no attribute 'cursor'

  On Dec 8, 9:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I think this is now fixed. Please give it a try.

   On Dec 8, 6:42 pm, drayco antrod...@gmail.com wrote:

Hi this the code in the controller:

def form_factory(*a):
    return SQLFORM(SQLDB(None).define_table(*a))

def ventas():
    form=form_factory('myform',

SQLField('inicio','date',default=request.now.date(),requires=IS_NOT_EMPTY()),
        SQLField('fin','date',default=request.now.date()))
    total=''
    regs=''
    totalcorte=''
    cortesias=''
    totalc=''
    cancel=''
    totalgaran=''
    garantias=''
    totalcero=''
    cero=''
    inicio = ''
    fin = ''
    if form.accepts(request.vars,session):
        response.flash='Formulario aceptado'
        from datetime import datetime
        inicio = datetime.strptime(str(form.vars.inicio) + 
00:00:00, %Y-%m-%d %H:%M:%S)
        if form.vars.fin==None:
            fin = inicio
            fin = fin.replace(hour=23,minute=59,second=59)
        else:
            fin = datetime.strptime(str(form.vars.fin) +  23:59:59,
%Y-%m-%d %H:%M:%S)
        Gerente = db.auth_user(user_id)
        total =
SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id==Gerente.store_id)(db.notas.active==True)(db.notas.garantia==None)(db.notas.vale==None)).
\

select(db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),db.notas.total.sum()/
db.notas.id.count()),\
            headers={'COUNT(notas.id)':'Num.Notas',
'SUM(notas.total)':'Total', 'SUM(notas.anticipo)':'Anticipo',
'SUM(notas.pagos)':'Pagos',
'SUM(notas.saldo)':'Saldo','SUM(notas.total)/
COUNT(notas.id)':'Promedio'})
        regs =
SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id
==
Gerente.store_id)(db.notas.active==True)(db.notas.garantia==None)(db.notas.vale==None)).
\

select(db.notas.vendedor,db.notas.id.count(),db.notas.total.sum(),db.notas.anticipo.sum(),db.notas.pagos.sum(),db.notas.saldo.sum(),db.notas.total.sum()/
db.notas.id.count(),\
            orderby=~(db.notas.total.sum()/
db.notas.id.count()),groupby=db.notas.vendedor),\

headers={'notas.vendedor':'Vendedor','COUNT(notas.id)':'Num.Notas','SUM(notas.total)':'Total','SUM(notas.anticipo)':'Anticipo','SUM(notas.pagos)':'Pagos','SUM(notas.saldo)':'Saldo','SUM(notas.total)/
COUNT(notas.id)':'Promedio'})
        totalc =
SQLTABLE(db((db.notas.created_oninicio)(db.notas.created_onfin)(db.notas.store_id==Gerente.store_id

[web2py] Re: Can any help me with SQLFORM.factory?

2010-12-08 Thread drayco
:D wel olny crud.create doesn't work

this is the track

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/opticaluz/controllers/
ventas.py, line 1086, in module
  File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
self._caller = lambda f: f()
  File /home/drayco/web2py/gluon/tools.py, line 2315, in f
return action(*a, **b)
  File /home/drayco/web2py/applications/opticaluz/controllers/
ventas.py, line 1056, in realizar_venta
return dict(form=crud.create(db.notas, next=URL(r=request,
f='leer_ventas'), onvalidation=procesing_nota,
onaccept=procesing_taller))
  File /home/drayco/web2py/gluon/tools.py, line 2889, in create
deletable=False,
  File /home/drayco/web2py/gluon/tools.py, line 2805, in update
formstyle=self.settings.formstyle
  File /home/drayco/web2py/gluon/sqlhtml.py, line 792, in __init__
inp = self.widgets.options.widget(field, default)
  File /home/drayco/web2py/gluon/sqlhtml.py, line 205, in widget
options = requires[0].options()
  File /home/drayco/web2py/gluon/validators.py, line 2350, in
_options
options = self.other.options()
  File /home/drayco/web2py/gluon/validators.py, line 424, in options
self.build_set()
  File /home/drayco/web2py/gluon/validators.py, line 408, in
build_set
records = self.dbset.select(*self.fields, **dd)
  File /home/drayco/web2py/gluon/sql.py, line 4369, in select
return self.db._adapter.select(self.query,fields,attributes)
  File /home/drayco/web2py/gluon/sql.py, line 976, in select
query = self._select(query,fields,attributes)
  File /home/drayco/web2py/gluon/sql.py, line 911, in _select
raise SyntaxError, 'Set: no tables selected'
SyntaxError: Set: no tables selected

And the code of the controller is

def realizar_venta():
return dict(form=crud.create(db.notas, next=URL(r=request,
f='leer_ventas'), onvalidation=procesing_nota,
onaccept=procesing_taller))

On Dec 8, 10:30 pm, drayco antrod...@gmail.com wrote:
 Hi, I updated trunk version, but error still happens, but now all my
 functions that use crud.(search,read,create) doesn't work

 this the track

 Traceback (most recent call last):
   File /home/drayco/web2py/gluon/restricted.py, line 188, in
 restricted
     exec ccode in environment
   File /home/drayco/web2py/applications/opticaluz/controllers/
 gerencia.py, line 1417, in module
   File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
     self._caller = lambda f: f()
   File /home/drayco/web2py/gluon/tools.py, line 2315, in f
     return action(*a, **b)
   File /home/drayco/web2py/applications/opticaluz/controllers/
 gerencia.py, line 278, in ventas
     if form.accepts(request.vars,session):
   File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
     self.vars.id = self.table.insert(**fields)
   File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
     return new_fields
   File /home/drayco/web2py/gluon/sql.py, line 690, in insert
     query = self._insert(table,fields)
 AttributeError: 'BaseAdapter' object has no attribute 'cursor'

 On Dec 8, 9:48 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Thanks for your tests. One more time please.

  On Dec 8, 9:37 pm, drayco antrod...@gmail.com wrote:

   Hi, I updated trunk version, but error still happens

   this the track

   Traceback (most recent call last):
     File /home/drayco/web2py/gluon/restricted.py, line 188, in
   restricted
       exec ccode in environment
     File /home/drayco/web2py/applications/opticaluz/controllers/
   gerencia.py, line 1417, in module
     File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
       self._caller = lambda f: f()
     File /home/drayco/web2py/gluon/tools.py, line 2315, in f
       return action(*a, **b)
     File /home/drayco/web2py/applications/opticaluz/controllers/
   gerencia.py, line 278, in ventas
       if form.accepts(request.vars,session):
     File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
       self.vars.id = self.table.insert(**fields)
     File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
       return self._db._adapter.insert(self,self._listify(fields))
     File /home/drayco/web2py/gluon/sql.py, line 690, in insert
       raise e
   AttributeError: 'BaseAdapter' object has no attribute 'cursor'

   On Dec 8, 9:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:

I think this is now fixed. Please give it a try.

On Dec 8, 6:42 pm, drayco antrod...@gmail.com wrote:

 Hi this the code in the controller:

 def form_factory(*a):
     return SQLFORM(SQLDB(None).define_table(*a))

 def ventas():
     form=form_factory('myform',

 SQLField('inicio','date',default=request.now.date(),requires=IS_NOT_EMPTY()),
         SQLField('fin','date',default=request.now.date()))
     total=''
     regs=''
     totalcorte=''
     cortesias=''
     totalc

[web2py] Re: Can any help me with SQLFORM.factory?

2010-12-08 Thread drayco
:D, well only for this function realizar_venta, because other
crud.create works well

On Dec 8, 10:35 pm, drayco antrod...@gmail.com wrote:
 :D wel olny crud.create doesn't work

 this is the track

 Traceback (most recent call last):
   File /home/drayco/web2py/gluon/restricted.py, line 188, in
 restricted
     exec ccode in environment
   File /home/drayco/web2py/applications/opticaluz/controllers/
 ventas.py, line 1086, in module
   File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
     self._caller = lambda f: f()
   File /home/drayco/web2py/gluon/tools.py, line 2315, in f
     return action(*a, **b)
   File /home/drayco/web2py/applications/opticaluz/controllers/
 ventas.py, line 1056, in realizar_venta
     return dict(form=crud.create(db.notas, next=URL(r=request,
 f='leer_ventas'), onvalidation=procesing_nota,
 onaccept=procesing_taller))
   File /home/drayco/web2py/gluon/tools.py, line 2889, in create
     deletable=False,
   File /home/drayco/web2py/gluon/tools.py, line 2805, in update
     formstyle=self.settings.formstyle
   File /home/drayco/web2py/gluon/sqlhtml.py, line 792, in __init__
     inp = self.widgets.options.widget(field, default)
   File /home/drayco/web2py/gluon/sqlhtml.py, line 205, in widget
     options = requires[0].options()
   File /home/drayco/web2py/gluon/validators.py, line 2350, in
 _options
     options = self.other.options()
   File /home/drayco/web2py/gluon/validators.py, line 424, in options
     self.build_set()
   File /home/drayco/web2py/gluon/validators.py, line 408, in
 build_set
     records = self.dbset.select(*self.fields, **dd)
   File /home/drayco/web2py/gluon/sql.py, line 4369, in select
     return self.db._adapter.select(self.query,fields,attributes)
   File /home/drayco/web2py/gluon/sql.py, line 976, in select
     query = self._select(query,fields,attributes)
   File /home/drayco/web2py/gluon/sql.py, line 911, in _select
     raise SyntaxError, 'Set: no tables selected'
 SyntaxError: Set: no tables selected

 And the code of the controller is

 def realizar_venta():
     return dict(form=crud.create(db.notas, next=URL(r=request,
 f='leer_ventas'), onvalidation=procesing_nota,
 onaccept=procesing_taller))

 On Dec 8, 10:30 pm, drayco antrod...@gmail.com wrote:

  Hi, I updated trunk version, but error still happens, but now all my
  functions that use crud.(search,read,create) doesn't work

  this the track

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 188, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/opticaluz/controllers/
  gerencia.py, line 1417, in module
    File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
      self._caller = lambda f: f()
    File /home/drayco/web2py/gluon/tools.py, line 2315, in f
      return action(*a, **b)
    File /home/drayco/web2py/applications/opticaluz/controllers/
  gerencia.py, line 278, in ventas
      if form.accepts(request.vars,session):
    File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
      self.vars.id = self.table.insert(**fields)
    File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
      return new_fields
    File /home/drayco/web2py/gluon/sql.py, line 690, in insert
      query = self._insert(table,fields)
  AttributeError: 'BaseAdapter' object has no attribute 'cursor'

  On Dec 8, 9:48 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   Thanks for your tests. One more time please.

   On Dec 8, 9:37 pm, drayco antrod...@gmail.com wrote:

Hi, I updated trunk version, but error still happens

this the track

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 188, in
restricted
    exec ccode in environment
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 1417, in module
  File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
    self._caller = lambda f: f()
  File /home/drayco/web2py/gluon/tools.py, line 2315, in f
    return action(*a, **b)
  File /home/drayco/web2py/applications/opticaluz/controllers/
gerencia.py, line 278, in ventas
    if form.accepts(request.vars,session):
  File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
    self.vars.id = self.table.insert(**fields)
  File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
    return self._db._adapter.insert(self,self._listify(fields))
  File /home/drayco/web2py/gluon/sql.py, line 690, in insert
    raise e
AttributeError: 'BaseAdapter' object has no attribute 'cursor'

On Dec 8, 9:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:

 I think this is now fixed. Please give it a try.

 On Dec 8, 6:42 pm, drayco antrod...@gmail.com wrote:

  Hi this the code in the controller:

  def form_factory(*a):
      return SQLFORM(SQLDB(None).define_table(*a))

  def ventas():
      form=form_factory('myform

[web2py] Re: Can any help me with SQLFORM.factory?

2010-12-08 Thread drayco
Ok, it's work's now, I reset my instance and all work well

Thank's

On Dec 8, 10:43 pm, drayco antrod...@gmail.com wrote:
 :D, well only for this function realizar_venta, because other
 crud.create works well

 On Dec 8, 10:35 pm, drayco antrod...@gmail.com wrote:

  :D wel olny crud.create doesn't work

  this is the track

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 188, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/opticaluz/controllers/
  ventas.py, line 1086, in module
    File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
      self._caller = lambda f: f()
    File /home/drayco/web2py/gluon/tools.py, line 2315, in f
      return action(*a, **b)
    File /home/drayco/web2py/applications/opticaluz/controllers/
  ventas.py, line 1056, in realizar_venta
      return dict(form=crud.create(db.notas, next=URL(r=request,
  f='leer_ventas'), onvalidation=procesing_nota,
  onaccept=procesing_taller))
    File /home/drayco/web2py/gluon/tools.py, line 2889, in create
      deletable=False,
    File /home/drayco/web2py/gluon/tools.py, line 2805, in update
      formstyle=self.settings.formstyle
    File /home/drayco/web2py/gluon/sqlhtml.py, line 792, in __init__
      inp = self.widgets.options.widget(field, default)
    File /home/drayco/web2py/gluon/sqlhtml.py, line 205, in widget
      options = requires[0].options()
    File /home/drayco/web2py/gluon/validators.py, line 2350, in
  _options
      options = self.other.options()
    File /home/drayco/web2py/gluon/validators.py, line 424, in options
      self.build_set()
    File /home/drayco/web2py/gluon/validators.py, line 408, in
  build_set
      records = self.dbset.select(*self.fields, **dd)
    File /home/drayco/web2py/gluon/sql.py, line 4369, in select
      return self.db._adapter.select(self.query,fields,attributes)
    File /home/drayco/web2py/gluon/sql.py, line 976, in select
      query = self._select(query,fields,attributes)
    File /home/drayco/web2py/gluon/sql.py, line 911, in _select
      raise SyntaxError, 'Set: no tables selected'
  SyntaxError: Set: no tables selected

  And the code of the controller is

  def realizar_venta():
      return dict(form=crud.create(db.notas, next=URL(r=request,
  f='leer_ventas'), onvalidation=procesing_nota,
  onaccept=procesing_taller))

  On Dec 8, 10:30 pm, drayco antrod...@gmail.com wrote:

   Hi, I updated trunk version, but error still happens, but now all my
   functions that use crud.(search,read,create) doesn't work

   this the track

   Traceback (most recent call last):
     File /home/drayco/web2py/gluon/restricted.py, line 188, in
   restricted
       exec ccode in environment
     File /home/drayco/web2py/applications/opticaluz/controllers/
   gerencia.py, line 1417, in module
     File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
       self._caller = lambda f: f()
     File /home/drayco/web2py/gluon/tools.py, line 2315, in f
       return action(*a, **b)
     File /home/drayco/web2py/applications/opticaluz/controllers/
   gerencia.py, line 278, in ventas
       if form.accepts(request.vars,session):
     File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
       self.vars.id = self.table.insert(**fields)
     File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
       return new_fields
     File /home/drayco/web2py/gluon/sql.py, line 690, in insert
       query = self._insert(table,fields)
   AttributeError: 'BaseAdapter' object has no attribute 'cursor'

   On Dec 8, 9:48 pm, mdipierro mdipie...@cs.depaul.edu wrote:

Thanks for your tests. One more time please.

On Dec 8, 9:37 pm, drayco antrod...@gmail.com wrote:

 Hi, I updated trunk version, but error still happens

 this the track

 Traceback (most recent call last):
   File /home/drayco/web2py/gluon/restricted.py, line 188, in
 restricted
     exec ccode in environment
   File /home/drayco/web2py/applications/opticaluz/controllers/
 gerencia.py, line 1417, in module
   File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
     self._caller = lambda f: f()
   File /home/drayco/web2py/gluon/tools.py, line 2315, in f
     return action(*a, **b)
   File /home/drayco/web2py/applications/opticaluz/controllers/
 gerencia.py, line 278, in ventas
     if form.accepts(request.vars,session):
   File /home/drayco/web2py/gluon/sqlhtml.py, line 1159, in accepts
     self.vars.id = self.table.insert(**fields)
   File /home/drayco/web2py/gluon/sql.py, line 3735, in insert
     return self._db._adapter.insert(self,self._listify(fields))
   File /home/drayco/web2py/gluon/sql.py, line 690, in insert
     raise e
 AttributeError: 'BaseAdapter' object has no attribute 'cursor'

 On Dec 8, 9:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I think this is now fixed. Please give it a try.

  On Dec 8, 6:42

[web2py] Re: Can any help me with SQLFORM.factory?

2010-12-08 Thread drayco
 $%
(promo)s')),label='L/C (4)'),
Field('color4','string',default=None,
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
Field('lc5',db.lc,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'lc.id','%(tecnoGradua)s %
(marca)s %(duracion)s %(oftalmico)s %(cosmetico)s $%
(promo)s')),label='L/C (5)'),
Field('color5','string',default=None,
requires=IS_NULL_OR(IS_ALPHANUMERIC(error_message='¡Deben ser
caracteres alfanumericos, sin espacios en blanco ó ñ!'))),
Field(producto6,db.productos,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'productos.id','%
(producto)s %(modelo)s %(caract1)s %(caract2)s %(caract3)s %(caract4)s
$%(promo)s'))),
Field('cantidad6','integer',default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(0,1e100,error_message='Debe ser
Numero positivo')),label='Cantidad producto6',comment='más de 1'),
Field(producto7,db.productos,
default=None,requires=IS_NULL_OR(IS_IN_DB(db,'productos.id','%
(producto)s %(modelo)s %(caract1)s %(caract2)s %(caract3)s %(caract4)s
$%(promo)s'))),
Field('cantidad7','integer',default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(0,1e100,error_message='Debe ser
Numero positivo')),label='Cantidad producto7',comment='más de 1'),
Field(vendedor,db.auth_user, default=user_id,
requires=IS_NULL_OR(IS_IN_DB(vendedores,'auth_user.id','%(first_name)s
%(last_name)s %(end_name)s'))),
Field(total, double, default=0, writable=False),
Field(anticipo, double, default=0,
requires=[IS_NOT_EMPTY(error_message='No puede estar
vacio'),IS_FLOAT_IN_RANGE(0,1,error_message='Debe ser un numero
positivo entre 0 y 1')]),
Field(pagos, double, default=0, writable=False),
Field(saldo, double, default=0, writable=False),
Field(fechaEntrega, date,default=(request.now
+datetime.timedelta(14)), label='Fecha de Entrega'),
Field(optometrista,db.auth_user,
default=None,requires=IS_NULL_OR(IS_IN_DB(optometristas,'auth_user.id','%
(first_name)s %(last_name)s %(end_name)s'))),
Field('retiOdEsf','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo
Der.Esf.'),
Field('retiOdCil','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-12.1,0)),label='Ojo
Der.Cil.'),
Field('retiOdEje','integer',
default=None,requires=IS_NULL_OR(IS_INT_IN_RANGE(0,181)),label='Ojo
Der.Eje'),
Field('retiOiEsf','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-20.1,20.1)),label='Ojo
Izq.Esf.'),
Field('retiOiCil','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(-12.1,0)),label='Ojo
Izq.Cil.'),
Field('retiOiEje','integer',
default=None,requires=IS_NULL_OR(IS_INT_IN_RANGE(0,181)),label='Ojo
Izq Eje'),
Field('adicion','double',
default=None,requires=IS_NULL_OR(IS_FLOAT_IN_RANGE(0.75,3.51)),label='Adición'),
Field('dipC','integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(35,85)), label='D.I.P.
Cerca(mm)'),
Field('dipL','integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(35,85)), label='D.I.P.
Lejos(mm)'),
Field('alt','integer', default=None,
requires=IS_NULL_OR(IS_INT_IN_RANGE(10,30)), label='Altura Centro
Óptico(mm)'),
Field('observaciones','string', default=None),
Field('diabetes','string', default=None),
Field('hipertension','string', default=None),
Field('garantia', 'integer', default=None, label='Garantia de la
Nota'),
Field('entregado','boolean', default=False, writable=False),
Field('entregadoEl', 'datetime', default=None, label='Entregado
el', writable=False))

On Dec 8, 11:17 pm, drayco antrod...@gmail.com wrote:
 Ok, it's work's now, I reset my instance and all work well

 Thank's

 On Dec 8, 10:43 pm, drayco antrod...@gmail.com wrote:

  :D, well only for this function realizar_venta, because other
  crud.create works well

  On Dec 8, 10:35 pm, drayco antrod...@gmail.com wrote:

   :D wel olny crud.create doesn't work

   this is the track

   Traceback (most recent call last):
     File /home/drayco/web2py/gluon/restricted.py, line 188, in
   restricted
       exec ccode in environment
     File /home/drayco/web2py/applications/opticaluz/controllers/
   ventas.py, line 1086, in module
     File /home/drayco/web2py/gluon/globals.py, line 95, in lambda
       self._caller = lambda f: f()
     File /home/drayco/web2py/gluon/tools.py, line 2315, in f
       return action(*a, **b)
     File /home/drayco/web2py/applications/opticaluz/controllers/
   ventas.py, line 1056, in realizar_venta
       return dict(form=crud.create(db.notas, next=URL(r=request,
   f='leer_ventas'), onvalidation=procesing_nota,
   onaccept=procesing_taller))
     File /home/drayco/web2py/gluon/tools.py, line 2889, in create
       deletable=False,
     File /home/drayco/web2py/gluon/tools.py, line 2805, in update
       formstyle=self.settings.formstyle
     File /home/drayco/web2py/gluon/sqlhtml.py, line 792, in __init__
       inp = self.widgets.options.widget(field, default)
     File /home/drayco

[web2py] Typos in http://web2py.com/book/default/chapter/08#Authentication and Customizing Auth

2010-08-12 Thread drayco
In http://web2py.com/book/default/chapter/08#Authentication and
Customizing Auth

Example:

# after
# auth = Auth(globals(),db)

db.define_table(
auth.settings.table_user_name,
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True),
Field('password', 'password', length=512,
  readable=False, label='Password'),
Field('registration_key', length=512,
  writable=False, readable=False, default=''),
Field('reset_password_key', length=512,
  writable=False, readable=False, default=''),
Field('registration_id', length=512,
  writable=False, readable=False, default=''))

auth_table.first_name.requires = \
  IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_table.last_name.requires = \
  IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_table.password.requires = [IS_STRONG(), CRYPT()]
auth_table.email.requires = [
  IS_EMAIL(error_message=auth.messages.invalid_email),
  IS_NOT_IN_DB(db, auth_table.email)]
auth.settings.table_user = auth_table

# before
# auth.define_tables()

It didn't work. I followed a discussion and if I want that work, We
need this:

auth_table = db.define_table(
auth.settings.table_user_name,
Field('created', 'datetime', default=request.now, writable=False,
readable=False),
Field('first_name', length=128, default='', label='Nombre(s)'),
Field('last_name', length=128, default='', label='Apellido
Paterno'),
Field('end_name', length=128, default='', label='Apellido
Materno'),
Field('email', length=128, default='', unique=True, label='Correo
electronico'),
Field('password', 'password', length=512, readable=False,
label='Contraseña'),
Field('registration_key', length=512, writable=False,
readable=False, default=''),
Field('reset_password_key', length=512, writable=False,
readable=False, default=''),
Field('registration_id', length=512, writable=False,
readable=False, default=''),
Field('rfc', 'string', label='RFC'),
Field('domicilio','string', label='Calle y Num.Ext., Num.Int.'),
Field('colonia','string'),
Field('municipio','string', label='Municipio ó Delegación'),
Field('estado','string', label='Estado'),
Field('cp','integer', label='C.P.'),
Field('tel', 'double', label='Tel. Casa'),
Field('cel', 'double', label='Tel. Celular', comment='Sin el
044'),
Field('sexo','string',
requires=IS_IN_SET(['Masculuno','Femenino'])),
 
Field('last_login','datetime',default=request.now,writable=False,readable=False),
 
Field('last_ip',default=request.env.remote_addr,writable=False,readable=False))

auth_table.first_name.requires =
[IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
auth_table.last_name.requires =
[IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
auth_table.end_name.requires =
[IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
auth_table.email.requires =
[IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db,
auth_table.email)]
auth_table.password.requires = [IS_STRONG(), CRYPT()]
auth_table.rfc.requires = [IS_UPPER(),
IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
   IS_LENGTH(minsize=13,error_message='El
tamaño debe ser de 13 caracteres'), \
 
IS_NOT_IN_DB(db,auth_table.rfc,error_message='El RFC ya existe')]
auth_table.domicilio.requires = [IS_NOT_EMPTY(error_message='No puede
estar vacio'),IS_UPPER()]
auth_table.colonia.requires=[IS_NOT_EMPTY(error_message='No puede
estar vacio'),IS_UPPER()]
auth_table.municipio.requires=[IS_NOT_EMPTY(error_message='No puede
estar vacio'),IS_UPPER()]
auth_table.estado.requires=[IS_NOT_EMPTY(error_message='No puede estar
vacio'),IS_UPPER()]
auth_table.cp.requires =
[IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
  IS_INT_IN_RANGE(0,1e100,error_message='Debe
ser Numero positivo')]
auth_table.tel.requires =
[IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
 
IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')]
auth_table.cel.requires =
[IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
 
IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')]
auth_table.sexo.requires = IS_IN_SET(['femenino','masculino'])
auth.settings.table_user = auth_table

It's only a litle typo.
Well I show my customizing.


[web2py] Re: Typos in http://web2py.com/book/default/chapter/08#Authentication and Customizing Auth

2010-08-12 Thread drayco
Hi Dr. Massimo:

When I did this test I used web2py 1.82.1 and 1.81.5, I obtained the
same result, It didn't work.

I think that was because we need to declare this:

auth_table = db.define_table(

And in book example this is ommited.

On Aug 12, 12:33 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 that is because you have an old version of web2py.

 On Aug 12, 12:19 pm, drayco antrod...@gmail.com wrote:

  Inhttp://web2py.com/book/default/chapter/08#Authenticationand
  Customizing Auth

  Example:

  # after
  # auth = Auth(globals(),db)

  db.define_table(
      auth.settings.table_user_name,
      Field('first_name', length=128, default=''),
      Field('last_name', length=128, default=''),
      Field('email', length=128, default='', unique=True),
      Field('password', 'password', length=512,
            readable=False, label='Password'),
      Field('registration_key', length=512,
            writable=False, readable=False, default=''),
      Field('reset_password_key', length=512,
            writable=False, readable=False, default=''),
      Field('registration_id', length=512,
            writable=False, readable=False, default=''))

  auth_table.first_name.requires = \
    IS_NOT_EMPTY(error_message=auth.messages.is_empty)
  auth_table.last_name.requires = \
    IS_NOT_EMPTY(error_message=auth.messages.is_empty)
  auth_table.password.requires = [IS_STRONG(), CRYPT()]
  auth_table.email.requires = [
    IS_EMAIL(error_message=auth.messages.invalid_email),
    IS_NOT_IN_DB(db, auth_table.email)]
  auth.settings.table_user = auth_table

  # before
  # auth.define_tables()

  It didn't work. I followed a discussion and if I want that work, We
  need this:

  auth_table = db.define_table(
      auth.settings.table_user_name,
      Field('created', 'datetime', default=request.now, writable=False,
  readable=False),
      Field('first_name', length=128, default='', label='Nombre(s)'),
      Field('last_name', length=128, default='', label='Apellido
  Paterno'),
      Field('end_name', length=128, default='', label='Apellido
  Materno'),
      Field('email', length=128, default='', unique=True, label='Correo
  electronico'),
      Field('password', 'password', length=512, readable=False,
  label='Contraseña'),
      Field('registration_key', length=512, writable=False,
  readable=False, default=''),
      Field('reset_password_key', length=512, writable=False,
  readable=False, default=''),
      Field('registration_id', length=512, writable=False,
  readable=False, default=''),
      Field('rfc', 'string', label='RFC'),
      Field('domicilio','string', label='Calle y Num.Ext., Num.Int.'),
      Field('colonia','string'),
      Field('municipio','string', label='Municipio ó Delegación'),
      Field('estado','string', label='Estado'),
      Field('cp','integer', label='C.P.'),
      Field('tel', 'double', label='Tel. Casa'),
      Field('cel', 'double', label='Tel. Celular', comment='Sin el
  044'),
      Field('sexo','string',
  requires=IS_IN_SET(['Masculuno','Femenino'])),

  Field('last_login','datetime',default=request.now,writable=False,readable=False),

  Field('last_ip',default=request.env.remote_addr,writable=False,readable=False))

  auth_table.first_name.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
  auth_table.last_name.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
  auth_table.end_name.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
  auth_table.email.requires =
  [IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db,
  auth_table.email)]
  auth_table.password.requires = [IS_STRONG(), CRYPT()]
  auth_table.rfc.requires = [IS_UPPER(),
  IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
                             IS_LENGTH(minsize=13,error_message='El
  tamaño debe ser de 13 caracteres'), \

  IS_NOT_IN_DB(db,auth_table.rfc,error_message='El RFC ya existe')]
  auth_table.domicilio.requires = [IS_NOT_EMPTY(error_message='No puede
  estar vacio'),IS_UPPER()]
  auth_table.colonia.requires=[IS_NOT_EMPTY(error_message='No puede
  estar vacio'),IS_UPPER()]
  auth_table.municipio.requires=[IS_NOT_EMPTY(error_message='No puede
  estar vacio'),IS_UPPER()]
  auth_table.estado.requires=[IS_NOT_EMPTY(error_message='No puede estar
  vacio'),IS_UPPER()]
  auth_table.cp.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
                            IS_INT_IN_RANGE(0,1e100,error_message='Debe
  ser Numero positivo')]
  auth_table.tel.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \

  IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')]
  auth_table.cel.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \

  IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')]
  auth_table.sexo.requires = IS_IN_SET(['femenino','masculino'])
  auth.settings.table_user = auth_table

  It's only a litle typo.
  Well I show my

[web2py] Re: Typos in http://web2py.com/book/default/chapter/08#Authentication and Customizing Auth

2010-08-12 Thread drayco
Hi Dr. Massimo:

When I did this test I used web2py 1.82.1 and 1.81.5, I obtained the
same result, It didn't work.

I think that was because we need to declare this:

auth_table = db.define_table(

And in book example this is ommited.

On Aug 12, 12:33 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 that is because you have an old version of web2py.

 On Aug 12, 12:19 pm, drayco antrod...@gmail.com wrote:

  Inhttp://web2py.com/book/default/chapter/08#Authenticationand
  Customizing Auth

  Example:

  # after
  # auth = Auth(globals(),db)

  db.define_table(
      auth.settings.table_user_name,
      Field('first_name', length=128, default=''),
      Field('last_name', length=128, default=''),
      Field('email', length=128, default='', unique=True),
      Field('password', 'password', length=512,
            readable=False, label='Password'),
      Field('registration_key', length=512,
            writable=False, readable=False, default=''),
      Field('reset_password_key', length=512,
            writable=False, readable=False, default=''),
      Field('registration_id', length=512,
            writable=False, readable=False, default=''))

  auth_table.first_name.requires = \
    IS_NOT_EMPTY(error_message=auth.messages.is_empty)
  auth_table.last_name.requires = \
    IS_NOT_EMPTY(error_message=auth.messages.is_empty)
  auth_table.password.requires = [IS_STRONG(), CRYPT()]
  auth_table.email.requires = [
    IS_EMAIL(error_message=auth.messages.invalid_email),
    IS_NOT_IN_DB(db, auth_table.email)]
  auth.settings.table_user = auth_table

  # before
  # auth.define_tables()

  It didn't work. I followed a discussion and if I want that work, We
  need this:

  auth_table = db.define_table(
      auth.settings.table_user_name,
      Field('created', 'datetime', default=request.now, writable=False,
  readable=False),
      Field('first_name', length=128, default='', label='Nombre(s)'),
      Field('last_name', length=128, default='', label='Apellido
  Paterno'),
      Field('end_name', length=128, default='', label='Apellido
  Materno'),
      Field('email', length=128, default='', unique=True, label='Correo
  electronico'),
      Field('password', 'password', length=512, readable=False,
  label='Contraseña'),
      Field('registration_key', length=512, writable=False,
  readable=False, default=''),
      Field('reset_password_key', length=512, writable=False,
  readable=False, default=''),
      Field('registration_id', length=512, writable=False,
  readable=False, default=''),
      Field('rfc', 'string', label='RFC'),
      Field('domicilio','string', label='Calle y Num.Ext., Num.Int.'),
      Field('colonia','string'),
      Field('municipio','string', label='Municipio ó Delegación'),
      Field('estado','string', label='Estado'),
      Field('cp','integer', label='C.P.'),
      Field('tel', 'double', label='Tel. Casa'),
      Field('cel', 'double', label='Tel. Celular', comment='Sin el
  044'),
      Field('sexo','string',
  requires=IS_IN_SET(['Masculuno','Femenino'])),

  Field('last_login','datetime',default=request.now,writable=False,readable=False),

  Field('last_ip',default=request.env.remote_addr,writable=False,readable=False))

  auth_table.first_name.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
  auth_table.last_name.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
  auth_table.end_name.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_UPPER()]
  auth_table.email.requires =
  [IS_EMAIL(error_message=auth.messages.invalid_email), IS_NOT_IN_DB(db,
  auth_table.email)]
  auth_table.password.requires = [IS_STRONG(), CRYPT()]
  auth_table.rfc.requires = [IS_UPPER(),
  IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
                             IS_LENGTH(minsize=13,error_message='El
  tamaño debe ser de 13 caracteres'), \

  IS_NOT_IN_DB(db,auth_table.rfc,error_message='El RFC ya existe')]
  auth_table.domicilio.requires = [IS_NOT_EMPTY(error_message='No puede
  estar vacio'),IS_UPPER()]
  auth_table.colonia.requires=[IS_NOT_EMPTY(error_message='No puede
  estar vacio'),IS_UPPER()]
  auth_table.municipio.requires=[IS_NOT_EMPTY(error_message='No puede
  estar vacio'),IS_UPPER()]
  auth_table.estado.requires=[IS_NOT_EMPTY(error_message='No puede estar
  vacio'),IS_UPPER()]
  auth_table.cp.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \
                            IS_INT_IN_RANGE(0,1e100,error_message='Debe
  ser Numero positivo')]
  auth_table.tel.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \

  IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')]
  auth_table.cel.requires =
  [IS_NOT_EMPTY(error_message=auth.messages.is_empty), \

  IS_FLOAT_IN_RANGE(0,1e1000,error_message='Debe ser Numero positivo')]
  auth_table.sexo.requires = IS_IN_SET(['femenino','masculino'])
  auth.settings.table_user = auth_table

  It's only a litle typo.
  Well I show my

[web2py] Re: Where can I download web2py 1.77.3?

2010-06-03 Thread drayco
Very probability, because i very new in web applications and python

In the past,1 week ago, before we updated version of web2py, we
created 10589 registers with the same application. And now, the only
idea that i have, it is this, the new version of web2py.

This are the controllers involved when we created one register

#Beneficiarios
@auth.requires_login()
def update_benef(form):
import datetime
now = datetime.datetime.today()
beneficiario = db.benefs2[form.vars.id]
 
keybenef=db(db.keys2benefs.keybenef==beneficiario.key_Registro).select()
 
db(db.keys2benefs.id==keybenef[0].id).update(benefid=beneficiario.id)
coordinador = db.coordinadores[keybenef[0].coordid]
fechas =
db((db.fechas.fechaTramitenow)(db.fechas.regional==coordinador.regional)(db.fechas.fulldb.fechas.cargaMax)).select(db.fechas.ALL,orderby=db.fechas.fechaTramite)
 
db(db.benefs2.id==beneficiario.id).update(coordid=keybenef[0].coordid)
db(db.benefs2.id==beneficiario.id).update(fechasid=fechas[0].id)
db(db.fechas.id==fechas[0].id).update(full=fechas[0].full+1)

#Beneficiarios
@auth.requires_login()
def update_benef2(form):
now = request.now
benef = db.benefs2[form.vars.id]
keybenef=db(db.keys2benefs.keybenef==benef.key_Registro).select()
[0]
db(db.keys2benefs.id==keybenef.id).update(benefs2_id=benef.id)
coord = db.coordinadores[keybenef.coordinador_id]
dates2 =
db((db.dates2.startnow)(db.dates2.regional_id==coord.regional_id)(db.dates2.xdiadb.dates2.cargados)).
\
select(db.dates2.ALL,orderby=db.dates2.start)[0]
benefs =
db(db.benefs2.dates2_id==dates2.id).select(db.benefs2.id,db.benefs2.tramite,db.benefs2.entrega,db.benefs2.tramite.count(),
\
orderby=db.benefs2.tramite,groupby=db.benefs2.tramite)
if len(benefs)0:
if
benefs[len(benefs)-1]._extra[db.benefs2.tramite.count()]dates2.xhora:
tramite=benefs[len(benefs)-1].benefs2.tramite
entrega=benefs[len(benefs)-1].benefs2.entrega
else:
from datetime import timedelta
HOUR = timedelta(hours=1)
tramite=benefs[len(benefs)-1].benefs2.tramite+HOUR
entrega=benefs[len(benefs)-1].benefs2.entrega+HOUR
else:
tramite=dates2.start
entrega=dates2.inicio
 
db(db.benefs2.id==benef.id).update(dates2_id=dates2.id,tramite=tramite,entrega=entrega,coordnador_id=keybenef.coordinador_id)
db(db.dates2.id==dates2.id).update(cargados=dates2.cargados
+1,xcargar=dates2.xdia-(dates2.cargados+1))

@auth.requires_login()
def crea_benef():
return dict(form=crud.create(db.benefs2, next=URL(r=request,
f='benefs2_regist'),onaccept=update_benef2))

And this when we try to show as a list

@auth.requires_login()
def benefs2_regist():
if len(request.args): page=int(request.args[0])
else: page=0
items_per_page=25
limitby=(page*items_per_page,(page+1)*items_per_page+1)
benefs=db(db.benefs2.creadoPor==auth.user.id).\
 
select(db.benefs2.id,db.benefs2.names,db.benefs2.apelPater,db.benefs2.apelMater,
\
db.benefs2.tramite,orderby=~db.benefs2.id,limitby=limitby)
nobenefs=db(db.benefs2.creadoPor==auth.user.id).count()
return
dict(beneficiarios=benefs,page=page,items_per_page=items_per_page,nobenefs=nobenefs)

This are the views involved when we created one register

{{extend 'layout.html'}}
h3Registre los datos del Beneficiario y el Trabajador
correspondiente/h3
{{=form}}

{{extend 'layout.html'}}
h3Usted registro a {{=nobenefs}} Beneficiarios, organizados en
bloques de {{=items_per_page}}/h3
h3De clic sobre el nombre del beneficiario para ver el lugar, los
requisitos, etc. y ver el folio completo para imprimir/h3
ul{{for i,benef in enumerate(beneficiarios):}}
{{if i==items_per_page: break}}
{{=LI(A('Folio ',benef.id,' ',benef.names,'
',benef.apelPater,' ',benef.apelMater,' fecha de
tramite:',benef.tramite, _href=URL(r=request, f='show_benef',
args=benef.id)))}}
{{pass}}/ul
{{if page:}}
a href={{=URL(r=request,args=[page-1])}}anteriores/a
{{pass}}
{{if len(beneficiarios)items_per_page:}}
a href={{=URL(r=request,args=[page+1])}}siguientes/a
{{pass}}



On Jun 2, 9:01 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 why is counting records select count(*)  crashing your mysql
 database? It seems to me the problem is not the web2py version.

 On Jun 2, 7:03 pm, drayco antrod...@gmail.com wrote:

  Thank's a lot Dr. Massimo

  do you use apache? Yes
  mod_wsgi? Yes
  do you use the built-in web server? No
  do you see memory leaks? No
  do you have web2py cron or on off? No

  This is the firts error:

  Traceback (most recent call last):
    File gluon/restricted.py, line 178, in restricted
      exec ccode in environment
    File /home/drayco/webapps/seccion36/web2py/applications/init/
  controllers/default.py, line 134, in module
    File gluon/globals.py, line 96, in lambda
      self._caller = lambda f: f()
    File gluon/tools.py, line 2036, in f
      return action(*a, **b)
    File /home/drayco

[web2py] Re: Where can I download web2py 1.77.3?

2010-06-03 Thread drayco
Well, I followed the advise of Dr. Massimo, thank's a lot.

I updated all about my applications in web2faction, but a I did all
manually, because when I used the script for install I can't used
admin well. (install applications and local_import).
I am using in my applications mod_wgsi 2.5 and python 2.5
I configured the httpd.conf with this

ServerRoot /home/username/webapps/appname/apache2

LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so

DirectoryIndex index.py
DocumentRoot /home/username/webapps/appname/htdocs
KeepAlive Off
Listen PORTNUMBER
LogFormat %{X-Forwarded-For}i %l %u %t \%r\ %s %b \%{Referer}i\
\%{User-Agent}i\ combined
CustomLog /home/username/logs/user/access_appname.log combined
ErrorLog /home/username/logs/user/error_appname.log
ServerLimit 2

SetEnvIf X-Forwarded-SSL on HTTPS=1

WSGIScriptAlias / /home/username/webapps/appname/web2py/wsgihandler.py

I ran web2py manually one time, and them I ran apache, at this moment,
everything is done with web2py version 1.78.3 even admin with https.

On Jun 3, 1:48 am, drayco antrod...@gmail.com wrote:
 Very probability, because i very new in web applications and python

 In the past,1 week ago, before we updated version of web2py, we
 created 10589 registers with the same application. And now, the only
 idea that i have, it is this, the new version of web2py.

 This are the controllers involved when we created one register

 #Beneficiarios
 @auth.requires_login()
 def update_benef(form):
     import datetime
     now = datetime.datetime.today()
     beneficiario = db.benefs2[form.vars.id]

 keybenef=db(db.keys2benefs.keybenef==beneficiario.key_Registro).select()

 db(db.keys2benefs.id==keybenef[0].id).update(benefid=beneficiario.id)
     coordinador = db.coordinadores[keybenef[0].coordid]
     fechas =
 db((db.fechas.fechaTramitenow)(db.fechas.regional==coordinador.regional)(db.fechas.fulldb.fechas.cargaMax)).select(db.fechas.ALL,orderby=db.fechas.fechaTramite)

 db(db.benefs2.id==beneficiario.id).update(coordid=keybenef[0].coordid)
     db(db.benefs2.id==beneficiario.id).update(fechasid=fechas[0].id)
     db(db.fechas.id==fechas[0].id).update(full=fechas[0].full+1)

 #Beneficiarios
 @auth.requires_login()
 def update_benef2(form):
     now = request.now
     benef = db.benefs2[form.vars.id]
     keybenef=db(db.keys2benefs.keybenef==benef.key_Registro).select()
 [0]
     db(db.keys2benefs.id==keybenef.id).update(benefs2_id=benef.id)
     coord = db.coordinadores[keybenef.coordinador_id]
     dates2 =
 db((db.dates2.startnow)(db.dates2.regional_id==coord.regional_id)(db.dates2.xdiadb.dates2.cargados)).
 \
         select(db.dates2.ALL,orderby=db.dates2.start)[0]
     benefs =
 db(db.benefs2.dates2_id==dates2.id).select(db.benefs2.id,db.benefs2.tramite,db.benefs2.entrega,db.benefs2.tramite.count(),
 \
         orderby=db.benefs2.tramite,groupby=db.benefs2.tramite)
     if len(benefs)0:
         if
 benefs[len(benefs)-1]._extra[db.benefs2.tramite.count()]dates2.xhora:
             tramite=benefs[len(benefs)-1].benefs2.tramite
             entrega=benefs[len(benefs)-1].benefs2.entrega
         else:
             from datetime import timedelta
             HOUR = timedelta(hours=1)
             tramite=benefs[len(benefs)-1].benefs2.tramite+HOUR
             entrega=benefs[len(benefs)-1].benefs2.entrega+HOUR
     else:
         tramite=dates2.start
         entrega=dates2.inicio

 db(db.benefs2.id==benef.id).update(dates2_id=dates2.id,tramite=tramite,entrega=entrega,coordnador_id=keybenef.coordinador_id)
     db(db.dates2.id==dates2.id).update(cargados=dates2.cargados
 +1,xcargar=dates2.xdia-(dates2.cargados+1))

 @auth.requires_login()
 def crea_benef():
     return dict(form=crud.create(db.benefs2, next=URL(r=request,
 f='benefs2_regist'),onaccept=update_benef2))

 And this when we try to show as a list

 @auth.requires_login()
 def benefs2_regist():
     if len(request.args): page=int(request.args[0])
     else: page=0
     items_per_page=25
     limitby=(page*items_per_page,(page+1)*items_per_page+1)
     benefs=db(db.benefs2.creadoPor==auth.user.id).\

 select(db.benefs2.id,db.benefs2.names,db.benefs2.apelPater,db.benefs2.apelMater,
 \
         db.benefs2.tramite,orderby=~db.benefs2.id,limitby=limitby)
     nobenefs=db(db.benefs2.creadoPor==auth.user.id).count()
     return
 dict(beneficiarios=benefs,page=page,items_per_page=items_per_page,nobenefs=nobenefs)

 This are the views involved when we created one register

 {{extend 'layout.html'}}
 h3Registre los datos del Beneficiario y el Trabajador
 correspondiente/h3
 {{=form}}

 {{extend 'layout.html'}}
 h3Usted registro a {{=nobenefs}} Beneficiarios, organizados en
 bloques de {{=items_per_page}}/h3
 h3De clic sobre el nombre del

[web2py] Re: Where can I download web2py 1.77.3?

2010-06-02 Thread drayco
Thank's a lot Dr. Massimo

do you use apache? Yes
mod_wsgi? Yes
do you use the built-in web server? No
do you see memory leaks? No
do you have web2py cron or on off? No

This is the firts error:

Traceback (most recent call last):
  File gluon/restricted.py, line 178, in restricted
exec ccode in environment
  File /home/drayco/webapps/seccion36/web2py/applications/init/
controllers/default.py, line 134, in module
  File gluon/globals.py, line 96, in lambda
self._caller = lambda f: f()
  File gluon/tools.py, line 2036, in f
return action(*a, **b)
  File /home/drayco/webapps/seccion36/web2py/applications/init/
controllers/default.py, line 101, in crea_benef
return dict(form=crud.create(db.benefs2, next=URL(r=request,
f='benefs2_regist'),onaccept=update_benef2))
  File gluon/tools.py, line 2623, in create
deletable=False,
  File gluon/tools.py, line 2567, in update
onvalidation=onvalidation, keepvalues=keepvalues):
  File gluon/sqlhtml.py, line 870, in accepts
onvalidation,
  File gluon/html.py, line 1328, in accepts
status = self._traverse(status)
  File gluon/html.py, line 456, in _traverse
newstatus = c._traverse(status) and newstatus
  File gluon/html.py, line 456, in _traverse
newstatus = c._traverse(status) and newstatus
  File gluon/html.py, line 456, in _traverse
newstatus = c._traverse(status) and newstatus
  File gluon/html.py, line 456, in _traverse
newstatus = c._traverse(status) and newstatus
  File gluon/html.py, line 463, in _traverse
newstatus = self._validate()
  File gluon/html.py, line 1120, in _validate
(value, errors) = validator(value)
  File gluon/validators.py, line 413, in __call__
if self.dbset(field == value).count():
  File gluon/sql.py, line 3224, in count
return self.select('count(*)')[0]._extra['count(*)']
  File gluon/sql.py, line 3096, in select
rows = response(query)
  File gluon/sql.py, line 3091, in response
db._execute(query)
  File gluon/sql.py, line 932, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
  File build/bdist.linux-i686/egg/MySQLdb/cursors.py, line 166, in
execute
self.errorhandler(self, exc, value)
  File build/bdist.linux-i686/egg/MySQLdb/connections.py, line 35,
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1053, 'Server shutdown in progress')

And 1 second after:

Traceback (most recent call last):
  File gluon/main.py, line 435, in wsgibase
BaseAdapter.close_all_instances(BaseAdapter.rollback)
  File gluon/sql.py, line 754, in close_all_instances
action(instance)
  File gluon/sql.py, line 1350, in rollback
self._connection.rollback()
OperationalError: (2006, 'MySQL server has gone away')


On Jun 2, 6:47 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Try

 http://web2py.com/examples/static/1.77.3/web2py_src.zip

 some version are there and some not. Those obviously buggy have been
 deleted.

 Anyway, I'd like to understand the problem.
 do you use apache? mod_wsgi?
 do you use the built-in web server?
 do you see memory leaks?
 do you have web2py cron or on off?

 Massimo

 On Jun 2, 6:06 pm, drayco antrod...@gmail.com wrote:

  Where can I download web2py 1.77.3?

  Because my application that's run in webfaction, with MySQL and web2py
  1.78.3 needs to restart 4 times at day?

  And MySql rollback today, and I obtained a error that's say server in
  process to shutdown

  With web2py 1.77.3 and 1.66.5 I didn't need to do that action.




[web2py] Re: Where can I download web2py 1.77.3?

2010-06-02 Thread drayco
One of my user told me that He sent in 2 times new registers, and he
didn't obtain answer.

In previous versions of web2py, I never got this error.

On Jun 2, 7:03 pm, drayco antrod...@gmail.com wrote:
 Thank's a lot Dr. Massimo

 do you use apache? Yes
 mod_wsgi? Yes
 do you use the built-in web server? No
 do you see memory leaks? No
 do you have web2py cron or on off? No

 This is the firts error:

 Traceback (most recent call last):
   File gluon/restricted.py, line 178, in restricted
     exec ccode in environment
   File /home/drayco/webapps/seccion36/web2py/applications/init/
 controllers/default.py, line 134, in module
   File gluon/globals.py, line 96, in lambda
     self._caller = lambda f: f()
   File gluon/tools.py, line 2036, in f
     return action(*a, **b)
   File /home/drayco/webapps/seccion36/web2py/applications/init/
 controllers/default.py, line 101, in crea_benef
     return dict(form=crud.create(db.benefs2, next=URL(r=request,
 f='benefs2_regist'),onaccept=update_benef2))
   File gluon/tools.py, line 2623, in create
     deletable=False,
   File gluon/tools.py, line 2567, in update
     onvalidation=onvalidation, keepvalues=keepvalues):
   File gluon/sqlhtml.py, line 870, in accepts
     onvalidation,
   File gluon/html.py, line 1328, in accepts
     status = self._traverse(status)
   File gluon/html.py, line 456, in _traverse
     newstatus = c._traverse(status) and newstatus
   File gluon/html.py, line 456, in _traverse
     newstatus = c._traverse(status) and newstatus
   File gluon/html.py, line 456, in _traverse
     newstatus = c._traverse(status) and newstatus
   File gluon/html.py, line 456, in _traverse
     newstatus = c._traverse(status) and newstatus
   File gluon/html.py, line 463, in _traverse
     newstatus = self._validate()
   File gluon/html.py, line 1120, in _validate
     (value, errors) = validator(value)
   File gluon/validators.py, line 413, in __call__
     if self.dbset(field == value).count():
   File gluon/sql.py, line 3224, in count
     return self.select('count(*)')[0]._extra['count(*)']
   File gluon/sql.py, line 3096, in select
     rows = response(query)
   File gluon/sql.py, line 3091, in response
     db._execute(query)
   File gluon/sql.py, line 932, in lambda
     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
   File build/bdist.linux-i686/egg/MySQLdb/cursors.py, line 166, in
 execute
     self.errorhandler(self, exc, value)
   File build/bdist.linux-i686/egg/MySQLdb/connections.py, line 35,
 in defaulterrorhandler
     raise errorclass, errorvalue
 OperationalError: (1053, 'Server shutdown in progress')

 And 1 second after:

 Traceback (most recent call last):
   File gluon/main.py, line 435, in wsgibase
     BaseAdapter.close_all_instances(BaseAdapter.rollback)
   File gluon/sql.py, line 754, in close_all_instances
     action(instance)
   File gluon/sql.py, line 1350, in rollback
     self._connection.rollback()
 OperationalError: (2006, 'MySQL server has gone away')

 On Jun 2, 6:47 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Try

 http://web2py.com/examples/static/1.77.3/web2py_src.zip

  some version are there and some not. Those obviously buggy have been
  deleted.

  Anyway, I'd like to understand the problem.
  do you use apache? mod_wsgi?
  do you use the built-in web server?
  do you see memory leaks?
  do you have web2py cron or on off?

  Massimo

  On Jun 2, 6:06 pm, drayco antrod...@gmail.com wrote:

   Where can I download web2py 1.77.3?

   Because my application that's run in webfaction, with MySQL and web2py
   1.78.3 needs to restart 4 times at day?

   And MySql rollback today, and I obtained a error that's say server in
   process to shutdown

   With web2py 1.77.3 and 1.66.5 I didn't need to do that action.




[web2py] Re: Where can I download web2py 1.77.3?

2010-06-02 Thread drayco
And I didn't need to restart apache because I had more than 6 user's
simultaneously.

With previous versions of web2py, I only obtained every hour without
use of application

Traceback (most recent call last):
  File gluon/restricted.py, line 178, in restricted
exec ccode in environment
  File /home/drayco/webapps/seccion36/web2py/applications/init/models/
db.py, line 16, in module
db=SQLDB('mysql://drayco_sec36new:boci_1...@127.0.0.1/
drayco_sec36new',pool_size=10)
  File gluon/sql.py, line 933, in __init__
self._execute('SET FOREIGN_KEY_CHECKS=1;')
  File gluon/sql.py, line 932, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
  File build/bdist.linux-i686/egg/MySQLdb/cursors.py, line 166, in
execute
self.errorhandler(self, exc, value)
  File build/bdist.linux-i686/egg/MySQLdb/connections.py, line 35,
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (2006, 'MySQL server has gone away')

But we only need to recall and everything works well

On Jun 2, 7:16 pm, drayco antrod...@gmail.com wrote:
 One of my user told me that He sent in 2 times new registers, and he
 didn't obtain answer.

 In previous versions of web2py, I never got this error.

 On Jun 2, 7:03 pm, drayco antrod...@gmail.com wrote:

  Thank's a lot Dr. Massimo

  do you use apache? Yes
  mod_wsgi? Yes
  do you use the built-in web server? No
  do you see memory leaks? No
  do you have web2py cron or on off? No

  This is the firts error:

  Traceback (most recent call last):
    File gluon/restricted.py, line 178, in restricted
      exec ccode in environment
    File /home/drayco/webapps/seccion36/web2py/applications/init/
  controllers/default.py, line 134, in module
    File gluon/globals.py, line 96, in lambda
      self._caller = lambda f: f()
    File gluon/tools.py, line 2036, in f
      return action(*a, **b)
    File /home/drayco/webapps/seccion36/web2py/applications/init/
  controllers/default.py, line 101, in crea_benef
      return dict(form=crud.create(db.benefs2, next=URL(r=request,
  f='benefs2_regist'),onaccept=update_benef2))
    File gluon/tools.py, line 2623, in create
      deletable=False,
    File gluon/tools.py, line 2567, in update
      onvalidation=onvalidation, keepvalues=keepvalues):
    File gluon/sqlhtml.py, line 870, in accepts
      onvalidation,
    File gluon/html.py, line 1328, in accepts
      status = self._traverse(status)
    File gluon/html.py, line 456, in _traverse
      newstatus = c._traverse(status) and newstatus
    File gluon/html.py, line 456, in _traverse
      newstatus = c._traverse(status) and newstatus
    File gluon/html.py, line 456, in _traverse
      newstatus = c._traverse(status) and newstatus
    File gluon/html.py, line 456, in _traverse
      newstatus = c._traverse(status) and newstatus
    File gluon/html.py, line 463, in _traverse
      newstatus = self._validate()
    File gluon/html.py, line 1120, in _validate
      (value, errors) = validator(value)
    File gluon/validators.py, line 413, in __call__
      if self.dbset(field == value).count():
    File gluon/sql.py, line 3224, in count
      return self.select('count(*)')[0]._extra['count(*)']
    File gluon/sql.py, line 3096, in select
      rows = response(query)
    File gluon/sql.py, line 3091, in response
      db._execute(query)
    File gluon/sql.py, line 932, in lambda
      self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
    File build/bdist.linux-i686/egg/MySQLdb/cursors.py, line 166, in
  execute
      self.errorhandler(self, exc, value)
    File build/bdist.linux-i686/egg/MySQLdb/connections.py, line 35,
  in defaulterrorhandler
      raise errorclass, errorvalue
  OperationalError: (1053, 'Server shutdown in progress')

  And 1 second after:

  Traceback (most recent call last):
    File gluon/main.py, line 435, in wsgibase
      BaseAdapter.close_all_instances(BaseAdapter.rollback)
    File gluon/sql.py, line 754, in close_all_instances
      action(instance)
    File gluon/sql.py, line 1350, in rollback
      self._connection.rollback()
  OperationalError: (2006, 'MySQL server has gone away')

  On Jun 2, 6:47 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   Try

  http://web2py.com/examples/static/1.77.3/web2py_src.zip

   some version are there and some not. Those obviously buggy have been
   deleted.

   Anyway, I'd like to understand the problem.
   do you use apache? mod_wsgi?
   do you use the built-in web server?
   do you see memory leaks?
   do you have web2py cron or on off?

   Massimo

   On Jun 2, 6:06 pm, drayco antrod...@gmail.com wrote:

Where can I download web2py 1.77.3?

Because my application that's run in webfaction, with MySQL and web2py
1.78.3 needs to restart 4 times at day?

And MySql rollback today, and I obtained a error that's say server in
process to shutdown

With web2py 1.77.3 and 1.66.5 I didn't need to do that action.




[web2py] Re: Where can I download web2py 1.77.3?

2010-06-02 Thread drayco
And I didn't need to restart apache because I had more than 6 user's
simultaneously.

With previous versions of web2py, I only obtained every hour without
use of application

Traceback (most recent call last):
  File gluon/restricted.py, line 178, in restricted
exec ccode in environment
  File /home/drayco/webapps/seccion36/web2py/applications/init/models/
db.py, line 16, in module
db=SQLDB('mysql://xxx:x...@127.0.0.1/xxx',pool_size=10)
  File gluon/sql.py, line 933, in __init__
self._execute('SET FOREIGN_KEY_CHECKS=1;')
  File gluon/sql.py, line 932, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
  File build/bdist.linux-i686/egg/MySQLdb/cursors.py, line 166, in
execute
self.errorhandler(self, exc, value)
  File build/bdist.linux-i686/egg/MySQLdb/connections.py, line 35,
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (2006, 'MySQL server has gone away')

But we only need to recall and everything works well

On Jun 2, 7:16 pm, drayco antrod...@gmail.com wrote:
 One of my user told me that He sent in 2 times new registers, and he
 didn't obtain answer.

 In previous versions of web2py, I never got this error.

 On Jun 2, 7:03 pm, drayco antrod...@gmail.com wrote:

  Thank's a lot Dr. Massimo

  do you use apache? Yes
  mod_wsgi? Yes
  do you use the built-in web server? No
  do you see memory leaks? No
  do you have web2py cron or on off? No

  This is the firts error:

  Traceback (most recent call last):
    File gluon/restricted.py, line 178, in restricted
      exec ccode in environment
    File /home/drayco/webapps/seccion36/web2py/applications/init/
  controllers/default.py, line 134, in module
    File gluon/globals.py, line 96, in lambda
      self._caller = lambda f: f()
    File gluon/tools.py, line 2036, in f
      return action(*a, **b)
    File /home/drayco/webapps/seccion36/web2py/applications/init/
  controllers/default.py, line 101, in crea_benef
      return dict(form=crud.create(db.benefs2, next=URL(r=request,
  f='benefs2_regist'),onaccept=update_benef2))
    File gluon/tools.py, line 2623, in create
      deletable=False,
    File gluon/tools.py, line 2567, in update
      onvalidation=onvalidation, keepvalues=keepvalues):
    File gluon/sqlhtml.py, line 870, in accepts
      onvalidation,
    File gluon/html.py, line 1328, in accepts
      status = self._traverse(status)
    File gluon/html.py, line 456, in _traverse
      newstatus = c._traverse(status) and newstatus
    File gluon/html.py, line 456, in _traverse
      newstatus = c._traverse(status) and newstatus
    File gluon/html.py, line 456, in _traverse
      newstatus = c._traverse(status) and newstatus
    File gluon/html.py, line 456, in _traverse
      newstatus = c._traverse(status) and newstatus
    File gluon/html.py, line 463, in _traverse
      newstatus = self._validate()
    File gluon/html.py, line 1120, in _validate
      (value, errors) = validator(value)
    File gluon/validators.py, line 413, in __call__
      if self.dbset(field == value).count():
    File gluon/sql.py, line 3224, in count
      return self.select('count(*)')[0]._extra['count(*)']
    File gluon/sql.py, line 3096, in select
      rows = response(query)
    File gluon/sql.py, line 3091, in response
      db._execute(query)
    File gluon/sql.py, line 932, in lambda
      self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
    File build/bdist.linux-i686/egg/MySQLdb/cursors.py, line 166, in
  execute
      self.errorhandler(self, exc, value)
    File build/bdist.linux-i686/egg/MySQLdb/connections.py, line 35,
  in defaulterrorhandler
      raise errorclass, errorvalue
  OperationalError: (1053, 'Server shutdown in progress')

  And 1 second after:

  Traceback (most recent call last):
    File gluon/main.py, line 435, in wsgibase
      BaseAdapter.close_all_instances(BaseAdapter.rollback)
    File gluon/sql.py, line 754, in close_all_instances
      action(instance)
    File gluon/sql.py, line 1350, in rollback
      self._connection.rollback()
  OperationalError: (2006, 'MySQL server has gone away')

  On Jun 2, 6:47 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   Try

  http://web2py.com/examples/static/1.77.3/web2py_src.zip

   some version are there and some not. Those obviously buggy have been
   deleted.

   Anyway, I'd like to understand the problem.
   do you use apache? mod_wsgi?
   do you use the built-in web server?
   do you see memory leaks?
   do you have web2py cron or on off?

   Massimo

   On Jun 2, 6:06 pm, drayco antrod...@gmail.com wrote:

Where can I download web2py 1.77.3?

Because my application that's run in webfaction, with MySQL and web2py
1.78.3 needs to restart 4 times at day?

And MySql rollback today, and I obtained a error that's say server in
process to shutdown

With web2py 1.77.3 and 1.66.5 I didn't need to do that action.




[web2py] Re: How to set multiple primary key?

2010-05-19 Thread drayco
Thank's a lot Nico de Groot.

It worked for me too even with mysql.

On 18 mayo, 07:24, Nico de Groot ndegr...@chello.nl wrote:
 Hi Denes,

 I got the same syntax error (SyntaxError: invalid table account
 attribute: sequence_name ) when using a legacy database (by specifying
 the primarykey in 'define_table'). I tracked it down to the init
 method of KeyedTable in sql.py and made an adjustment that worked -
 for me at least - see below.

 Nico de Groot

 class KeyedTable(Table):
 ...
     def __init__(
         self,
         db,
         tablename,
         *fields,
         **args
         ):
 ...
         self._trigger_name = args.get('trigger_name', None)
         self._sequence_name = args.get('sequence_name', None)

         for k,v in args.iteritems():
             #patch NCdG
             if k in ['trigger_name','sequence_name']:
                 continue
             #/patch NCdG
             if k != 'primarykey':

 ...

 On 9 mei, 18:57, DenesL denes1...@yahoo.ca wrote: On May 9, 9:08 am, 
 Iceberg iceb...@21cn.com wrote:

   Thanks for the info. Would you please comment on my following
   understanding and further questions?

   1. Keyed tables are only designed for dealing with legacy tables. Is
   that true? And how do we define multiple primary keys in a brand new
   db? Consider the address book scenario in my previous post.

  Keyed tables support is primarily for legacy tables that do not have a
  field that can be used as id field. It can also be used in newly
  created tables since all operations work (except update_record). Note
  that references are specified as tablename.fieldname and can only
  reference other keyed tables.

   2. Keyed tables are yet to be supported in some other DB engines, but
   NOT the handy SQLite. Is there any special reason for that? AFAIK
   SQLite contains native support for multiple primary key.

  I might be wrong but I think SQLite does not have FK (field level
  foreign key) and TFK (table level foreign key) required for the keyed
  table support in web2py.

   3. Neither keyword KeyedTable nor primarykey can be found 
   inhttp://www.web2py.com/bookrightnow. Why? Denes' good work deserves
   being mentioned as a dedicated section.

  It was added after the book was made available and it would be my
  fault, I either had no time or forgot about it.

   Thanks in advance.

   Sincerely,
   Iceberg- Tekst uit oorspronkelijk bericht niet weergeven -

  - Tekst uit oorspronkelijk bericht weergeven -


[web2py] Re: How to set multiple primary key?

2010-05-19 Thread drayco
Thank's a lot Nico de Groot.

It worked for me too even with mysql.

On 18 mayo, 07:24, Nico de Groot ndegr...@chello.nl wrote:
 Hi Denes,

 I got the same syntax error (SyntaxError: invalid table account
 attribute: sequence_name ) when using a legacy database (by specifying
 the primarykey in 'define_table'). I tracked it down to the init
 method of KeyedTable in sql.py and made an adjustment that worked -
 for me at least - see below.

 Nico de Groot

 class KeyedTable(Table):
 ...
     def __init__(
         self,
         db,
         tablename,
         *fields,
         **args
         ):
 ...
         self._trigger_name = args.get('trigger_name', None)
         self._sequence_name = args.get('sequence_name', None)

         for k,v in args.iteritems():
             #patch NCdG
             if k in ['trigger_name','sequence_name']:
                 continue
             #/patch NCdG
             if k != 'primarykey':

 ...

 On 9 mei, 18:57, DenesL denes1...@yahoo.ca wrote: On May 9, 9:08 am, 
 Iceberg iceb...@21cn.com wrote:

   Thanks for the info. Would you please comment on my following
   understanding and further questions?

   1. Keyed tables are only designed for dealing with legacy tables. Is
   that true? And how do we define multiple primary keys in a brand new
   db? Consider the address book scenario in my previous post.

  Keyed tables support is primarily for legacy tables that do not have a
  field that can be used as id field. It can also be used in newly
  created tables since all operations work (except update_record). Note
  that references are specified as tablename.fieldname and can only
  reference other keyed tables.

   2. Keyed tables are yet to be supported in some other DB engines, but
   NOT the handy SQLite. Is there any special reason for that? AFAIK
   SQLite contains native support for multiple primary key.

  I might be wrong but I think SQLite does not have FK (field level
  foreign key) and TFK (table level foreign key) required for the keyed
  table support in web2py.

   3. Neither keyword KeyedTable nor primarykey can be found 
   inhttp://www.web2py.com/bookrightnow. Why? Denes' good work deserves
   being mentioned as a dedicated section.

  It was added after the book was made available and it would be my
  fault, I either had no time or forgot about it.

   Thanks in advance.

   Sincerely,
   Iceberg- Tekst uit oorspronkelijk bericht niet weergeven -

  - Tekst uit oorspronkelijk bericht weergeven -


[web2py] Re: How to set multiple primary key?

2010-05-19 Thread drayco
Thank's a lot Nico de Groot.

It worked for me too even with mysql.

On 18 mayo, 07:24, Nico de Groot ndegr...@chello.nl wrote:
 Hi Denes,

 I got the same syntax error (SyntaxError: invalid table account
 attribute: sequence_name ) when using a legacy database (by specifying
 the primarykey in 'define_table'). I tracked it down to the init
 method of KeyedTable in sql.py and made an adjustment that worked -
 for me at least - see below.

 Nico de Groot

 class KeyedTable(Table):
 ...
     def __init__(
         self,
         db,
         tablename,
         *fields,
         **args
         ):
 ...
         self._trigger_name = args.get('trigger_name', None)
         self._sequence_name = args.get('sequence_name', None)

         for k,v in args.iteritems():
             #patch NCdG
             if k in ['trigger_name','sequence_name']:
                 continue
             #/patch NCdG
             if k != 'primarykey':

 ...

 On 9 mei, 18:57, DenesL denes1...@yahoo.ca wrote: On May 9, 9:08 am, 
 Iceberg iceb...@21cn.com wrote:

   Thanks for the info. Would you please comment on my following
   understanding and further questions?

   1. Keyed tables are only designed for dealing with legacy tables. Is
   that true? And how do we define multiple primary keys in a brand new
   db? Consider the address book scenario in my previous post.

  Keyed tables support is primarily for legacy tables that do not have a
  field that can be used as id field. It can also be used in newly
  created tables since all operations work (except update_record). Note
  that references are specified as tablename.fieldname and can only
  reference other keyed tables.

   2. Keyed tables are yet to be supported in some other DB engines, but
   NOT the handy SQLite. Is there any special reason for that? AFAIK
   SQLite contains native support for multiple primary key.

  I might be wrong but I think SQLite does not have FK (field level
  foreign key) and TFK (table level foreign key) required for the keyed
  table support in web2py.

   3. Neither keyword KeyedTable nor primarykey can be found 
   inhttp://www.web2py.com/bookrightnow. Why? Denes' good work deserves
   being mentioned as a dedicated section.

  It was added after the book was made available and it would be my
  fault, I either had no time or forgot about it.

   Thanks in advance.

   Sincerely,
   Iceberg- Tekst uit oorspronkelijk bericht niet weergeven -

  - Tekst uit oorspronkelijk bericht weergeven -


[web2py] problem with 1.77.3 1.78.3 and legacy database

2010-05-17 Thread drayco
Hi, I updated my web2py, but I had a problem with web2py 1.78.3, I use
legacy databases. When I try to go to my application I got this

Error traceback

Traceback (most recent call last):
  File /media/RESPALDO/web2py/gluon/restricted.py, line 178, in
restricted
exec ccode in environment
  File /media/RESPALDO/web2py/applications/scada/models/
calenergy.py, line 8, in module
migrate = False)
  File /media/RESPALDO/web2py/gluon/sql.py, line 1296, in
define_table
**dict(primarykey=args['primarykey'], trigger_name=trigger_name,
sequence_name=sequence_name))
  File /media/RESPALDO/web2py/gluon/sql.py, line 2115, in __init__
raise SyntaxError, 'invalid table %s attribute: %s' %
(tablename, k)
SyntaxError: invalid table area attribute: sequence_name

In file: /media/RESPALDO/web2py/applications/scada/models/calenergy.py

calenergy=SQLDB('mysql://xxx:x...@127.0.0.1:3306/xxx',pool_size=10)

calenergy.define_table('area',
Field('clave', type = 'char' , length = 3 ),
Field('IdZona', type = 'integer' , length = 10 ),
Field('nombre', type = 'string' , length = 50 ),
primarykey=['clave','IdZona'],
migrate = False)

Even with web2py 1.77.3.

What this mean?

with my older version of web2py, I work well.


[web2py] Re: What is this mean?

2010-04-07 Thread drayco
Good afternoon Dr.Massimo:

I fixed the problem.
Previously I had done the following:
I Removed web2py
I downloaded and unzipped all
I passed my application

But I forgot to stop the previous process of web2py

And I only restarted this process and it recovered, and now,
everything works well.

On Apr 7, 12:32 am, mdipierro mdipie...@cs.depaul.edu wrote:
 can you open a regular python shell and run

 import os
 print os.path.abspath(os.path.join('applications/admin/','hello'))

 ? looks like a python issue, it cannot determine os.getcwd()

 On Apr 7, 12:23 am, drayco antrod...@gmail.com wrote:

  I have web2py 1.76.5 with red hat 5.5 enterprise linux 5.5 at 64 bits.
  I updated web2py and when I try to go to admin i got this error.

  What is this mean?

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 173, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/admin/models/0.py, line 41,
  in module
      GAE_APPCFG = os.path.abspath(os.path.join('applications/admin/
  private/appcfg.py'))
    File /usr/local/lib/python2.5/posixpath.py, line 403, in abspath
      path = join(os.getcwd(), path)
  OSError: [Errno 2] No such file or directory

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: What is this mean?

2010-04-07 Thread drayco
Good afternoon Dr.Massimo:

I fixed the problem.
Previously I had done the following:
I Removed web2py
I downloaded and unzipped all
I passed my application

But I forgot to stop the previous process of web2py

And I only restarted this process and it recovered, and now,
everything works well.

On Apr 7, 12:32 am, mdipierro mdipie...@cs.depaul.edu wrote:
 can you open a regular python shell and run

 import os
 print os.path.abspath(os.path.join('applications/admin/','hello'))

 ? looks like a python issue, it cannot determine os.getcwd()

 On Apr 7, 12:23 am, drayco antrod...@gmail.com wrote:

  I have web2py 1.76.5 with red hat 5.5 enterprise linux 5.5 at 64 bits.
  I updated web2py and when I try to go to admin i got this error.

  What is this mean?

  Traceback (most recent call last):
    File /home/drayco/web2py/gluon/restricted.py, line 173, in
  restricted
      exec ccode in environment
    File /home/drayco/web2py/applications/admin/models/0.py, line 41,
  in module
      GAE_APPCFG = os.path.abspath(os.path.join('applications/admin/
  private/appcfg.py'))
    File /usr/local/lib/python2.5/posixpath.py, line 403, in abspath
      path = join(os.getcwd(), path)
  OSError: [Errno 2] No such file or directory

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] What is this mean?

2010-04-06 Thread drayco
I have web2py 1.76.5 with red hat 5.5 enterprise linux 5.5 at 64 bits.
I updated web2py and when I try to go to admin i got this error.

What is this mean?

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/restricted.py, line 173, in
restricted
exec ccode in environment
  File /home/drayco/web2py/applications/admin/models/0.py, line 41,
in module
GAE_APPCFG = os.path.abspath(os.path.join('applications/admin/
private/appcfg.py'))
  File /usr/local/lib/python2.5/posixpath.py, line 403, in abspath
path = join(os.getcwd(), path)
OSError: [Errno 2] No such file or directory

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] OperationalError 1054 Unknown column 'auth_user.reset_password_key' in 'field list'

2010-03-27 Thread drayco
Hi everyone.

I have a application in a server production with web2py 1.72.3 and
MySQL, and in this moment, I try to do some modifications in my
localhost, but when I try to use with web2py 1.76.5 I got this error
when I try to enter, Only in auth.
I see that you did some changes in auth tables, well especifically in
auth.user.
My question is, What can I do to avoid this problem?
I want to use that database in my tests.
If I will put that changes in MySQL, Will I have problems?

Traceback (most recent call last):
  File /media/RESPALDO/web2py/gluon/restricted.py, line 173, in
restricted
exec ccode in environment
  File /media/RESPALDO/web2py/applications/seccion36/controllers/
default.py, line 91, in module
  File /media/RESPALDO/web2py/gluon/globals.py, line 96, in lambda
self._caller = lambda f: f()
  File /media/RESPALDO/web2py/applications/seccion36/controllers/
default.py, line 32, in user
return dict(form=auth())
  File /media/RESPALDO/web2py/gluon/tools.py, line 723, in __call__
return self.login()
  File /media/RESPALDO/web2py/gluon/tools.py, line 1045, in login
user = self.db(table_user[username] ==
form.vars[username]).select().first()
  File /media/RESPALDO/web2py/gluon/sql.py, line 3056, in select
rows = response(query)
  File /media/RESPALDO/web2py/gluon/sql.py, line 3051, in response
db._execute(query)
  File /media/RESPALDO/web2py/gluon/sql.py, line 928, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
  File /usr/lib/pymodules/python2.6/MySQLdb/cursors.py, line 166, in
execute
self.errorhandler(self, exc, value)
  File /usr/lib/pymodules/python2.6/MySQLdb/connections.py, line 35,
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1054, Unknown column
'auth_user.reset_password_key' in 'field list')

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Cuestion about jzip and jpg image?

2010-02-25 Thread drayco
Hi, web2py users,
I have a application with 6 web services with json in web2py.
I answer topological information every minute.
And my partners told me that the size of the answer is too large. They
told me that we need to use jzip.
The new requirements is that I need to give a jpg image too.

But I am a newbie in web application.

Can any of you give me a litle example with jzip?

And How can I put a jpg image in a web service?

Thank's in advance.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Cuestion about jzip and jpg image?

2010-02-25 Thread drayco
Hi, web2py users,
I have a application with 6 web services with json in web2py.
I answer topological information every minute.
And my partners told me that the size of the answer is too large. They
told me that we need to use jzip.
The new requirements is that I need to give a jpg image too.

But I am a newbie in web application.

Can any of you give me a litle example with jzip?

And How can I put a jpg image in a web service?

Thank's in advance.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Help, What this mean?

2010-01-18 Thread drayco
Good night

My mistake. I did what you say.
I removed all files in the folder web2py/applications/welcome/cache
and web2py/applications/admin/cache
And I can see welcome and admin page.

Thank's at lot

On 16 ene, 01:35, mdipierro mdipie...@cs.depaul.edu wrote:
 is there anything in the applications/welcome/cache folder? If so,
 could you send me those files to look at.

 On Jan 16, 1:27 am, drayco antrod...@gmail.com wrote:

  Does your app have write access to the applications folder? Yes, It
  was rw and x.

  Even I try to run as root and it was still happen

  I delete admin,welcome and examples folders and I replaced it with my
  files and It was still happen

  does pysqlite2 have any problem?

  On 15 ene, 08:21, mdipierro mdipie...@cs.depaul.edu wrote:

   Does your app have write access to the applications folder?

   On Jan 14, 11:37 pm, drayco antrod...@gmail.com wrote:

which web2py version? 1.7.6

Can you try delete everything in the cache folder of your application?
No, I just Install and I try to run it for the first time

I try to use the embeded web server
I reviewed the folder web2py/applications/welcome/database/ and it is
empty
Maybe the lib for sqlite doesn't work well

Some test that I can do?

On 14 ene, 19:31, mdipierro mdipie...@cs.depaul.edu wrote:

 I slightly changes the behavior in trunk about his.

 The problem is corrupted cache file. So instead of failing, it will
 now just log the failure to open the file. You will get an error only
 if you actually try to use the cache.disk and the file is corrupted.

 We still need to understand how this can happen. My guess is this can
 happen if a request takes too long and the web server happens to kill
 a thread while it is writing on cache.disk.

 On Jan 14, 7:19 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Never seen this before. which web2py version?

  Can you try delete everything in the cache folder of your 
  application?

  On Jan 14, 7:16 pm, drayco antrod...@gmail.com wrote:

   I follow this:

  http://www.web2py.com/AlterEgo/default/show/239
   Installing web2py with MySQL on a bare CentOS 5 machine

   Because we work with Red Hat Enterprise Linux 5.

   When I run web2py. I see this:

   web2py Enterprise Web Framework
   Created by Massimo Di Pierro, Copyright 2007-2010
   Version 1.74.6 (2010-01-13 11:12:48)
   Database drivers available: pysqlite2, MySQL, PostgreSQL
   Starting cron...
   please visit:
          http://127.0.0.1:7713
   use kill -SIGTERM 6581 to shutdown the web2py server

   But when I try tohttp://localhost:7713/

   I got this

   Error ticket for welcome
   Ticket 127.0.0.1.2010-01-14.13-39-00.faf5f883-e4f2-48d2-96b6-
   c1a697eafdfb

   Error traceback

   Traceback (most recent call last):
     File /home/drayco/web2py/gluon/main.py, line 478, in wsgibase
       serve_controller(request, response, session)
     File /home/drayco/web2py/gluon/main.py, line 178, in
   serve_controller
       environment = build_environment(request, response, session)
     File /home/drayco/web2py/gluon/compileapp.py, line 248, in
   build_environment
       environment['cache'] = Cache(request)
     File /home/drayco/web2py/gluon/cache.py, line 358, in __init__
       self.disk = CacheOnDisk(request)
     File /home/drayco/web2py/gluon/cache.py, line 238, in __init__
       storage = shelve.open(self.shelve_name)
     File /usr/local/lib/python2.5/shelve.py, line 225, in open
       return DbfilenameShelf(filename, flag, protocol, writeback)
     File /usr/local/lib/python2.5/shelve.py, line 209, in __init__
       Shelf.__init__(self, anydbm.open(filename, flag), protocol,
   writeback)
     File /usr/local/lib/python2.5/anydbm.py, line 83, in open
       return mod.open(file, flag, mode)
     File /usr/local/lib/python2.5/dbhash.py, line 16, in open
       return bsddb.hashopen(file, flag, mode)
     File /usr/local/lib/python2.5/bsddb/__init__.py, line 310, in
   hashopen
       d.open(file, db.DB_HASH, flags, mode)
   DBFileExistsError: (17, 'File exists -- __fop_file_setup:  Retry 
   limit
   (100) exceeded')

   Can any help me? What thismean?
-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py] Help, What this mean?

2010-01-14 Thread drayco
I follow this:

http://www.web2py.com/AlterEgo/default/show/239
Installing web2py with MySQL on a bare CentOS 5 machine

Because we work with Red Hat Enterprise Linux 5.

When I run web2py. I see this:

web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.74.6 (2010-01-13 11:12:48)
Database drivers available: pysqlite2, MySQL, PostgreSQL
Starting cron...
please visit:
http://127.0.0.1:7713
use kill -SIGTERM 6581 to shutdown the web2py server

But when I try to http://localhost:7713/

I got this

Error ticket for welcome
Ticket 127.0.0.1.2010-01-14.13-39-00.faf5f883-e4f2-48d2-96b6-
c1a697eafdfb

Error traceback

Traceback (most recent call last):
  File /home/drayco/web2py/gluon/main.py, line 478, in wsgibase
serve_controller(request, response, session)
  File /home/drayco/web2py/gluon/main.py, line 178, in
serve_controller
environment = build_environment(request, response, session)
  File /home/drayco/web2py/gluon/compileapp.py, line 248, in
build_environment
environment['cache'] = Cache(request)
  File /home/drayco/web2py/gluon/cache.py, line 358, in __init__
self.disk = CacheOnDisk(request)
  File /home/drayco/web2py/gluon/cache.py, line 238, in __init__
storage = shelve.open(self.shelve_name)
  File /usr/local/lib/python2.5/shelve.py, line 225, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
  File /usr/local/lib/python2.5/shelve.py, line 209, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol,
writeback)
  File /usr/local/lib/python2.5/anydbm.py, line 83, in open
return mod.open(file, flag, mode)
  File /usr/local/lib/python2.5/dbhash.py, line 16, in open
return bsddb.hashopen(file, flag, mode)
  File /usr/local/lib/python2.5/bsddb/__init__.py, line 310, in
hashopen
d.open(file, db.DB_HASH, flags, mode)
DBFileExistsError: (17, 'File exists -- __fop_file_setup:  Retry limit
(100) exceeded')

Can any help me? What this mean?
-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py] Re: Help, What this mean?

2010-01-14 Thread drayco
which web2py version? 1.7.6

Can you try delete everything in the cache folder of your application?
No, I just Install and I try to run it for the first time

I try to use the embeded web server
I reviewed the folder web2py/applications/welcome/database/ and it is
empty
Maybe the lib for sqlite doesn't work well

Some test that I can do?


On 14 ene, 19:31, mdipierro mdipie...@cs.depaul.edu wrote:
 I slightly changes the behavior in trunk about his.

 The problem is corrupted cache file. So instead of failing, it will
 now just log the failure to open the file. You will get an error only
 if you actually try to use the cache.disk and the file is corrupted.

 We still need to understand how this can happen. My guess is this can
 happen if a request takes too long and the web server happens to kill
 a thread while it is writing on cache.disk.

 On Jan 14, 7:19 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Never seen this before. which web2py version?

  Can you try delete everything in the cache folder of your application?

  On Jan 14, 7:16 pm, drayco antrod...@gmail.com wrote:

   I follow this:

  http://www.web2py.com/AlterEgo/default/show/239
   Installing web2py with MySQL on a bare CentOS 5 machine

   Because we work with Red Hat Enterprise Linux 5.

   When I run web2py. I see this:

   web2py Enterprise Web Framework
   Created by Massimo Di Pierro, Copyright 2007-2010
   Version 1.74.6 (2010-01-13 11:12:48)
   Database drivers available: pysqlite2, MySQL, PostgreSQL
   Starting cron...
   please visit:
          http://127.0.0.1:7713
   use kill -SIGTERM 6581 to shutdown the web2py server

   But when I try tohttp://localhost:7713/

   I got this

   Error ticket for welcome
   Ticket 127.0.0.1.2010-01-14.13-39-00.faf5f883-e4f2-48d2-96b6-
   c1a697eafdfb

   Error traceback

   Traceback (most recent call last):
     File /home/drayco/web2py/gluon/main.py, line 478, in wsgibase
       serve_controller(request, response, session)
     File /home/drayco/web2py/gluon/main.py, line 178, in
   serve_controller
       environment = build_environment(request, response, session)
     File /home/drayco/web2py/gluon/compileapp.py, line 248, in
   build_environment
       environment['cache'] = Cache(request)
     File /home/drayco/web2py/gluon/cache.py, line 358, in __init__
       self.disk = CacheOnDisk(request)
     File /home/drayco/web2py/gluon/cache.py, line 238, in __init__
       storage = shelve.open(self.shelve_name)
     File /usr/local/lib/python2.5/shelve.py, line 225, in open
       return DbfilenameShelf(filename, flag, protocol, writeback)
     File /usr/local/lib/python2.5/shelve.py, line 209, in __init__
       Shelf.__init__(self, anydbm.open(filename, flag), protocol,
   writeback)
     File /usr/local/lib/python2.5/anydbm.py, line 83, in open
       return mod.open(file, flag, mode)
     File /usr/local/lib/python2.5/dbhash.py, line 16, in open
       return bsddb.hashopen(file, flag, mode)
     File /usr/local/lib/python2.5/bsddb/__init__.py, line 310, in
   hashopen
       d.open(file, db.DB_HASH, flags, mode)
   DBFileExistsError: (17, 'File exists -- __fop_file_setup:  Retry limit
   (100) exceeded')

   Can any help me? What this mean?
-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:36179] How can I avoid this error in pagination?

2009-11-29 Thread drayco
This is my function

@auth.requires_membership('Capturista')
def lee_notas():
if len(request.args): page=int(request.args[0])
else: page=0
items_per_page=25
limitby=(page*items_per_page,(page+1)*items_per_page+1)
Capturista = db(db.capturistas.creadoPor==auth.user.id).select()
notas=db((db.notas.entregado==False)
(db.notas.vendedor==db.vendedores.id)
(db.vendedores.regional==Capturista[0].regional)).select
(db.notas.id,db.notas.nota, \
 
db.notas.folio,db.notas.armazon1,db.notas.lente1,db.notas.lc4,db.notas.total,db.notas.anticipo,db.notas.pago,db.notas.saldo,db.notas.vendedor,db.notas.optometrista,db.notas.creadoEl,orderby=~db.notas.nota,limitby=limitby)
return dict(notas=notas,page=page,items_per_page=items_per_page)

This is my view

{{extend 'layout.html'}}
h4Notas de Óptica Luz/h4
[ {{=A('Crear 1(una) Nota de Venta', _href=URL(r=request,
f='crea_nota'))}} ]
ul{{for i,nota in enumerate(notas):}}
{{if i==items_per_page: break}}
{{=LI(A('Nota ',nota.nota,' Folio ',nota.folio,' [',db.armazones
[nota.armazon1].marca,' ',db.armazones[nota.armazon1].caract1,' 
',db.lentes[nota.lente1].material,' ',db.lentes[nota.lente1].tipo,'
',db.lentes[nota.lente1].tecnoVisual,' ',db.lentes
[nota.lente1].tratamiento,'] ',db.lentesContacto[nota.lc4].marca,' T
$',nota.total,' - A$',nota.anticipo,' - P$',nota.pago,' = S
$',nota.saldo,' {',db.vendedores[nota.vendedor].names,' 
',db.optometristas[nota.optometrista].names,'}',' del ',nota.creadoEl,
_href=URL(r=request, f='show_nota', args=nota.id)))}}
{{pass}}/ul
{{if page:}}
a href={{=URL(r=request,args=[page-1])}}Anterior/a
{{pass}}
{{if len(notas)items_per_page:}}
a href={{=URL(r=request,args=[page+1])}}Siguiente/a
{{pass}}

When items_per_page=25 everything is ok
When I put items_per_page=50 Web2py give me this error:

Traceback (most recent call last):
  File /media/RESPALDO/web2py/gluon/restricted.py, line 184, in
restricted
exec ccode in environment
  File /media/RESPALDO/web2py/applications/seccion36/views/default/
lee_notas.html, line 38, in module
  File /media/RESPALDO/web2py/gluon/globals.py, line 112, in write
self.body.write(xmlescape(data))
  File /media/RESPALDO/web2py/gluon/html.py, line 103, in xmlescape
return data.xml()
  File /media/RESPALDO/web2py/gluon/html.py, line 517, in xml
(fa, co) = self._xml()
  File /media/RESPALDO/web2py/gluon/html.py, line 508, in _xml
self.components])
  File /media/RESPALDO/web2py/gluon/html.py, line 103, in xmlescape
return data.xml()
  File /media/RESPALDO/web2py/gluon/html.py, line 517, in xml
(fa, co) = self._xml()
  File /media/RESPALDO/web2py/gluon/html.py, line 508, in _xml
self.components])
  File /media/RESPALDO/web2py/gluon/html.py, line 103, in xmlescape
return data.xml()
  File /media/RESPALDO/web2py/gluon/sql.py, line 1370, in
__getattr__
self.__allocate()
  File /media/RESPALDO/web2py/gluon/sql.py, line 1365, in __allocate
raise Exception, undefined record
Exception: undefined record

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:36191] Re: How can I avoid this error in pagination?

2009-11-29 Thread drayco
Thank's a lot for you advice.

On 29 nov, 12:56, mdipierro mdipie...@cs.depaul.edu wrote:
 I do not think there is an error in your code. You have a lot of

 {{=table[nota.field].otherfield}}

 One of these may be failing if note.field references a record that no
 longer exist. Try instead

 {{=table[nota.field].otherfield if table[nota.field] else
 'undefined'}}

 Anyway, this code does a lot of DB access. I assume you are running on
 GAE. if not, you should use a join instead.

 On Nov 29, 12:29 pm, drayco antrod...@gmail.com wrote:

  This is my function

  @auth.requires_membership('Capturista')
  def lee_notas():
      if len(request.args): page=int(request.args[0])
      else: page=0
      items_per_page=25
      limitby=(page*items_per_page,(page+1)*items_per_page+1)
      Capturista = db(db.capturistas.creadoPor==auth.user.id).select()
      notas=db((db.notas.entregado==False)
  (db.notas.vendedor==db.vendedores.id)
  (db.vendedores.regional==Capturista[0].regional)).select
  (db.notas.id,db.notas.nota, \

  db.notas.folio,db.notas.armazon1,db.notas.lente1,db.notas.lc4,db.notas.total,db.notas.anticipo,db.notas.pago,db.notas.saldo,db.notas.vendedor,db.notas.optometrista,db.notas.creadoEl,orderby=~db.notas.nota,limitby=limitby)
      return dict(notas=notas,page=page,items_per_page=items_per_page)

  This is my view

  {{extend 'layout.html'}}
  h4Notas de Óptica Luz/h4
  [ {{=A('Crear 1(una) Nota de Venta', _href=URL(r=request,
  f='crea_nota'))}} ]
  ul{{for i,nota in enumerate(notas):}}
  {{if i==items_per_page: break}}
  {{=LI(A('Nota ',nota.nota,' Folio ',nota.folio,' [',db.armazones
  [nota.armazon1].marca,' ',db.armazones[nota.armazon1].caract1,' 
  ',db.lentes[nota.lente1].material,' ',db.lentes[nota.lente1].tipo,'
  ',db.lentes[nota.lente1].tecnoVisual,' ',db.lentes
  [nota.lente1].tratamiento,'] ',db.lentesContacto[nota.lc4].marca,' T
  $',nota.total,' - A$',nota.anticipo,' - P$',nota.pago,' = S
  $',nota.saldo,' {',db.vendedores[nota.vendedor].names,' 
  ',db.optometristas[nota.optometrista].names,'}',' del ',nota.creadoEl,
  _href=URL(r=request, f='show_nota', args=nota.id)))}}
  {{pass}}/ul
  {{if page:}}
  a href={{=URL(r=request,args=[page-1])}}Anterior/a
  {{pass}}
  {{if len(notas)items_per_page:}}
  a href={{=URL(r=request,args=[page+1])}}Siguiente/a
  {{pass}}

  When items_per_page=25 everything is ok
  When I put items_per_page=50 Web2py give me this error:

  Traceback (most recent call last):
    File /media/RESPALDO/web2py/gluon/restricted.py, line 184, in
  restricted
      exec ccode in environment
    File /media/RESPALDO/web2py/applications/seccion36/views/default/
  lee_notas.html, line 38, in module
    File /media/RESPALDO/web2py/gluon/globals.py, line 112, in write
      self.body.write(xmlescape(data))
    File /media/RESPALDO/web2py/gluon/html.py, line 103, in xmlescape
      return data.xml()
    File /media/RESPALDO/web2py/gluon/html.py, line 517, in xml
      (fa, co) = self._xml()
    File /media/RESPALDO/web2py/gluon/html.py, line 508, in _xml
      self.components])
    File /media/RESPALDO/web2py/gluon/html.py, line 103, in xmlescape
      return data.xml()
    File /media/RESPALDO/web2py/gluon/html.py, line 517, in xml
      (fa, co) = self._xml()
    File /media/RESPALDO/web2py/gluon/html.py, line 508, in _xml
      self.components])
    File /media/RESPALDO/web2py/gluon/html.py, line 103, in xmlescape
      return data.xml()
    File /media/RESPALDO/web2py/gluon/sql.py, line 1370, in
  __getattr__
      self.__allocate()
    File /media/RESPALDO/web2py/gluon/sql.py, line 1365, in __allocate
      raise Exception, undefined record
  Exception: undefined record

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.




[web2py:34977] Re: Chapter 1 from 2nd edition web2py book in Spanish

2009-11-09 Thread drayco

I think, you need more help in this kind of work.

Buenas tardes. Puedo ayudarlos revisando la traducción, por el
momento. A partir del 15 de Diciembre podría contribuir con uno o dos
capítulos.

Sin embargo, no quisiera dejar pasar la oportunidad para comentar que
existen frases que no refieren explícitamente con el concepto.

¿Eres un hablante nativo del español?

On Nov 8, 4:37 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 You have been busy! This is great Denes. We have to think of a good
 way to advertise this.

 On Nov 8, 10:00 am, DenesL denes1...@yahoo.ca wrote:

  Chapter 1 from 2nd edition web2py book in Spanish
  Capítulo 1 del manual web2py 2da edición en Español

 http://drop.io/web2py_DenesL/asset/web2py-libro2-cap1-pdf

  Want to help in translating other chapters?
  ¿Quiere ayudar con la traducción de otros capítulos?

  Contact me.
  Contácteme.

  Denes.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:34998] Re: 1.72.1 is OUT

2009-11-09 Thread drayco

I use MySQL and auth. When i try to login, Web2py 1.72.1 give me this
error. But With Web2py 1.71.1 this dosen't happend.

Traceback (most recent call last):
  File /media/RESPALDO/web2py/gluon/restricted.py, line 184, in
restricted
exec ccode in environment
  File /media/RESPALDO/web2py/applications/seccion36/controllers/
default.py, line 1168, in module
  File /media/RESPALDO/web2py/gluon/globals.py, line 103, in
lambda
self._caller = lambda f: f()
  File /media/RESPALDO/web2py/applications/seccion36/controllers/
default.py, line 33, in user
return dict(form=auth())
  File /media/RESPALDO/web2py/gluon/tools.py, line 682, in __call__
return self.login()
  File /media/RESPALDO/web2py/gluon/tools.py, line 1037, in login
self.log_event(log % self.user)
KeyError: 'id'



On 9 nov, 14:12, mdipierro mdipie...@cs.depaul.edu wrote:
 New stuff:
 - bug fix in select(...,cache=)
 - bug fix in internationalization with default languages
 - better polish and french translations
 - better support for KeyedTables (thanks Denes) and alternate names
 for 'id' fields (thanks Michael). This allow better support for legacy
 databases.

 Please give it a try and report any problem.

 Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32514] Re: submenus and IE

2009-10-08 Thread drayco

With two machines with Windos Vista and IE6 It didn't work.

On Oct 6, 10:31 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Has anybody tried submenus and IE. Do they work? I assumed they did
 not I tried once and it did not work for me.

 Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:32515] How to avoid this error with MySQL in WebFaction?

2009-10-08 Thread drayco

Hi, I don't want this error happen. Please, Can you teach me how to
avoid this error with MySQL in WebFaction?

Traceback (most recent call last):
  File /home/user/webapps/app/web2py/gluon/restricted.py, line 178,
in restricted
exec ccode in environment
  File /home/user/webapps/app/web2py/applications/init/models/db.py,
line 16, in module
db=SQLDB('mysql://user_app:x...@127.0.0.1/
user_app',pool_size=10)
  File /home/user/webapps/app/web2py/gluon/sql.py, line 740, in
__init__
self._execute('SET FOREIGN_KEY_CHECKS=0;')
  File /home/user/webapps/app/web2py/gluon/sql.py, line 739, in
lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
  File build/bdist.linux-i686/egg/MySQLdb/cursors.py, line 166, in
execute
self.errorhandler(self, exc, value)
  File build/bdist.linux-i686/egg/MySQLdb/connections.py, line 35,
in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (2006, 'MySQL server has gone away')
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:31934] auth allow same user at the same time with different pc with different ip

2009-09-30 Thread drayco

I have many users with differents roles.
Those users gave their passwords and username to others.
I use auth and it allows to the
people login in to the application with the same user at the same time
with different pc with different ip.

And I don't want that happen.

Please, Can anybody help me? What can i do?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:30940] Re: Can you help me with static files in webfaction?

2009-09-13 Thread drayco

Whith the help of webfaction support. I fixed my mistake.
This is the brief history.
I used the tool of web2py to pack my application.
When I unpacked my application, it didn't unpack well all files. I did
that two times and in the two cases the errors are in the
web2py_ajax.html.
We need a tool to check packed and unpacked files.

On 11 sep, 12:24, drayco antrod...@gmail.com wrote:
 Hi, Dr. Massimo:

      Can you help me please?

      This is my situation:
      I have a subdomain inwebfactionwith https.
      I can work with default applications of web2py. Even I can put
 data in a mysql database. All of that in with my subdomain inwebfaction.
      However, when a I request the init application, I can't see
 anything. I think, this is because I have a custom style with images
 instatic/img

      I tried with this configuration in httpd.conf to fix that.
 However, I missed something.

 Thank's a lot, Because You do a great job!.

 =  START httpd.conf listing  ==

 ServerRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/apache2

 LoadModule dir_module modules/mod_dir.so
 LoadModule env_module modules/mod_env.so
 LoadModule log_config_module modules/mod_log_config.so
 LoadModule mime_module modules/mod_mime.so
 LoadModule rewrite_module modules/mod_rewrite.so
 LoadModule wsgi_module modules/mod_wsgi.so
 LoadModule alias_module modules/mod_alias.so
 LoadModule authz_host_module modules/mod_authz_host.so

 KeepAlive Off
 Listen [PORT SPECIFIED BYWEBFACTION]

 WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 wsgihandler.py
 WSGIDaemonProcess web2py user=[YOUR ACCOUNT] group=[YOUR ACCOUNT] \
      home=/home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py \
      processes=1 maximum-requests=1000

 NameVirtualHost 127.0.0.1:[PORT SPECIFIED BYWEBFACTION]
 VirtualHost 127.0.0.1:[PORT SPECIFIED BYWEBFACTION]
     ServerName [YOUR ACCOUNT].webfactional.com
     DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 applications
     Directory /
             Options FollowSymLinks
             AllowOverride None
     /Directory
     Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
             Options Indexes FollowSymLinks MultiViews
             AllowOverride None
             Order allow,deny
             allow from all
     /Directory

     Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py
            AllowOverride None
            Order Allow,Deny
            Deny from all
           Files wsgihandler.py
                  Allow from all
           /Files
     /Directory
     AliasMatch ˆ/([ˆ/]+)/static/(.*) /home/[YOUR ACCOUNT]/webapps/
 apachewsgi/web2py/applications/$1/static/$2
     Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 applications/*/static/
           Order Allow,Deny
           Allow from all
      /Directory
 /VirtualHost

 LogFormat %{X-Forwarded-For}i %l %u %t \%r\ %s %b \%{Referer}i\
 \
      \%{User-Agent}i\ combined
 CustomLog logs/access_log combined
 ServerLimit 2
 =  END httpd.conf listing  ==
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:30743] Can you help me with static files in webfaction?

2009-09-11 Thread drayco

Hi, Dr. Massimo:

 Can you help me please?

 This is my situation:
 I have a subdomain in webfaction with https.
 I can work with default applications of web2py. Even I can put
data in a mysql database. All of that in with my subdomain in
webfaction.
 However, when a I request the init application, I can't see
anything. I think, this is because I have a custom style with images
in static/img

 I tried with this configuration in httpd.conf to fix that.
However, I missed something.

Thank's a lot, Because You do a great job!.

=  START httpd.conf listing  ==

ServerRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/apache2

LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule alias_module modules/mod_alias.so
LoadModule authz_host_module modules/mod_authz_host.so

KeepAlive Off
Listen [PORT SPECIFIED BY WEBFACTION]

WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
wsgihandler.py
WSGIDaemonProcess web2py user=[YOUR ACCOUNT] group=[YOUR ACCOUNT] \
 home=/home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py \
 processes=1 maximum-requests=1000

NameVirtualHost 127.0.0.1:[PORT SPECIFIED BY WEBFACTION]
VirtualHost 127.0.0.1:[PORT SPECIFIED BY WEBFACTION]
ServerName [YOUR ACCOUNT].webfactional.com
DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
/Directory

Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py
   AllowOverride None
   Order Allow,Deny
   Deny from all
  Files wsgihandler.py
 Allow from all
  /Files
/Directory
AliasMatch ˆ/([ˆ/]+)/static/(.*) /home/[YOUR ACCOUNT]/webapps/
apachewsgi/web2py/applications/$1/static/$2
Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications/*/static/
  Order Allow,Deny
  Allow from all
 /Directory
/VirtualHost

LogFormat %{X-Forwarded-For}i %l %u %t \%r\ %s %b \%{Referer}i\
\
 \%{User-Agent}i\ combined
CustomLog logs/access_log combined
ServerLimit 2
=  END httpd.conf listing  ==


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:30682] help with static files in webfaction

2009-09-10 Thread drayco

Good night, I ask for your support with this situation

I have a subdomain on WebFaction.
At this time, I can see and work with the admin, welcome and a mysql
database in my application in WebFaction.
However, when I request my subdomain, the initial application (init)
loads blank pages. I think, the init application is not loading with
the custom style that I have in the static folder. However, the
default applications of web2py loads their styles without problems. Do
you have any suggestions?

This is my configuration in httpd.conf

=  START httpd.conf listing  ==

ServerRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/apache2

LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule alias_module modules/mod_alias.so
LoadModule authz_host_module modules/mod_authz_host.so

KeepAlive Off
Listen [PORT SPECIFIED BY WEBFACTION]

WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
wsgihandler.py
WSGIDaemonProcess web2py user=[YOUR ACCOUNT] group=[YOUR ACCOUNT] \
 home=/home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py \
 processes=1 maximum-requests=1000

NameVirtualHost 127.0.0.1:[PORT SPECIFIED BY WEBFACTION]
VirtualHost 127.0.0.1:[PORT SPECIFIED BY WEBFACTION]
ServerName www.example.com
DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
/Directory
Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
 AllowOverride None
 Order Allow,Deny
 Deny from all
 Files wsgihandler.py
   Allow from all
 /Files
 /Directory
  AliasMatch ˆ/([ˆ/]+)/static/(.*) /home/[YOUR ACCOUNT]/webapps/
apachewsgi/web2py/applications/$1/static/$2
 Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications/*/static/
Order Allow,Deny
Allow from all
/Directory
/VirtualHost

LogFormat %{X-Forwarded-For}i %l %u %t \%r\ %s %b \%{Referer}i\
\
 \%{User-Agent}i\ combined
CustomLog logs/access_log combined
ServerLimit 2

=  END httpd.conf listing  ==
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16510] Re: t3 backup/restore

2009-02-18 Thread drayco

Hi, I saw the new t3 Version 0.4 (2009-02-05 09:36:05) but I didn't
saw any change in backup/restore funtion of t3.

Can you help me i want to fix the bug because i want to migrate the
database?

I use t3 Version 0.4 (2009-01-07 09:01:19) and web2py 1.55.2 in
a website in production enviroment.

On 12 feb, 13:41, drayco antrod...@gmail.com wrote:
 Ok, i wait the new version.

 Thank's in advanced.

 On Feb 12, 1:25 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  there was a bug in backup/restore that is now fixed in trunk.
  Can you want next Tuesday I post the next version?

  Massimo

  On Feb 12, 12:31 pm, drayco antrod...@gmail.com wrote:

   Hi, I usingt3Version 0.4 (2009-01-07 09:01:19) and web2py 1.55.2 in
   a website in production enviroment.

   In this moment we have 750 users and more of 10,000 registers of
   diferent kind data and i am using sqlite. The web site 
   ishttp://www.seccion36.org.mx.

   The problem is the following: when i use backup/restore in the
   website, i can generete a backup but when i try to restore in a local
   site i can't do it.

   I have the same problem with the new version oft3and web2py.

   can you give me an advice?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16423] Re: question about t3 session

2009-02-16 Thread drayco

ups, thank's a lot massimo.

Your help and patient are really incredible.

I am going to try to read and understand more before I will ask you.

On 16 feb, 21:48, mdipierro mdipie...@cs.depaul.edu wrote:
 The problem is how to determine that one person is done. My rule was 5
 minues (300 seconds) of inactivity.

 You can change the 300 in the cache.ram(...,300).

 On Feb 16, 7:05 pm, drayco antrod...@gmail.com wrote:

  Hi massimo, i did other test in the school with 2 machines with 2
  diferent ip.
  At first, I felt happy to see that it worked.

  However, I wait 5 minutes in which I didn't had any activity with my
  session.
  And i can have access with diferent machine and ip.

  I think, I need configure something, can you help me?

  On 15 feb, 10:59, drayco antrod...@gmail.com wrote:

   I use a share hosting with wgsi and apache2 in webfaction.

   Ok, I will try to do the test.

   Thank's for your help.

   On Feb 15, 8:46 am, mdipierro mdipie...@cs.depaul.edu wrote:

That should have worked. Can you tell me more about your setup? Are
you using a proxy? wsgi? apache?

can you print request.client when the two users login from different
IP using the same password within 5 minutes?

Massimo

On Feb 13, 6:44 pm, drayco antrod...@gmail.com wrote:

 Hi mdipierro, Thank's for your help.

 However, the problem is the same.

 Please, do you have other idea?

 On 13 feb, 12:34, mdipierro mdipie...@cs.depaul.edu wrote:

  Please one more try replace:

  def login(): return dict(form=t2.login())

  with

  if t2.logged_in:
      cache.ram('client:%s' % t2.person_email, lambda:request.client,
  -1)

  def login():
      if request.vars.email:
          client=cache.ram('client:%s' %
  request.vars.email,lambda:request.client, 300) ### retrieve client
  email
          if client and client!=request.client:  ### if no match,
  forcelogout
               session.flash=sorry, somebody else is currently logged
  in as you
               redirect(URL(r=request))
      return dict(form=t2.login())

  On Feb 13, 11:47 am, mdipierro mdipie...@cs.depaul.edu wrote:

   I guess I need to try this myself before sending it. Sorry I have 
   not
   done so. I will test it, debug it and get back to you.

   massimo

   On Feb 13, 11:27 am, drayco antrod...@gmail.com wrote:

Sorry, I tested it again and the problem is the same.

Please, Do you have other suggestion?

On 13 feb, 07:58, mdipierro mdipie...@cs.depaul.edu wrote:

 My Bad. Please try this. replace the login() function

 def login(): return dict(form=t2.login())

 with

 if t2.logged_in:
     cache.ram('client:%s' % t2.person_id, 
 lambda:request.client, 0)
 ### store client ip in cache

 def login():
     if request.vars.email:
         client=cache.ram('client:%s' % request.vars.email,
 lambda:request.client, 300) ### retrieve client email
         if client and client!=request.client:  ### if no 
 match, force
 logout
              session.flash=sorry, somebody else is currently 
 logged
 in as you
              redirect(URL(r=request))
     return dict(form=t2.login())

 On Feb 13, 1:26 am, drayco antrod...@gmail.com wrote:

  Yes, I tested with two diferrent and two diferrent IP 
  addresses.

  I use share hosting with apache and wsgi in webfaction.

  On 12 feb, 23:05, mdipierro mdipie...@cs.depaul.edu wrote:

   Did you test logging from two different machines? 
   Different IP
   addresses?

   Massimo

   On Feb 12, 8:15 pm, drayco antrod...@gmail.com wrote:

I tested it and the problem is the same.

Do you have other suggestion?

On 12 feb, 15:37, drayco antrod...@gmail.com wrote:

 Thanks in advanced. I will try to fix that this 
 afternoon.

 On 12 feb, 14:33, mdipierro mdipie...@cs.depaul.edu 
 wrote:

  Yes you can but this is not one line change. 
  Assuming you have a
  single server (not mutliple servers behind a NAT), 
  the easy way is to
  replace the register function in 
  controllers/default.py with the
  following code:

  if t2.logged_in: cache.ram('client:%s' % 
  t2.person_id, lambda:
  request.client, 0)    ### store client ip in cache

  def register():
      form=t2.register
  (verification=settings.email_verification,sender=settings.email_sender)
      if t2.logged_in:
          client=cache.ram('client:%s' % 
  t2.person_id, lambda:
  request.client, 300

[web2py:16349] Re: question about t3 session

2009-02-15 Thread drayco

I use a share hosting with wgsi and apache2 in webfaction.

Ok, I will try to do the test.

Thank's for your help.

On Feb 15, 8:46 am, mdipierro mdipie...@cs.depaul.edu wrote:
 That should have worked. Can you tell me more about your setup? Are
 you using a proxy? wsgi? apache?

 can you print request.client when the two users login from different
 IP using the same password within 5 minutes?

 Massimo

 On Feb 13, 6:44 pm, drayco antrod...@gmail.com wrote:

  Hi mdipierro, Thank's for your help.

  However, the problem is the same.

  Please, do you have other idea?

  On 13 feb, 12:34, mdipierro mdipie...@cs.depaul.edu wrote:

   Please one more try replace:

   def login(): return dict(form=t2.login())

   with

   if t2.logged_in:
       cache.ram('client:%s' % t2.person_email, lambda:request.client,
   -1)

   def login():
       if request.vars.email:
           client=cache.ram('client:%s' %
   request.vars.email,lambda:request.client, 300) ### retrieve client
   email
           if client and client!=request.client:  ### if no match,
   forcelogout
                session.flash=sorry, somebody else is currently logged
   in as you
                redirect(URL(r=request))
       return dict(form=t2.login())

   On Feb 13, 11:47 am, mdipierro mdipie...@cs.depaul.edu wrote:

I guess I need to try this myself before sending it. Sorry I have not
done so. I will test it, debug it and get back to you.

massimo

On Feb 13, 11:27 am, drayco antrod...@gmail.com wrote:

 Sorry, I tested it again and the problem is the same.

 Please, Do you have other suggestion?

 On 13 feb, 07:58, mdipierro mdipie...@cs.depaul.edu wrote:

  My Bad. Please try this. replace the login() function

  def login(): return dict(form=t2.login())

  with

  if t2.logged_in:
      cache.ram('client:%s' % t2.person_id, lambda:request.client, 0)
  ### store client ip in cache

  def login():
      if request.vars.email:
          client=cache.ram('client:%s' % request.vars.email,
  lambda:request.client, 300) ### retrieve client email
          if client and client!=request.client:  ### if no match, 
  force
  logout
               session.flash=sorry, somebody else is currently logged
  in as you
               redirect(URL(r=request))
      return dict(form=t2.login())

  On Feb 13, 1:26 am, drayco antrod...@gmail.com wrote:

   Yes, I tested with two diferrent and two diferrent IP addresses.

   I use share hosting with apache and wsgi in webfaction.

   On 12 feb, 23:05, mdipierro mdipie...@cs.depaul.edu wrote:

Did you test logging from two different machines? Different IP
addresses?

Massimo

On Feb 12, 8:15 pm, drayco antrod...@gmail.com wrote:

 I tested it and the problem is the same.

 Do you have other suggestion?

 On 12 feb, 15:37, drayco antrod...@gmail.com wrote:

  Thanks in advanced. I will try to fix that this afternoon.

  On 12 feb, 14:33, mdipierro mdipie...@cs.depaul.edu wrote:

   Yes you can but this is not one line change. Assuming you 
   have a
   single server (not mutliple servers behind a NAT), the 
   easy way is to
   replace the register function in controllers/default.py 
   with the
   following code:

   if t2.logged_in: cache.ram('client:%s' % t2.person_id, 
   lambda:
   request.client, 0)    ### store client ip in cache

   def register():
       form=t2.register
   (verification=settings.email_verification,sender=settings.email_sender)
       if t2.logged_in:
           client=cache.ram('client:%s' % t2.person_id, 
   lambda:
   request.client, 300) ### retrieve client ip
           if client and client!=request.client:  ### if no 
   match, force
   logout
                t2.messages.logged_out=sorry, somebody else 
   is currently
   logged in as you
                t2.logout(next='login')
       return dict(form=form)

   On Feb 12, 2:00 pm, drayco antrod...@gmail.com wrote:

I have many users with diferrents kinds of rights and 
they gave their
passwords and user name to others people. The system 
allow to the
people enter to the application with the same user at 
the same time.

I now that because the people told me that they worked 
with the same
user, in the same time and in the same place but with 
diferrents
machines and in this moment i have a lot of problems 
with that.

And i don't want that this happend.

What can i do?

On Feb 12, 1:29 pm, mdipierro mdipie...@cs.depaul.edu 
wrote:

 I do

[web2py:16304] Re: question about t3 session

2009-02-13 Thread drayco

Sorry, I tested it again and the problem is the same.

Please, Do you have other suggestion?

On 13 feb, 07:58, mdipierro mdipie...@cs.depaul.edu wrote:
 My Bad. Please try this. replace the login() function

 def login(): return dict(form=t2.login())

 with

 if t2.logged_in:
     cache.ram('client:%s' % t2.person_id, lambda:request.client, 0)
 ### store client ip in cache

 def login():
     if request.vars.email:
         client=cache.ram('client:%s' % request.vars.email,
 lambda:request.client, 300) ### retrieve client email
         if client and client!=request.client:  ### if no match, force
 logout
              session.flash=sorry, somebody else is currently logged
 in as you
              redirect(URL(r=request))
     return dict(form=t2.login())

 On Feb 13, 1:26 am, drayco antrod...@gmail.com wrote:

  Yes, I tested with two diferrent and two diferrent IP addresses.

  I use share hosting with apache and wsgi in webfaction.

  On 12 feb, 23:05, mdipierro mdipie...@cs.depaul.edu wrote:

   Did you test logging from two different machines? Different IP
   addresses?

   Massimo

   On Feb 12, 8:15 pm, drayco antrod...@gmail.com wrote:

I tested it and the problem is the same.

Do you have other suggestion?

On 12 feb, 15:37, drayco antrod...@gmail.com wrote:

 Thanks in advanced. I will try to fix that this afternoon.

 On 12 feb, 14:33, mdipierro mdipie...@cs.depaul.edu wrote:

  Yes you can but this is not one line change. Assuming you have a
  single server (not mutliple servers behind a NAT), the easy way is 
  to
  replace the register function in controllers/default.py with the
  following code:

  if t2.logged_in: cache.ram('client:%s' % t2.person_id, lambda:
  request.client, 0)    ### store client ip in cache

  def register():
      form=t2.register
  (verification=settings.email_verification,sender=settings.email_sender)
      if t2.logged_in:
          client=cache.ram('client:%s' % t2.person_id, lambda:
  request.client, 300) ### retrieve client ip
          if client and client!=request.client:  ### if no match, 
  force
  logout
               t2.messages.logged_out=sorry, somebody else is 
  currently
  logged in as you
               t2.logout(next='login')
      return dict(form=form)

  On Feb 12, 2:00 pm, drayco antrod...@gmail.com wrote:

   I have many users with diferrents kinds of rights and they gave 
   their
   passwords and user name to others people. The system allow to the
   people enter to the application with the same user at the same 
   time.

   I now that because the people told me that they worked with the 
   same
   user, in the same time and in the same place but with diferrents
   machines and in this moment i have a lot of problems with that.

   And i don't want that this happend.

   What can i do?

   On Feb 12, 1:29 pm, mdipierro mdipie...@cs.depaul.edu wrote:

I do not understand. Can you make an example?

On Feb 12, 12:52 pm, drayco antrod...@gmail.com wrote:

 is it possible that int3Version 0.4 (2009-01-07 09:01:19) and 
 web2py
 1.55.2 diferent person with the same user can logg in?

 And, if it is possible, how can i fix that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16321] Re: question about t3 session

2009-02-13 Thread drayco

Hi mdipierro, Thank's for your help.

However, the problem is the same.

Please, do you have other idea?

On 13 feb, 12:34, mdipierro mdipie...@cs.depaul.edu wrote:
 Please one more try replace:

 def login(): return dict(form=t2.login())

 with

 if t2.logged_in:
     cache.ram('client:%s' % t2.person_email, lambda:request.client,
 -1)

 def login():
     if request.vars.email:
         client=cache.ram('client:%s' %
 request.vars.email,lambda:request.client, 300) ### retrieve client
 email
         if client and client!=request.client:  ### if no match,
 forcelogout
              session.flash=sorry, somebody else is currently logged
 in as you
              redirect(URL(r=request))
     return dict(form=t2.login())

 On Feb 13, 11:47 am, mdipierro mdipie...@cs.depaul.edu wrote:

  I guess I need to try this myself before sending it. Sorry I have not
  done so. I will test it, debug it and get back to you.

  massimo

  On Feb 13, 11:27 am, drayco antrod...@gmail.com wrote:

   Sorry, I tested it again and the problem is the same.

   Please, Do you have other suggestion?

   On 13 feb, 07:58, mdipierro mdipie...@cs.depaul.edu wrote:

My Bad. Please try this. replace the login() function

def login(): return dict(form=t2.login())

with

if t2.logged_in:
    cache.ram('client:%s' % t2.person_id, lambda:request.client, 0)
### store client ip in cache

def login():
    if request.vars.email:
        client=cache.ram('client:%s' % request.vars.email,
lambda:request.client, 300) ### retrieve client email
        if client and client!=request.client:  ### if no match, force
logout
             session.flash=sorry, somebody else is currently logged
in as you
             redirect(URL(r=request))
    return dict(form=t2.login())

On Feb 13, 1:26 am, drayco antrod...@gmail.com wrote:

 Yes, I tested with two diferrent and two diferrent IP addresses.

 I use share hosting with apache and wsgi in webfaction.

 On 12 feb, 23:05, mdipierro mdipie...@cs.depaul.edu wrote:

  Did you test logging from two different machines? Different IP
  addresses?

  Massimo

  On Feb 12, 8:15 pm, drayco antrod...@gmail.com wrote:

   I tested it and the problem is the same.

   Do you have other suggestion?

   On 12 feb, 15:37, drayco antrod...@gmail.com wrote:

Thanks in advanced. I will try to fix that this afternoon.

On 12 feb, 14:33, mdipierro mdipie...@cs.depaul.edu wrote:

 Yes you can but this is not one line change. Assuming you 
 have a
 single server (not mutliple servers behind a NAT), the easy 
 way is to
 replace the register function in controllers/default.py with 
 the
 following code:

 if t2.logged_in: cache.ram('client:%s' % t2.person_id, lambda:
 request.client, 0)    ### store client ip in cache

 def register():
     form=t2.register
 (verification=settings.email_verification,sender=settings.email_sender)
     if t2.logged_in:
         client=cache.ram('client:%s' % t2.person_id, lambda:
 request.client, 300) ### retrieve client ip
         if client and client!=request.client:  ### if no 
 match, force
 logout
              t2.messages.logged_out=sorry, somebody else is 
 currently
 logged in as you
              t2.logout(next='login')
     return dict(form=form)

 On Feb 12, 2:00 pm, drayco antrod...@gmail.com wrote:

  I have many users with diferrents kinds of rights and they 
  gave their
  passwords and user name to others people. The system allow 
  to the
  people enter to the application with the same user at the 
  same time.

  I now that because the people told me that they worked with 
  the same
  user, in the same time and in the same place but with 
  diferrents
  machines and in this moment i have a lot of problems with 
  that.

  And i don't want that this happend.

  What can i do?

  On Feb 12, 1:29 pm, mdipierro mdipie...@cs.depaul.edu 
  wrote:

   I do not understand. Can you make an example?

   On Feb 12, 12:52 pm, drayco antrod...@gmail.com wrote:

is it possible that int3Version 0.4 (2009-01-07 
09:01:19) and web2py
1.55.2 diferent person with the same user can logg in?

And, if it is possible, how can i fix that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group

[web2py:16236] Re: t3 itemize and firefox

2009-02-12 Thread drayco

Yes, I see that effect in t3 and firefox.

But, if you delete all the content and paste again in a new page, the
problem disapper.

On Feb 11, 3:59 pm, Wes James compte...@gmail.com wrote:
 Anyone else see the itemize list appearing in the middle of the
 browser witht3on firefox?

 -wj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16238] t3 backup/restore

2009-02-12 Thread drayco

Hi, I using t3 Version 0.4 (2009-01-07 09:01:19) and web2py 1.55.2 in
a website in production enviroment.

In this moment we have 750 users and more of 10,000 registers of
diferent kind data and i am using sqlite. The web site is
http://www.seccion36.org.mx.

The problem is the following: when i use backup/restore in the
website, i can generete a backup but when i try to restore in a local
site i can't do it.

I have the same problem with the new version of t3 and web2py.

can you give me an advice?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16241] question about t3 session

2009-02-12 Thread drayco

is it possible that in t3 Version 0.4 (2009-01-07 09:01:19) and web2py
1.55.2 diferent person with the same user can logg in?

And, if it is possible, how can i fix that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16246] Re: t3 backup/restore

2009-02-12 Thread drayco

Ok, i wait the new version.

Thank's in advanced.

On Feb 12, 1:25 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 there was a bug in backup/restore that is now fixed in trunk.
 Can you want next Tuesday I post the next version?

 Massimo

 On Feb 12, 12:31 pm, drayco antrod...@gmail.com wrote:

  Hi, I using t3 Version 0.4 (2009-01-07 09:01:19) and web2py 1.55.2 in
  a website in production enviroment.

  In this moment we have 750 users and more of 10,000 registers of
  diferent kind data and i am using sqlite. The web site 
  ishttp://www.seccion36.org.mx.

  The problem is the following: when i use backup/restore in the
  website, i can generete a backup but when i try to restore in a local
  site i can't do it.

  I have the same problem with the new version of t3 and web2py.

  can you give me an advice?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16247] Re: question about t3 session

2009-02-12 Thread drayco

I have many users with diferrents kinds of rights and they gave their
passwords and user name to others people. The system allow to the
people enter to the application with the same user at the same time.

I now that because the people told me that they worked with the same
user, in the same time and in the same place but with diferrents
machines and in this moment i have a lot of problems with that.

And i don't want that this happend.

What can i do?

On Feb 12, 1:29 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I do not understand. Can you make an example?

 On Feb 12, 12:52 pm, drayco antrod...@gmail.com wrote:

  is it possible that int3Version 0.4 (2009-01-07 09:01:19) and web2py
  1.55.2 diferent person with the same user can logg in?

  And, if it is possible, how can i fix that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16249] Re: question about t3 session

2009-02-12 Thread drayco

Thanks in advanced. I will try to fix that this afternoon.

On 12 feb, 14:33, mdipierro mdipie...@cs.depaul.edu wrote:
 Yes you can but this is not one line change. Assuming you have a
 single server (not mutliple servers behind a NAT), the easy way is to
 replace the register function in controllers/default.py with the
 following code:

 if t2.logged_in: cache.ram('client:%s' % t2.person_id, lambda:
 request.client, 0)    ### store client ip in cache

 def register():
     form=t2.register
 (verification=settings.email_verification,sender=settings.email_sender)
     if t2.logged_in:
         client=cache.ram('client:%s' % t2.person_id, lambda:
 request.client, 300) ### retrieve client ip
         if client and client!=request.client:  ### if no match, force
 logout
              t2.messages.logged_out=sorry, somebody else is currently
 logged in as you
              t2.logout(next='login')
     return dict(form=form)

 On Feb 12, 2:00 pm, drayco antrod...@gmail.com wrote:

  I have many users with diferrents kinds of rights and they gave their
  passwords and user name to others people. The system allow to the
  people enter to the application with the same user at the same time.

  I now that because the people told me that they worked with the same
  user, in the same time and in the same place but with diferrents
  machines and in this moment i have a lot of problems with that.

  And i don't want that this happend.

  What can i do?

  On Feb 12, 1:29 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I do not understand. Can you make an example?

   On Feb 12, 12:52 pm, drayco antrod...@gmail.com wrote:

is it possible that int3Version 0.4 (2009-01-07 09:01:19) and web2py
1.55.2 diferent person with the same user can logg in?

And, if it is possible, how can i fix that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16257] Re: t3 itemize and firefox

2009-02-12 Thread drayco

hum, did you used select all?

I fixed this problem with a single copy of text and code.

In the new page you need to paste this.

In the other hand, I fixed with select all, copy all in a text
editor, delete all in a wiki/page and paste all in a the same or
new wiki/page.

This tricks works with t3 Version 0.4 (2009-01-07 09:01:19) and web2py
1.55.2

On 12 feb, 17:42, Wes James compte...@gmail.com wrote:
 This trick works until a log out.  If I log back in it goes back to
 where it should be - go figure

 -wj

 On Thu, Feb 12, 2009 at 11:16 AM, drayco antrod...@gmail.com wrote:

  Yes, I see that effect in t3 and firefox.

  But, if you delete all the content and paste again in a new page, the
  problem disapper.

  On Feb 11, 3:59 pm, Wes James compte...@gmail.com wrote:
  Anyone else see the itemize list appearing in the middle of the
  browser witht3on firefox?

  -wj
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:16266] Re: question about t3 session

2009-02-12 Thread drayco

Yes, I tested with two diferrent and two diferrent IP addresses.

I use share hosting with apache and wsgi in webfaction.

On 12 feb, 23:05, mdipierro mdipie...@cs.depaul.edu wrote:
 Did you test logging from two different machines? Different IP
 addresses?

 Massimo

 On Feb 12, 8:15 pm, drayco antrod...@gmail.com wrote:

  I tested it and the problem is the same.

  Do you have other suggestion?

  On 12 feb, 15:37, drayco antrod...@gmail.com wrote:

   Thanks in advanced. I will try to fix that this afternoon.

   On 12 feb, 14:33, mdipierro mdipie...@cs.depaul.edu wrote:

Yes you can but this is not one line change. Assuming you have a
single server (not mutliple servers behind a NAT), the easy way is to
replace the register function in controllers/default.py with the
following code:

if t2.logged_in: cache.ram('client:%s' % t2.person_id, lambda:
request.client, 0)    ### store client ip in cache

def register():
    form=t2.register
(verification=settings.email_verification,sender=settings.email_sender)
    if t2.logged_in:
        client=cache.ram('client:%s' % t2.person_id, lambda:
request.client, 300) ### retrieve client ip
        if client and client!=request.client:  ### if no match, force
logout
             t2.messages.logged_out=sorry, somebody else is currently
logged in as you
             t2.logout(next='login')
    return dict(form=form)

On Feb 12, 2:00 pm, drayco antrod...@gmail.com wrote:

 I have many users with diferrents kinds of rights and they gave their
 passwords and user name to others people. The system allow to the
 people enter to the application with the same user at the same time.

 I now that because the people told me that they worked with the same
 user, in the same time and in the same place but with diferrents
 machines and in this moment i have a lot of problems with that.

 And i don't want that this happend.

 What can i do?

 On Feb 12, 1:29 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I do not understand. Can you make an example?

  On Feb 12, 12:52 pm, drayco antrod...@gmail.com wrote:

   is it possible that int3Version 0.4 (2009-01-07 09:01:19) and 
   web2py
   1.55.2 diferent person with the same user can logg in?

   And, if it is possible, how can i fix that?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14796] Re: example about group memberships and group based access control in t3

2009-01-09 Thread drayco

Yes, maybe, I am a newbie in web app.

My suggestion is because in this moment i have a web app that uses t3.

This app has groups and each Group have diferent reports. But, if a
coordinator want to see reports of organizator, they can't because
they don't have access, and I show the message for them. In this
moment the web app goes well.

I use private procedures, menu-false and public-false for some wiki/
pages (massimo thank's for help), etc.

However, I think is more easy, if I can control the menu with some
code in t3.

But in this moment, I believe, I need to use only web2py or t2.

Thank's in advance for your attention. I belive that your work is
great.

On 8 ene, 15:30, mdipierro mdipie...@cs.depaul.edu wrote:
 I think this mixing apples with oranges.

 procedures should not be exposed in menus because they do not have a
 view. They are not intended to return pages.

 Currently there is no mechinsm to enforce access control to the menu
 items, only to the content of those pages.

 I will think about this it may not be too difficult to add this
 mechanism.

 Massimo

 On Jan 8, 3:07 pm, drayco antrod...@gmail.com wrote:

  Sorry, i want to say

  And in this answer, I would want to suggest something extensions for
  view helpers - menu

  On Jan 8, 2:33 pm, drayco antrod...@gmail.com wrote:

   Hi, thanks. I understand.

   However, I think, i don't explain my idea well.

   I would want to display or not some pages in menu with code. I
   thought, I should do this with this code o something like that

   {{=self.menu(menu)}}

   {{=t2.menu(response.menu)}}

   After, I thought, I should do this more easy with Membership
   Controls and Access Controls but I belive that is only for control
   access to records.

   And in this answer, I would want to suggest something pattern for menu
   control

   My apologies, if this is a bad idea.

   On Jan 7, 8:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:

You cannot use access control for menu items inT3.
If a page has menu checked and public check is always appears in
menus.
If a page has menu checked and public uncheck it will appear in
menus only to authenticated users
If a page has menu unchecked then it never appears in menus.

You can find example of access control for other functionalities 
inhttp://mdp.cti.depaul.edu/examples/static/t2.pdf

Massimo

On Jan 7, 7:54 pm, drayco antrod...@gmail.com wrote:

 Hi, can you give a simple example about group memberships and group
 based access control int3?

 Or how can i show or not some menu/submenu int3?

 Can i do this whithout group memberships?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14754] Re: example about group memberships and group based access control in t3

2009-01-08 Thread drayco

Hi, thanks. I understand.

However, I think, i don't explain my idea well.

I would want to display or not some pages in menu with code. I
thought, I should do this with this code o something like that

{{=self.menu(menu)}}

{{=t2.menu(response.menu)}}

After, I thought, I should do this more easy with Membership
Controls and Access Controls but I belive that is only for control
access to records.

And in this answer, I would want to suggest something pattern for menu
control

My apologies, if this is a bad idea.

On Jan 7, 8:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 You cannot use access control for menu items inT3.
 If a page has menu checked and public check is always appears in
 menus.
 If a page has menu checked and public uncheck it will appear in
 menus only to authenticated users
 If a page has menu unchecked then it never appears in menus.

 You can find example of access control for other functionalities 
 inhttp://mdp.cti.depaul.edu/examples/static/t2.pdf

 Massimo

 On Jan 7, 7:54 pm, drayco antrod...@gmail.com wrote:

  Hi, can you give a simple example about group memberships and group
  based access control int3?

  Or how can i show or not some menu/submenu int3?

  Can i do this whithout group memberships?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14756] Re: example about group memberships and group based access control in t3

2009-01-08 Thread drayco

Sorry, i want to say

And in this answer, I would want to suggest something extensions for
view helpers - menu

On Jan 8, 2:33 pm, drayco antrod...@gmail.com wrote:
 Hi, thanks. I understand.

 However, I think, i don't explain my idea well.

 I would want to display or not some pages in menu with code. I
 thought, I should do this with this code o something like that

 {{=self.menu(menu)}}

 {{=t2.menu(response.menu)}}

 After, I thought, I should do this more easy with Membership
 Controls and Access Controls but I belive that is only for control
 access to records.

 And in this answer, I would want to suggest something pattern for menu
 control

 My apologies, if this is a bad idea.

 On Jan 7, 8:59 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  You cannot use access control for menu items inT3.
  If a page has menu checked and public check is always appears in
  menus.
  If a page has menu checked and public uncheck it will appear in
  menus only to authenticated users
  If a page has menu unchecked then it never appears in menus.

  You can find example of access control for other functionalities 
  inhttp://mdp.cti.depaul.edu/examples/static/t2.pdf

  Massimo

  On Jan 7, 7:54 pm, drayco antrod...@gmail.com wrote:

   Hi, can you give a simple example about group memberships and group
   based access control int3?

   Or how can i show or not some menu/submenu int3?

   Can i do this whithout group memberships?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14698] example about group memberships and group based access control in t3

2009-01-07 Thread drayco

Hi, can you give a simple example about group memberships and group
based access control in t3?

Or how can i show or not some menu/submenu in t3?

Can i do this whithout group memberships?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14583] Re: T3 IF and FOR doubt

2009-01-05 Thread drayco

Hi, please, can You give any examples?

On 25 dic 2008, 19:16, mdipierro mdipie...@cs.depaul.edu wrote:
 You cannot.T3does not support web2py templating language.

 On Dec 25, 6:10 pm, Tito Garrido titogarr...@gmail.com wrote:

  Hi Folks,

  Why when I try to use:
  {{ifself.is_admin:}}
  Test
  {{pass}}

  in a wiki page it returns:
  Internal Error 
  [openhttp://titogarrido.appspot.com/app/default/wiki/main#zoom-0
  ]

 ifself.is_admin:
                      ^
  SyntaxError: unexpected EOF while parsing

  Thanks,

  Tito

  --
  Linux User #387870
  .
   _/_õ|__|
  ..º[ .-.___.-._| . . . .
  .__( o)__( o).:___

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14596] Re: T3 IF and FOR doubt

2009-01-05 Thread drayco

Ok, I understand.

However in your example 1 on the web site of t3, you have this:

{{=TABLE(*[TR(IMG(_width=200px,_src=self.action
(download,image.file))) for image in db().select(db.image.ALL)])}}

My question is this:

Can i use something like that whith self.display()?

Because I want to display multiple table records

Or how can i use for or if with self.display()?

On 5 ene, 13:59, mdipierro mdipie...@cs.depaul.edu wrote:
 In T3 you can only do {{something}} or {{=somethingelse}} not
 {{for...:}} not {{if...:}} not {{pass}}. etc. You cannot break an
 expression over multiple {{}}{{}} as you can in the web2py template
 language.

 Massimo

 On Jan 5, 1:18 pm, drayco antrod...@gmail.com wrote:

  Hi, please, can You give any examples?

  On 25 dic 2008, 19:16, mdipierro mdipie...@cs.depaul.edu wrote:

   You cannot.T3does not support web2py templating language.

   On Dec 25, 6:10 pm, Tito Garrido titogarr...@gmail.com wrote:

Hi Folks,

Why when I try to use:
{{ifself.is_admin:}}
Test
{{pass}}

in a wiki page it returns:
Internal Error 
[openhttp://titogarrido.appspot.com/app/default/wiki/main#zoom-0
]

   ifself.is_admin:
                    ^
SyntaxError: unexpected EOF while parsing

Thanks,

Tito

--
Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14597] Re: How can I use in t3 private procedures?

2009-01-05 Thread drayco

Thank's in advance.

On 5 ene, 14:11, mdipierro mdipie...@cs.depaul.edu wrote:
 This is not a stupid question. But the answer depends on the details.
 So I am going to provide multiple answers.

 First of all next=... must be the name of an action, not a complete
 URL as returned by t2.action.
 Second you should try avoid ../../ because URLs containing those are
 rejected by web2py. web2py interprets .. as an attempt of directpry
 traversal attack.

 1) say you have a page wiki/one that contains

 {{=self.create(db.beneficiarios,next='wiki/two')}}

 this means that after creating a beneficiario, you want to redirect to
 page wiki/two
 if this is what you want to do you must create the wiki page
 two (menu false if this is only reachable by this redirection) and
 in the page call {{programfetcha()}}. This page does not need to
 display anything since it only performs a redirection. the function
 prografetcha does not need any decorator since it is inly exposed via
 the wiki page. I call it a wiki page but in reality wiki/two is just a
 user defined action.

 2) You can avoid using wiki/two by exposing programfetcha directly. In
 this case you need the decorator @expose and the wiki/one should say

 {{=self.create(db.beneficiarios,next='run/programfetcha')}}

 Massimo

 On Jan 5, 1:29 pm, drayco antrod...@gmail.com wrote:

  Hi, I try to use t3 and I need to @expose procedure if i want to use
  it in a wiki page in a self.create() method.

  This is my procedure that i need to use

  @expose
  def programafecha():
      beneficiarios=db(db.beneficiarios.person_id==self.person_id).select
  ()
      trabajadores=db(db.trabajadores.person_id==self.person_id).select
  ()
      coordinadores=db(db.coordinadores.id==trabajadores
  [0].coordinador).select()
      fechasValidas=db((db.fechas.regional==coordinadores[0].regional)
  (db.fechas.full24)).select()
      for beneficiario in beneficiarios:
          if beneficiario.fecha_Tramite==0:
              db(db.beneficiarios.id==beneficiario.id).update
  (fecha_Tramite=fechasValidas[0].id)
              db(db.fechas.id==fechasValidas[0].id).update(full=
  (fechasValidas[0].full+1))

      self.redirect('wiki/inftrabajador')

  In a wiki page i do this

  {{=self.create(db.beneficiarios,next=self.action('../../../run/
  programafecha'))}}

  How can I use in t3 private procedure in a wiki page whitout @expose?

  I am so sorry, if this is a stupid question.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:14602] Re: T3 IF and FOR doubt

2009-01-05 Thread drayco

Thank's a lot.

On 5 ene, 21:04, mdipierro mdipie...@cs.depaul.edu wrote:
 yes, here is another example

 {{=DIV(*[DIV(db.display(db.dog,query=db.dig.id==id)) for id in
 [1,2,3]])}}

 Massimo

 On Jan 5, 7:46 pm, drayco antrod...@gmail.com wrote:

  Ok, I understand.

  However in your example 1 on the web site of t3, you have this:

  {{=TABLE(*[TR(IMG(_width=200px,_src=self.action
  (download,image.file))) for image in db().select(db.image.ALL)])}}

  My question is this:

  Can i use something like that whith self.display()?

  Because I want to display multiple table records

  Or how can i use for or if with self.display()?

  On 5 ene, 13:59, mdipierro mdipie...@cs.depaul.edu wrote:

   In T3 you can only do {{something}} or {{=somethingelse}} not
   {{for...:}} not {{if...:}} not {{pass}}. etc. You cannot break an
   expression over multiple {{}}{{}} as you can in the web2py template
   language.

   Massimo

   On Jan 5, 1:18 pm, drayco antrod...@gmail.com wrote:

Hi, please, can You give any examples?

On 25 dic 2008, 19:16, mdipierro mdipie...@cs.depaul.edu wrote:

 You cannot.T3does not support web2py templating language.

 On Dec 25, 6:10 pm, Tito Garrido titogarr...@gmail.com wrote:

  Hi Folks,

  Why when I try to use:
  {{ifself.is_admin:}}
  Test
  {{pass}}

  in a wiki page it returns:
  Internal Error 
  [openhttp://titogarrido.appspot.com/app/default/wiki/main#zoom-0
  ]

 ifself.is_admin:
                      ^
  SyntaxError: unexpected EOF while parsing

  Thanks,

  Tito

  --
  Linux User #387870
  .
   _/_õ|__|
  ..º[ .-.___.-._| . . . .
  .__( o)__( o).:___
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py Web Framework group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---