[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-02-01 Thread Fran
I too have just been bitten by this.
From r2950 to current trunk, all fieldnames in queries have been .lower()d
This breaks my code which uses the real fieldnames - things like maxExtent  
maxResolution.
This code all worked fine before on MySQL, PotsgreSQL  sqlite.

In the spirit of not breaking backward compatibility, the not lower()ing 
should be the default.
If some cases want this lower()ing then they should be the ones who add an 
extra flag to get that behaviour, surely?

F


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

2011-02-01 Thread Massimo Di Pierro
The change in trunk is supposed to only affect internals. If it breaks
you code than is is a bug. Please provide an example of code that
breaks and I will fix trunk.

Massimo

On Feb 1, 2:22 pm, Fran francisb...@gmail.com wrote:
 I too have just been bitten by this.
 From r2950 to current trunk, all fieldnames in queries have been .lower()d
 This breaks my code which uses the real fieldnames - things like maxExtent 
 maxResolution.
 This code all worked fine before on MySQL, PotsgreSQL  sqlite.

 In the spirit of not breaking backward compatibility, the not lower()ing
 should be the default.
 If some cases want this lower()ing then they should be the ones who add an
 extra flag to get that behaviour, surely?

 F


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

2011-02-01 Thread Fran
Cool, thanks :)

This function:
http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/modules/s3/s3gis.py#L381

maxResolution  maxExtent don't get copied into output as
maxresolution  maxextent are in the Rows...

The relevant model:
http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/models/03_gis.py#L88

F


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

2011-02-01 Thread Fran
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-31 Thread DenesL
Hola Drayco,

aun no entiendo como funciona la aplicacion, el codigo que soporta
bases de datos pre-existentes para mysql simplemente no existe en el
archivo sql.py en la version 1.83.2, ni en dal.py en trunk.

Deben existir las definiciones para mysql de 'reference FK' (llave
foranea) y 'reference TFK' (llave tabla foranea) como se observa por
ejemplo en las definiciones para MS-SQL, among other things.

In English:
---
I still don't understand how the app can work, the code that supports
legacy DBs for mysql is simply not there in the sql.py file on version
1.83.2, and neither in trunk's dal.py.

'reference FK' (foreign key) and 'reference TFK' (table foreign key)
must be defined for mysql, similar to those defined for MS-SQL for
example, among other things.

Denes.

On Jan 31, 9:13 pm, drayco antrod...@gmail.com wrote:
 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/789387057d...

 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 

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

2011-01-31 Thread DenesL
Si el problema es con sequence_name entonces no tengo idea, jamas lo
he usado.

If the problem is with sequence_name then I don't know, I have never
used it.


On Jan 31, 10:47 pm, DenesL denes1...@yahoo.ca wrote:
 Hola Drayco,

 aun no entiendo como funciona la aplicacion, el codigo que soporta
 bases de datos pre-existentes para mysql simplemente no existe en el
 archivo sql.py en la version 1.83.2, ni en dal.py en trunk.

 Deben existir las definiciones para mysql de 'reference FK' (llave
 foranea) y 'reference TFK' (llave tabla foranea) como se observa por
 ejemplo en las definiciones para MS-SQL, among other things.

 In English:
 ---
 I still don't understand how the app can work, the code that supports
 legacy DBs for mysql is simply not there in the sql.py file on version
 1.83.2, and neither in trunk's dal.py.

 'reference FK' (foreign key) and 'reference TFK' (table foreign key)
 must be defined for mysql, similar to those defined for MS-SQL for
 example, among other things.

 Denes.

 On Jan 31, 9:13 pm, drayco antrod...@gmail.com wrote:

  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/789387057d...

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

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

2011-01-28 Thread Massimo Di Pierro
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 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, 

[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-28 Thread DenesL

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

[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: 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, 

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

2011-01-08 Thread Thadeus Burgess
 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, 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 

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

2011-01-08 Thread Massimo Di Pierro
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, 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
 

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

2011-01-07 Thread mart
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 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 new dal in trunk?

2011-01-07 Thread mart
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, 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?


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

2011-01-07 Thread Thadeus Burgess
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, 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 new dal in trunk?

2011-01-07 Thread mart
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, 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?