Ok. It works as follow:
1. I made a soft link to gluon/__init__.py and named it gluon/ide.py
2. PythonPath / external libraries: first web2py/ than web2py/gluon
3. Put the following code to my controller:
if 0:
from ide import *
request, session, response, T, cache = current.request,
current.session,current
.response, current.t, current.cache
from tools import Auth, Service, Crud
db = DAL()
auth = Auth()
service = Service()
crud = Crud()
Can something be missing but that code now can be extended as requires.
I have code completion and I got only 1 warning because the *from ide import
* unused in wild import...
Something for debugging. If breakpoints are not working try to put in the
code:
import pydevd;pydevd.settrace()
It should stop the execution... If web2py is running in debugging mode. :)
Have a nice day!
2012. április 11., szerda 10:15:33 UTC+2 időpontban szimszon a következőt
írta:
>
> That's interesting.
>
> It seems that the order in pythonpath is relevant.
>
> If I put first web2py/gluon than web2py/ in external libs autocomplet is
> not working. If I reverse the order autocomplet is working.
> I still have to specify all the request, response... object for code
> analyze...
>
> But if autocomplet works than the following lines give an error:
> if 0:
> ...
> from gluon.tools import Auth
>
> Auth: Unresolved import :(
>
> 2012. április 10., kedd 22:34:09 UTC+2 időpontban simon a következőt írta:
>>
>> I have found that aptana does not import packages by reading the __init__
>> file. So "from gluon import *" fails to define anything. However if you
>> copy gluon.__init__ into ide.py and "from ide.py import *", then it seems
>> to work.
>>
>> Adding to the pythonpath does not seem to do anything. Also aptana is a
>> little forgetful. One day it recognises all the imports and the next day it
>> has apparently forgotten.
>>
>>
>> On Monday, 9 April 2012 20:04:30 UTC+1, ikdme wrote:
>>>
>>> Tang, please how do i implement this your suggestion?
>>>
>>> On Thu, Apr 5, 2012 at 3:54 PM, Xiaofeng Tang <[email protected]>wrote:
>>>
>>>> I use PyDev and add web2py src into "PyDev - PythonPath" to resolve the
>>>> incorrect refs and enable autocompletion.
>>>>
>>>> Alternatively, u could install the path of web2py src into systeml
>>>> envirnoment vairable "pythonpath".
>>>>
>>>> --- on 2012/4/5 22:51:41, Rod Watkins <[email protected]> wrote:
>>>> > I know this has been asked before. I don't mean to be an annoyance.
>>>> > I've done the searches are read numerous posts about how to handle
>>>> > this. But the advice conflicts and I've yet to actually fix the
>>>> problem.
>>>> >
>>>> > What is the best way to handle imports for eclipse to get autocomplete
>>>> > to work properly (as well as rid eclipse of all the incorrect error
>>>> > messages?
>>>> >
>>>> > I rather like having autocomplete functioning since, as a beginner, it
>>>> > helps me discover functionality that I might otherwise miss (besides
>>>> > saving some typing).
>>>> >
>>>> > Please accept my thanks in advance for any help on this.
>>>> >
>>>> > Cordially,
>>>> > Rod Watkins
>>>>
>>>>
>>>