[web2py] Re: web2py with Eclipse

2011-11-03 Thread monotasker
Can you tell me what the current status of this is? I'm running release 
1.99.2. I've placed the snippet you provide here in the top of my model 
file, but PyDev still doesn't recognize current or session or any of 
the gluon classes called in the model file. Is this just not yet 
implemented?


Re: [web2py] Re: web2py with Eclipse

2011-06-27 Thread Sebastian E. Ovide
That's it !

thanks

On Mon, Jun 27, 2011 at 1:16 AM, Pierre Thibault pierre.thibau...@gmail.com
 wrote:

 from applications.soso.models.some_module import my_db_helper_here

 I'm sorry I forgot the some_module in my first example.




-- 
Sebastian E. Ovide


[web2py] Re: web2py with Eclipse

2011-06-26 Thread sebastian
what about the functions defined in the models ? (global functions)


Re: [web2py] Re: web2py with Eclipse

2011-06-26 Thread Pierre Thibault
2011/6/26 sebastian sebastianov...@gmail.com

 what about the functions defined in the models ? (global functions)



Pydev won't see them because they are imported implicitly by web2py. You can
use the if 0: trick so the static code analyzer will not complain:

if 0:
  from applications.myapp.models import myfunc

In the preferences of Pydev you can make if fold-able to be able to fold
the noisy code: Window  Preferences  Pydev  Editor  Folding

There is not much you can do because this is not a standard way to do things
in Python. Breaking from the standard has his part of ugly.
-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


Re: [web2py] Re: web2py with Eclipse

2011-06-26 Thread Sebastian E. Ovide
Thanks Pierr,

I was trying to do that but it is not working... actually I have a bunch of
imports insede that if 0 trick that solve all the web2py dependencies
errors...

the only errors stil there are those due to functions in my model files (as
for example the models of my plugins)

I've tried also

from applications.myapp.models import *

and added a __init__.py inside the models folder

any other ideas ?


On Sun, Jun 26, 2011 at 8:39 PM, Pierre Thibault pierre.thibau...@gmail.com
 wrote:


 if 0:
   from applications.myapp.models import myfunc




-- 
Sebastian E. Ovide


Re: [web2py] Re: web2py with Eclipse

2011-06-26 Thread Sebastian E. Ovide
add info:

from applications.soso.models import my_db_helper_here

eclipse give this error:

Unresolved import: my_db_helper_here
Unused import: my_db_helper_here

On Sun, Jun 26, 2011 at 11:43 PM, Sebastian E. Ovide 
sebastian.ov...@gmail.com wrote:

 Thanks Pierr,

 I was trying to do that but it is not working... actually I have a bunch of
 imports insede that if 0 trick that solve all the web2py dependencies
 errors...

 the only errors stil there are those due to functions in my model files (as
 for example the models of my plugins)

 I've tried also

 from applications.myapp.models import *

 and added a __init__.py inside the models folder

 any other ideas ?



 On Sun, Jun 26, 2011 at 8:39 PM, Pierre Thibault 
 pierre.thibau...@gmail.com wrote:


 if 0:
   from applications.myapp.models import myfunc




 --
 Sebastian E. Ovide







-- 
Sebastian E. Ovide


Re: [web2py] Re: web2py with Eclipse

2011-06-26 Thread Pierre Thibault
2011/6/26 Sebastian E. Ovide sebastian.ov...@gmail.com

 add info:

 from applications.soso.models import my_db_helper_here

 eclipse give this error:

 Unresolved import: my_db_helper_here
 Unused import: my_db_helper_here


Is the web2py folder in your path?

I guess you are missing a level. Try something like:

from applications.soso.models.some_module import my_db_helper_here

I'm sorry I forgot the some_module in my first example.


-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


