[web2py] Re: Mongodb - ImportError: cannot import name son

2012-06-12 Thread Michael Freitas
Thanks,  The latest trunk sorted out the import error. I also changed 

#import pymongo.objectid --> import bson.objectid

and replaced all references.  With my limited testing so far it seems to be 
working.  

If I try to register a new user with auth in mogodb I get the same error 
reported here: 
https://groups.google.com/d/topic/web2py/KQKqaKEpgu4/discussion


On Tuesday, June 12, 2012 9:25:35 AM UTC-4, Massimo Di Pierro wrote:
>
> Have a possible fix in trunk. Give it a try.
>
> On Monday, 11 June 2012 20:47:48 UTC-5, Michael Freitas wrote:
>>
>> I tried to setup a new application using the latest source code form 
>> trunk and mongodb.  I get the error pasted at the end when I try to 
>> register a new user in my app.  I tried changing the "from pymongo import 
>> son" to "from bson import son" in the dal.py with no luck.  I can import 
>> son from bson within the python shell.
>>  
>> I am running on mac osx lion (using macports python 2.6), pymonogo 2.2 
>> (macports), mongodb 2.0.6 (macports) and web2py (2, 0, 0, 
>> datetime.datetime(2012, 6, 9, 17, 47, 2), 'dev')
>>
>> Traceback (most recent call last):
>>   File "/Users/mfreitas/Downloads/web2py/gluon/restricted.py", line 205, in 
>> restricted
>> exec ccode in environment
>>   File 
>> "/Users/mfreitas/Downloads/web2py/applications/mongotest/controllers/default.py"
>>  
>> <http://127.0.0.1:8000/admin/default/edit/mongotest/controllers/default.py>, 
>> line 14, in 
>>   File "/Users/mfreitas/Downloads/web2py/gluon/globals.py", line 175, in 
>> 
>> self._caller = lambda f: f()
>>   File 
>> "/Users/mfreitas/Downloads/web2py/applications/mongotest/controllers/default.py"
>>  
>> <http://127.0.0.1:8000/admin/default/edit/mongotest/controllers/default.py>, 
>> line 3, in user
>> def user(): return dict(form=auth())
>>   File "/Users/mfreitas/Downloads/web2py/gluon/tools.py", line 1196, in 
>> __call__
>> return getattr(self,args[0])()
>>   File "/Users/mfreitas/Downloads/web2py/gluon/tools.py", line 2027, in 
>> register
>> onvalidation=onvalidation,hideerror=self.settings.hideerror):
>>   File "/Users/mfreitas/Downloads/web2py/gluon/sqlhtml.py", line 1130, in 
>> accepts
>> hideerror=hideerror,
>>   File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 1862, in 
>> accepts
>> status = self._traverse(status,hideerror)
>>   File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 790, in 
>> _traverse
>> newstatus = c._traverse(status,hideerror) and newstatus
>>   File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 790, in 
>> _traverse
>> newstatus = c._traverse(status,hideerror) and newstatus
>>   File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 790, in 
>> _traverse
>> newstatus = c._traverse(status,hideerror) and newstatus
>>   File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 790, in 
>> _traverse
>> newstatus = c._traverse(status,hideerror) and newstatus
>>   File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 797, in 
>> _traverse
>> newstatus = self._validate()
>>   File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 1620, in 
>> _validate
>> (value, errors) = validator(value)
>>   File "/Users/mfreitas/Downloads/web2py/gluon/validators.py", line 552, in 
>> __call__
>> rows = self.dbset(field == value, ignore_common_filters = 
>> self.ignore_common_filters).select(limitby=(0, 1))
>>   File "/Users/mfreitas/Downloads/web2py/gluon/dal.py", line 8147, in select
>> fields = adapter.expand_all(fields, adapter.tables(self.query))
>>   File "/Users/mfreitas/Downloads/web2py/gluon/dal.py", line 4629, in select
>> mongosort_list, limitby_limit, limitby_skip = \
>>   File "/Users/mfreitas/Downloads/web2py/gluon/dal.py", line 4574, in _select
>> ImportError: cannot import name son
>>
>>
>>
>>

[web2py] Mongodb - ImportError: cannot import name son

2012-06-11 Thread Michael Freitas
I tried to setup a new application using the latest source code form trunk 
and mongodb.  I get the error pasted at the end when I try to register a 
new user in my app.  I tried changing the "from pymongo import son" to 
"from bson import son" in the dal.py with no luck.  I can import son from 
bson within the python shell.
 
I am running on mac osx lion (using macports python 2.6), pymonogo 2.2 
(macports), mongodb 2.0.6 (macports) and web2py (2, 0, 0, 
datetime.datetime(2012, 6, 9, 17, 47, 2), 'dev')

Traceback (most recent call last):
  File "/Users/mfreitas/Downloads/web2py/gluon/restricted.py", line 205, in 
restricted
exec ccode in environment
  File 
"/Users/mfreitas/Downloads/web2py/applications/mongotest/controllers/default.py"
 , 
line 14, in 
  File "/Users/mfreitas/Downloads/web2py/gluon/globals.py", line 175, in 

self._caller = lambda f: f()
  File 
"/Users/mfreitas/Downloads/web2py/applications/mongotest/controllers/default.py"
 , 
line 3, in user
def user(): return dict(form=auth())
  File "/Users/mfreitas/Downloads/web2py/gluon/tools.py", line 1196, in __call__
return getattr(self,args[0])()
  File "/Users/mfreitas/Downloads/web2py/gluon/tools.py", line 2027, in register
onvalidation=onvalidation,hideerror=self.settings.hideerror):
  File "/Users/mfreitas/Downloads/web2py/gluon/sqlhtml.py", line 1130, in 
accepts
hideerror=hideerror,
  File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 1862, in accepts
status = self._traverse(status,hideerror)
  File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 790, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 790, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 790, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 790, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 797, in _traverse
newstatus = self._validate()
  File "/Users/mfreitas/Downloads/web2py/gluon/html.py", line 1620, in _validate
(value, errors) = validator(value)
  File "/Users/mfreitas/Downloads/web2py/gluon/validators.py", line 552, in 
__call__
rows = self.dbset(field == value, ignore_common_filters = 
self.ignore_common_filters).select(limitby=(0, 1))
  File "/Users/mfreitas/Downloads/web2py/gluon/dal.py", line 8147, in select
fields = adapter.expand_all(fields, adapter.tables(self.query))
  File "/Users/mfreitas/Downloads/web2py/gluon/dal.py", line 4629, in select
mongosort_list, limitby_limit, limitby_skip = \
  File "/Users/mfreitas/Downloads/web2py/gluon/dal.py", line 4574, in _select
ImportError: cannot import name son