I tried running nightly build, but web2py wouldn't start:
Traceback (most recent call last):
File
"N:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydevd.py",
line 3, in <module>
import pydev_imports
File
"N:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\pydev_imports.py",
line 14, in <module>
from _pydev_SimpleXMLRPCServer import SimpleXMLRPCServer
File
"N:\eclipse\plugins\org.python.pydev.debug_2.4.0.2012020116\pysrc\_pydev_SimpleXMLRPCServer.py",
line 115, in <module>
import SocketServer
File "c:\Program Files (x86)\Python25\lib\SocketServer.py", line 132, in
<module>
import socket
File "c:\Program Files (x86)\Python25\lib\socket.py", line 45, in <module>
import _socket
ImportError: DLL load failed: The specified module could not be found.
On Sunday, December 9, 2012 11:45:54 PM UTC+8, Massimo Di Pierro wrote:
>
> I believe this is fixed in the nightly built.
>
> On Sunday, 9 December 2012 07:44:45 UTC-6, weheh wrote:
>>
>> Since upgrading to web2py 2.x from 1.9x.x, (I'm running 2.2.1 stable from
>> source) auth.impersonate isn't working for me any more. My controller
>> "user.py" has an impersonate action that calls auth.impersonate (first bold
>> line below):
>>
>> @auth.requires_login()
>> def impersonate():
>> user_id = int(request.args(0))
>> * imp_form = auth.impersonate(user_id)*
>> * if not isinstance(imp_form, SQLFORM):*
>> if user_id == 0:
>> redirect(URL(c='action1', f='index', args=args,
>> extension=False))
>> redirect(URL(c='action2', f='index', args=args, extension=False))
>> return dict(imp_form=imp_form)
>>
>>
>> The line
>> imp_form = auth.impersonate(user_id)
>> used to work fine but now throws the ticket:
>>
>> Traceback (most recent call last):
>> File "N:\web2py\gluon\restricted.py", line 212, in restricted
>> exec ccode in environment
>> File "N:/web2py/applications/myapp/controllers/user.py"
>> <http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/user.py>, line 674,
>> in <module>
>> File "N:\web2py\gluon\globals.py", line 188, in <lambda>
>> self._caller = lambda f: f()
>> File "N:\web2py\gluon\tools.py", line 2911, in f
>> return action(*a, **b)
>> File "N:/web2py/applications/myapp/controllers/user.py"
>> <http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/user.py>, line 555,
>> in impersonate
>> imp_form = auth.impersonate(user_id)
>> File "N:\web2py\gluon\tools.py", line 2826, in impersonate
>> return SQLFORM(table_user, user.id, readonly=True)
>> UnboundLocalError: local variable 'user' referenced before assignment
>>
>> I've traced it in eclipse and user_id is set properly.
>>
>> I went into gluon/tools.py and hacked line 2826 to be
>>
>> return SQLFORM(table_user, user_id, readonly=True)
>>
>> and that resolves the ticket. However, the "not isinstance(imp_form,
>> SQLFORM)" clause (see emboldened text above) isn't triggering any longer, so
>> I'm not getting the expected redirection after impersonation.
>>
>> Any help would be appreciated. Thanks.
>>
>>
>>
--