Re: [Pydev-code] Web2py helper: Adding imports and parsing models with jython scripting
Brought to you by:
fabioz
From: Álvaro J. I. <air...@gm...> - 2011-04-28 13:19:11
|
That might work for predefined classes or items, like "request", "response", "session"..., but I want to go further. I want to dinamically parse the files in models/, which define some variables and functions, and I want to make those available too. Is it possible to get this far using the jython scripting, or should I develop a plugin or a patch for pydev? Greets. On Thu, Apr 28, 2011 at 3:07 PM, Fabio Zadrozny <fab...@gm...> wrote: > Might be easier providing predefined completions (i.e.: generating > python stub code for web2py -- you can create a Python script that > loads the environment and extracts info as needed). > > See: http://pydev.org/manual_101_interpreter.html#id2 for details > > An example script that converts QScintilla .api files to the > predefined completions is available at: > https://github.com/aptana/Pydev/blob/master/plugins/org.python.pydev.jython/jysrc/convert_api_to_pypredef.py > (this file should also be in your local PyDev) > > Cheers, > > Fabio > > On Thu, Apr 28, 2011 at 9:36 AM, Álvaro J. Iradier <air...@gm...> wrote: >> Hi all, >> >> I'm trying to make a Jython Script for Pydev for better integration >> with web2py development. >> >> Basically, I need some way to access the python interpreter that is >> used for syntax check and code completion from the jython script. >> >> What I would like to do is, when a .py file for a web2py project is >> loaded in the editor, fist, make some imports into the current >> interpreter, for example: >> >> from gluon.globals import Request >> from gluon.globals import Session >> from gluon.globals import Response >> >> then instantiate some of this classes into global variables: >> >> request=Request() >> session=Session() >> response=Response() >> >> to simulate a real request environment. >> >> Finally, I want to "exec" all the files in the models/ folder, in >> order to have the globals declared in there into de interpreter. >> >> Can you guide me into the right path? I'm totally lost looking at the >> code in com.python.pydev.codecompletion... I don't know how to get >> there from the jython script (or even if it's possible). >> >> Thanks very much. >> >> -- >> >> (:=================================:) >> Alvaro J. Iradier Muro - air...@gm... >> >> ------------------------------------------------------------------------------ >> WhatsUp Gold - Download Free Network Management Software >> The most intuitive, comprehensive, and cost-effective network >> management toolset available today. Delivers lowest initial >> acquisition cost and overall TCO of any competing solution. >> http://p.sf.net/sfu/whatsupgold-sd >> _______________________________________________ >> pydev-code mailing list >> pyd...@li... >> https://lists.sourceforge.net/lists/listinfo/pydev-code >> > > ------------------------------------------------------------------------------ > WhatsUp Gold - Download Free Network Management Software > The most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > pydev-code mailing list > pyd...@li... > https://lists.sourceforge.net/lists/listinfo/pydev-code > -- (:=================================:) Alvaro J. Iradier Muro - air...@gm... |