Re: [web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread Pierre Thibault
2011/6/20 weheh richard_gor...@verizon.net

 Hi Pierre, I've read your excellent pages and followed your
 instructions before, to good effect. Of course, the downside is that
 one ends up with a lot of junk code in the beginning of one's files. I
 was under the impression that the latest version of web2py bypassed
 all that with a simple 1-liner: from gluon import *  but this doesn't
 seem to be the case as it doesn't work for me. Hence, my question and
 this thread. Thanks for the quick response!



Thank you Weheh. This is the best solution I know for working with Pydev and
web2py. Definitively not perfect.

The good news is that it seems that the Pydev team is working on something
to improve the support of web2py:
http://groups.google.com/group/web2py/browse_thread/thread/38784ca3ebf3bbb0/aeded9d3cab7c468?lnk=gstq=pydev#aeded9d3cab7c468

We can hope for the best.


-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


Re: [web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread Anthony
Massimo suggested this recently: 
https://groups.google.com/d/msg/web2py/z-ckQANc9PY/-tGhBE6oxYMJ

On Monday, June 20, 2011 2:14:47 AM UTC-4, Pierre Thibault wrote:

 2011/6/20 weheh richard...@verizon.net

 Hi Pierre, I've read your excellent pages and followed your
 instructions before, to good effect. Of course, the downside is that
 one ends up with a lot of junk code in the beginning of one's files. I
 was under the impression that the latest version of web2py bypassed
 all that with a simple 1-liner: from gluon import *  but this doesn't
 seem to be the case as it doesn't work for me. Hence, my question and
 this thread. Thanks for the quick response!



 Thank you Weheh. This is the best solution I know for working with Pydev 
 and web2py. Definitively not perfect.

 The good news is that it seems that the Pydev team is working on something 
 to improve the support of web2py: 
 http://groups.google.com/group/web2py/browse_thread/thread/38784ca3ebf3bbb0/aeded9d3cab7c468?lnk=gstq=pydev#aeded9d3cab7c468

 We can hope for the best.


 -- 


 A+

 -
 Pierre
 My blog and profile 
 (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
 YouTube page 
 (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
 Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2



[web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread weheh
@Anthony, Unfortunately, this code from the other thread does not work
for my Eclipse installation:

if 0:
from gluon.dal import DAL
from gluon.tools import Auth
db = DAL()
auth = Auth()


The only thing that has worked so far is Pierre's implementation,
which is (no offense) unbelievably ugly (but effective).


Re: [web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread Pierre Thibault
2011/6/20 weheh richard_gor...@verizon.net

 @Anthony, Unfortunately, this code from the other thread does not work
 for my Eclipse installation:

 if 0:
from gluon.dal import DAL
from gluon.tools import Auth
db = DAL()
auth = Auth()


 The only thing that has worked so far is Pierre's implementation,
 which is (no offense) unbelievably ugly (but effective).


To ease things, it is possible to make if fold-able: Window  Preferences 
Pydev  Editor  Code folding  Fold if statements. Then you click in the
gutter to reduce in only one line.

-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
YouTube page 
(http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-20 Thread weheh
Makes sense! And prettier, too. Thx.

On Jun 20, 1:36 pm, Pierre Thibault pierre.thibau...@gmail.com
wrote:
 2011/6/20 weheh richard_gor...@verizon.net

  @Anthony, Unfortunately, this code from the other thread does not work
  for my Eclipse installation:

  if 0:
     from gluon.dal import DAL
     from gluon.tools import Auth
     db = DAL()
     auth = Auth()

  The only thing that has worked so far is Pierre's implementation,
  which is (no offense) unbelievably ugly (but effective).

 To ease things, it is possible to make if fold-able: Window  Preferences 
 Pydev  Editor  Code folding  Fold if statements. Then you click in the
 gutter to reduce in only one line.

 --

 A+

 -
 Pierre
 My blog and profile
 (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
 YouTube page 
 (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
 Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: web2py with Eclipse -- still lots of undefined stuff

2011-06-19 Thread weheh
Hi Pierre, I've read your excellent pages and followed your
instructions before, to good effect. Of course, the downside is that
one ends up with a lot of junk code in the beginning of one's files. I
was under the impression that the latest version of web2py bypassed
all that with a simple 1-liner: from gluon import *  but this doesn't
seem to be the case as it doesn't work for me. Hence, my question and
this thread. Thanks for the quick response!


On Jun 20, 12:16 am, Pierre Thibault pierre.thibau...@gmail.com
wrote:
 2011/6/19 weheh richard_gor...@verizon.net

  I'm using web2py 1.96.4 with Eclipse. I put
     from gluon import *
  in a model I was debugging. Eclipse still shows all the web2py stuff
  like db, DIV, session, T, etc. as being undefined variables. What am I
  doing wrong?

 All these things are magically imported by web2py. This is not standard
 Python programming.

 Here a few pointers:

 http://pierrethibault.posterous.com/?tag=eclipsepage=2

 http://pierrethibault.posterous.com/tag/eclipse

 --

 A+

 -
 Pierre
 My blog and profile
 (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com
 YouTube page 
 (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib
 Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2


[web2py] Re: web2py with Eclipse

2011-05-10 Thread Massimo Di Pierro
This is going to be easier in the future. Using trunk, just add this
to models:

from gluon import *
request,session,response,T,cache=current.request,current,session,curremt.response,current.t,current.cache



On May 10, 7:12 am, weheh richard_gor...@verizon.net wrote:
 I'm having trouble getting Eclipse to ignore undefined variable errors
 for things imported from gluon, like A, auth, etc. There are numerous
 threads on the subject, none of which I'm able to get to work,
 including:http://pierreth.blogspot.com/2010/10/web2py-eclipse-pydev-recipe.htmlhttp://groups.google.com/group/web2py/browse_thread/thread/feb055577d...

 The method I like the best is to add this string to Window 
 Preferences  Pydev  Code Analysis  Undefined under the Consider
 the following names as globals (comma separated):

 A,AUTH_ID,B,BEAUTIFY,BODY,BR,CENTER,CLEANUP,CODE,CRYPT,DIV,FORM,I,IFRAME,IM 
 G,INPUT,IS_ALPHANUMERIC,IS_DATE,IS_DATETIME,IS_DATETIME_IN_RANGE,IS_DATE_IN 
 _RANGE,IS_DECIMAL_IN_RANGE,IS_EMAIL,IS_EMPTY_OR,IS_EQUAL_TO,IS_EXPR,IS_FLOA 
 T_IN_RANGE,IS_IMAGE,IS_INT_IN_RANGE,IS_IN_DB,IS_IN_SET,IS_IPV4,IS_LENGTH,IS 
 _LIST_OF,IS_LOWER,IS_MATCH,IS_NOT_EMPTY,IS_NOT_IN_DB,IS_NULL_OR,IS_SLUG,IS_ 
 STRONG,IS_TIME,IS_UPLOAD_FILENAME,IS_UPPER,IS_URL,LABEL,LEGEND,LI,LINK,MARK 
 MIN,MENU,META,OBJECT,OL,ON,OPTGROUP,OPTION,P,PRE,SCRIPT,SELECT,SPAN,TABLE,T 
 AG,TBODY,TD,TEXTAREA,TFOOT,TH,THEAD,TITLE,TR,TT,UL,URL,XHTML,XML

 But as I said, this doesn't seem to do anything at all.

 Anybody know what to do?


[web2py] Re: web2py with Eclipse

2011-05-10 Thread weheh
MDP - thanks for the quick response. I don't currently use trunk, only
Current Version. What then?

On May 10, 8:46 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 This is going to be easier in the future. Using trunk, just add this
 to models:

 from gluon import *
 request,session,response,T,cache=current.request,current,session,curremt.response,current.t,current.cache

 On May 10, 7:12 am, weheh richard_gor...@verizon.net wrote:







  I'm having trouble getting Eclipse to ignore undefined variable errors
  for things imported from gluon, like A, auth, etc. There are numerous
  threads on the subject, none of which I'm able to get to work,
  including:http://pierreth.blogspot.com/2010/10/web2py-eclipse-pydev-recipe.html..

  The method I like the best is to add this string to Window 
  Preferences  Pydev  Code Analysis  Undefined under the Consider
  the following names as globals (comma separated):

  A,AUTH_ID,B,BEAUTIFY,BODY,BR,CENTER,CLEANUP,CODE,CRYPT,DIV,FORM,I,IFRAME,IM 
  G,INPUT,IS_ALPHANUMERIC,IS_DATE,IS_DATETIME,IS_DATETIME_IN_RANGE,IS_DATE_IN 
  _RANGE,IS_DECIMAL_IN_RANGE,IS_EMAIL,IS_EMPTY_OR,IS_EQUAL_TO,IS_EXPR,IS_FLOA 
  T_IN_RANGE,IS_IMAGE,IS_INT_IN_RANGE,IS_IN_DB,IS_IN_SET,IS_IPV4,IS_LENGTH,IS 
  _LIST_OF,IS_LOWER,IS_MATCH,IS_NOT_EMPTY,IS_NOT_IN_DB,IS_NULL_OR,IS_SLUG,IS_ 
  STRONG,IS_TIME,IS_UPLOAD_FILENAME,IS_UPPER,IS_URL,LABEL,LEGEND,LI,LINK,MARK 
  MIN,MENU,META,OBJECT,OL,ON,OPTGROUP,OPTION,P,PRE,SCRIPT,SELECT,SPAN,TABLE,T 
  AG,TBODY,TD,TEXTAREA,TFOOT,TH,THEAD,TITLE,TR,TT,UL,URL,XHTML,XML

  But as I said, this doesn't seem to do anything at all.

  Anybody know what to do?


[web2py] Re: web2py with Eclipse

2011-05-10 Thread Ross Peoples
The only thing that had really worked for me in the past was doing the if 0: 
trick:

if 0:
from gluon.dal import DAL
from gluon.tools import Auth
db = DAL()
auth = Auth()

The code won't actually get executed, it's just there to give Eclipse and 
other IDE's some direction.

If this still doesn't work, then you'll have to wait until the next web2py 
release, which could be in a week or two.


Re: [web2py] Re: web2py with Eclipse

2011-05-10 Thread Sebastian E. Ovide
yes, I'm using that trick and it is working fine... except in the views

On Tue, May 10, 2011 at 5:52 PM, Ross Peoples ross.peop...@gmail.comwrote:

 The only thing that had really worked for me in the past was doing the if
 0: trick:

 if 0:
 from gluon.dal import DAL
 from gluon.tools import Auth
 db = DAL()
 auth = Auth()

 The code won't actually get executed, it's just there to give Eclipse and
 other IDE's some direction.

 If this still doesn't work, then you'll have to wait until the next web2py
 release, which could be in a week or two.




-- 
Sebastian E. Ovide


[web2py] Re: web2py with Eclipse

2011-05-10 Thread weheh
Yeah, the fugly 0 trick works, but what a 2-bagger! Can't wait for the
new release.

On May 10, 4:44 pm, Sebastian E. Ovide sebastian.ov...@gmail.com
wrote:
 yes, I'm using that trick and it is working fine... except in the views

 On Tue, May 10, 2011 at 5:52 PM, Ross Peoples ross.peop...@gmail.comwrote:

  The only thing that had really worked for me in the past was doing the if
  0: trick:

  if 0:
      from gluon.dal import DAL
      from gluon.tools import Auth
      db = DAL()
      auth = Auth()

  The code won't actually get executed, it's just there to give Eclipse and
  other IDE's some direction.

  If this still doesn't work, then you'll have to wait until the next web2py
  release, which could be in a week or two.

 --
 Sebastian E. Ovide