the problem is that you then try to access the field as
db.cdr.call-limit
you hit a python limit: that string is "rendered" as db.cdr.call 'minus'
limit.
So in web2py table names and field names containing dashes (or any other
operator) is forbidden.
On Wednesday, October 31, 2012 1:21:53 PM UTC+1, Emilius Omeen wrote:
>
> Hello
> thanks Massimo for web2py
>
> models/db.py
> db.define_table('cdr', Field('call-limit', 'integer', notnull=True,
> default='3'))
>
> Error
> <type 'exceptions.SyntaxError'> invalid table or field name: call-limit
> raise SyntaxError, 'invalid table or field name: %s' % text
> SyntaxError: invalid table or field name: call-limit
>
> 9.
> 10.
> 11.
>
> Traceback (most recent call last):
> File "/home/www-data/web2py/gluon/restricted.py", line 212, in restricted
> exec ccode in environment
> File "/home/www-data/web2py/applications/sip_users/models/db.py"
> <https://10.100.100.104/admin/default/edit/sip_users/models/db.py>, line 45,
> in <module>
> Field('call-limit', 'integer', notnull=True, default='3'),#deprecated
> File "/home/www-data/web2py/gluon/dal.py", line 8431, in __init__
> self.name = fieldname = cleanup(fieldname)
> File "/home/www-data/web2py/gluon/dal.py", line 4831, in cleanup
> raise SyntaxError, 'invalid table or field name: %s' % text
> SyntaxError: invalid table or field name: call-limit
>
>
>
> I see that if use in Field name any string with included simbol "-" minus.
> May be I do something wrong ?
> Or web2py have another way to avoid this error ?
>
> Thak you.
>
>
--