After upgrading(git pull), I got a new error.
NameError: global name 'ObjectId' is not defined
Traceback (most recent call last):
File "/home/eltonplima/workspace/web2py/gluon/restricted.py", line 205, in
restricted
exec ccode in environment
File
"/home/eltonplima/workspace/web2py/applications/sqm/controllers/appadmin.py"
<http://127.0.0.1:8001/admin/default/edit/sqm/controllers/appadmin.py>, line
433, in <module>
File "/home/eltonplima/workspace/web2py/gluon/globals.py", line 182, in
<lambda>
self._caller = lambda f: f()
File
"/home/eltonplima/workspace/web2py/applications/sqm/controllers/appadmin.py"
<http://127.0.0.1:8001/admin/default/edit/sqm/controllers/appadmin.py>, line
127, in insert
form = SQLFORM(db[table], ignore_rw=ignore_rw)
File "/home/eltonplima/workspace/web2py/gluon/sqlhtml.py", line 920, in
__init__
inp = self.widgets.options.widget(field, default)
File "/home/eltonplima/workspace/web2py/gluon/sqlhtml.py", line 224, in widget
options = requires[0].options()
File "/home/eltonplima/workspace/web2py/gluon/validators.py", line 479, in
options
self.build_set()
File "/home/eltonplima/workspace/web2py/gluon/validators.py", line 466, in
build_set
records = self.dbset(table).select(*fields, **dd)
File "/home/eltonplima/workspace/web2py/gluon/dal.py", line 8420, in select
return adapter.select(self.query,fields,attributes)
File "/home/eltonplima/workspace/web2py/gluon/dal.py", line 4877, in select
record[column],ObjectId):
NameError: global name 'ObjectId' is not defined
On Tuesday, August 7, 2012 11:33:50 AM UTC-3, Massimo Di Pierro wrote:
>
> This helps. I think I just fixed it in trunk. Can you check and confirm if
> it is fixed?
>
> On Tuesday, 7 August 2012 04:35:33 UTC-5, Elton Pereira de Lima wrote:
>>
>> Same error.
>>
>> One detail I forgot to mention, this only happens when I use mongodb.
>>
>> Follows the traceback:
>>
>> Traceback (most recent call last):
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/restricted.py",
>> line 205, in restricted
>> exec ccode in environment
>> File
>> "/home/eltonplima/workspace/web2py/2.0/web2py/applications/sqm/controllers/appadmin.py"
>> <http://127.0.0.1:8000/admin/default/edit/sqm/controllers/appadmin.py>,
>> line 432, in <module>
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/globals.py", line
>> 182, in <lambda>
>> self._caller = lambda f: f()
>> File
>> "/home/eltonplima/workspace/web2py/2.0/web2py/applications/sqm/controllers/appadmin.py"
>> <http://127.0.0.1:8000/admin/default/edit/sqm/controllers/appadmin.py>,
>> line 126, in insert
>> form = SQLFORM(db[table], ignore_rw=ignore_rw)
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/sqlhtml.py", line
>> 920, in __init__
>> inp = self.widgets.options.widget(field, default)
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/sqlhtml.py", line
>> 224, in widget
>> options = requires[0].options()
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/validators.py",
>> line 479, in options
>> self.build_set()
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/validators.py",
>> line 466, in build_set
>> records = self.dbset(table).select(*fields, **dd)
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/dal.py", line
>> 8416, in select
>> return adapter.select(self.query,fields,attributes)
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/dal.py", line
>> 4854, in select
>> self._select(query,fields,attributes)
>> File "/home/eltonplima/workspace/web2py/2.0/web2py/gluon/dal.py", line
>> 4802, in _select
>> raise SyntaxError, 'invalid select attribute: %s' % key
>> SyntaxError: invalid select attribute: distinct
>>
>>
>> On Tuesday, August 7, 2012 12:01:49 AM UTC-3, Cliff Kachinske wrote:
>>>
>>> I have created this problem by adding the unique argument to a table
>>> column after populating it with data. try removing it from the has_line
>>> field.
>>>
>>> On Monday, August 6, 2012 8:19:36 PM UTC-4, Elton Pereira de Lima wrote:
>>>>
>>>> I'm using the latest development version, and try to add a record by
>>>> the administrative interface the following exception is raised:
>>>> invalid <type'exceptions.SyntaxError'> select attribute: distinct
>>>>
>>>> The error happens when trying to insert in squid_log table.
>>>>
>>>> db.define_table('squid_internal_host',
>>>> Field('ip', 'text', notnull=True, unique=True),
>>>> Field('hostname', 'string', length=32, unique=True,),
>>>> format='%(ip)s',
>>>> migrate=True)
>>>>
>>>> db.define_table('squid_log',
>>>> Field('timestamp', 'datetime', notnull=True),
>>>> Field('internal_host', db.squid_internal_host),
>>>> Field('log_line', 'text', notnull=True),
>>>> Field('elapsed_time', 'integer', notnull=True),
>>>> Field('hash_line', 'string', notnull=True, length=64,
>>>> unique=True,),
>>>> Field('insert_timestamp', 'datetime',
>>>> default=lambda:datetime.datetime.now()),
>>>> format='%(hash_line)s')
>>>>
>>>> I'm doing something wrong?
>>>>
>>>
--