Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-12 Thread Andrew W
Perfect !  Thanks for the quick response.   
I saw your solution above, but assumed that you had added it to github.  
All's Good.

One more question please (which I asked on web2py slices):
How to use auth.wiki with movuca.   There was a web2pyslices post in 
relation to plugin_wiki, and I was wondering what has changed for 
auth.wiki.  The two together makes sense (I think).



On Wednesday, September 12, 2012 4:20:19 PM UTC+12, rochacbruno wrote:

 I did some changes on Movuca, but I still have to solve little issues in 
 order to commit.

 But I just commited a workarounf for the problem:
 https://github.com/rochacbruno/Movuca/commit/aa25103e9c37921a34a225b8e82ca0f8634ca831



-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-12 Thread BlueShadow
So if I understand you correctly you lighten the server load and get 
quicker sites when you add change db=DAL(...) to 
db=DAL(...,lazy_tables=True)
I like the everything gets better option :)

On Monday, September 10, 2012 3:15:32 AM UTC+2, rochacbruno wrote:

 On Sun, Sep 9, 2012 at 9:27 PM, Andrew W awill...@gmail.com javascript:
  wrote:

 (although I still don't quite really understand what a lazy table is).


 imagine you have

 models/db.py

 db = DAL(...)
 db.define_table(table1.)
 db.define_table(table2.)
 ...
 ...
 db.define_table(table30.)

 So, for each request (I mean every time user hits an url or click on 
 something) all that 30 tables will be imeddiatelly instantiated even if the 
 requested page does not need to all the 30 tables.

 The process of table definition involves some logic such as instantiate a 
 new Table object, check all the fields, do migrations, check reserved 
 keywords, check the tablename atc...

 Now if you turn

 db = DAL(... lazy_tables=True)

 for each request web2py will just store some data in a dictionary 
 {tablename: {fields: ., options:}, no table will be 
 instantiated ultil needed.

 So when in your program you do 

 db(db.table1),select() # in this time web2py will fire the table 
 instantiation and all the process, so it will happen only for the table you 
 need and you saved 29.

 Thats it.  




-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-11 Thread Andrew W
Is anyone else using Movuca with web2py version 2.x  experiencing this ?  I 
downloaded the latest Movuca and I'm running web2py off trunk.



On Monday, September 10, 2012 4:59:08 PM UTC+12, Andrew W wrote:

 Hi Bruno,
 I got the same error with movuca, which I downloaded today:

  File D:\Mercurial\web2py\gluon\dal.py, line 7149, in __getattr__
 if ogetattr(self,'_lazy_tables') and \
 AttributeError: 'DataBase' object has no attribute '_lazy_tables'





 On Monday, September 10, 2012 7:24:15 AM UTC+12, rochacbruno wrote:


 Here is the solution: 
 https://github.com/rochacbruno/web2py_model_less_app/blob/master/modules/myapp.py#L82

 That approach subclasses DAL so it need to include _lazy_tables = {} 

 But, now that we have lazy_tables in default DAL, I recommend you to use 
 the default web2py scheme with lazy_tables=True, and you will not have the 
 ols problem of lot of tables defined.

 BTW: I am still using the modelless class based scheme and it is working 
 good.


 *Bruno Cezar Rocha** - @rochacbruno*
 rocha...@gmail.com | Mobile: +55 (11) 99210-8821
 www.CursoDePython.com.br | www.rochacbruno.com.br
 Blog: Using Python to get all the external links from a 
 webpagehttp://rochacbruno.com.br/using-python-to-get-all-the-external-links-from-a-webpage/
   Get a signature like this. 
 http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18
  Click 
 here.http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18




 On Sun, Sep 9, 2012 at 3:22 PM, Don_X don.cl...@gmail.com wrote:

 Considering that I have many tables in my model files on the main app I 
 am building 

 Wanting to take the modelless approach ( slice submitted by BrunoRocha )

 in order to avoid possible future bottleneck and/or latency 

 I wanted to advise that the modelless app no longer works under web2py 
 2.0.x

 When I downloaded and installed the running test app to check it out 
 with any 2.0.x

 I get the following error ticket msg :

 type 'exceptions.AttributeError' 'DataBase' object has no attribute 
 '_lazy_tables'


 Can anyone help me with this ??? ...  so I can make it right ... before 
 I incorporate this approach in my app dev habit ..

 is there a patch for it ??? ...

 thank you

 Don



  -- 
  
  
  





-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-11 Thread Bruno Rocha
I did some changes on Movuca, but I still have to solve little issues in
order to commit.

But I just commited a workarounf for the problem:
https://github.com/rochacbruno/Movuca/commit/aa25103e9c37921a34a225b8e82ca0f8634ca831

-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-09 Thread Bruno Rocha
Here is the solution:
https://github.com/rochacbruno/web2py_model_less_app/blob/master/modules/myapp.py#L82

That approach subclasses DAL so it need to include _lazy_tables = {}

But, now that we have lazy_tables in default DAL, I recommend you to use
the default web2py scheme with lazy_tables=True, and you will not have the
ols problem of lot of tables defined.

BTW: I am still using the modelless class based scheme and it is working
good.


*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: Using Python to get all the external links from a
webpagehttp://rochacbruno.com.br/using-python-to-get-all-the-external-links-from-a-webpage/
  Get a signature like this.
http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18
Click
here.http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18



On Sun, Sep 9, 2012 at 3:22 PM, Don_X don.clerm...@gmail.com wrote:

 Considering that I have many tables in my model files on the main app I am
 building 

 Wanting to take the modelless approach ( slice submitted by BrunoRocha )

 in order to avoid possible future bottleneck and/or latency

 I wanted to advise that the modelless app no longer works under web2py
 2.0.x

 When I downloaded and installed the running test app to check it out with
 any 2.0.x

 I get the following error ticket msg :

 type 'exceptions.AttributeError' 'DataBase' object has no attribute
 '_lazy_tables'


 Can anyone help me with this ??? ...  so I can make it right ... before I
 incorporate this approach in my app dev habit ..

 is there a patch for it ??? ...

 thank you

 Don



  --





-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-09 Thread Le Don X
thank you Bruno for the update ! .. I will look it up shortly.

-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-09 Thread Andrew W
Thanks Bruno for the comments,
I have been looking into the modelless approach so it's interesting to read 
your views on the new lazy_tables feature.I think it is a lot simpler 
creating an app that follows the MVC structure out of the box, so the lazy 
option sounds like a great breakthrough   (although I still don't quite 
really understand what a lazy table is).


On Monday, September 10, 2012 7:24:15 AM UTC+12, rochacbruno wrote:


 Here is the solution: 
 https://github.com/rochacbruno/web2py_model_less_app/blob/master/modules/myapp.py#L82

 That approach subclasses DAL so it need to include _lazy_tables = {} 

 But, now that we have lazy_tables in default DAL, I recommend you to use 
 the default web2py scheme with lazy_tables=True, and you will not have the 
 ols problem of lot of tables defined.

 BTW: I am still using the modelless class based scheme and it is working 
 good.


 *Bruno Cezar Rocha** - @rochacbruno*
 rocha...@gmail.com javascript: | Mobile: +55 (11) 99210-8821
 www.CursoDePython.com.br | www.rochacbruno.com.br
 Blog: Using Python to get all the external links from a 
 webpagehttp://rochacbruno.com.br/using-python-to-get-all-the-external-links-from-a-webpage/
   Get a signature like this. 
 http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18
  Click 
 here.http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18




 On Sun, Sep 9, 2012 at 3:22 PM, Don_X don.cl...@gmail.com 
 javascript:wrote:

 Considering that I have many tables in my model files on the main app I 
 am building 

 Wanting to take the modelless approach ( slice submitted by BrunoRocha )

 in order to avoid possible future bottleneck and/or latency 

 I wanted to advise that the modelless app no longer works under web2py 
 2.0.x

 When I downloaded and installed the running test app to check it out with 
 any 2.0.x

 I get the following error ticket msg :

 type 'exceptions.AttributeError' 'DataBase' object has no attribute 
 '_lazy_tables'


 Can anyone help me with this ??? ...  so I can make it right ... before I 
 incorporate this approach in my app dev habit ..

 is there a patch for it ??? ...

 thank you

 Don



  -- 
  
  
  





-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-09 Thread Bruno Rocha
On Sun, Sep 9, 2012 at 9:27 PM, Andrew W awillima...@gmail.com wrote:

 (although I still don't quite really understand what a lazy table is).


imagine you have

models/db.py

db = DAL(...)
db.define_table(table1.)
db.define_table(table2.)
...
...
db.define_table(table30.)

So, for each request (I mean every time user hits an url or click on
something) all that 30 tables will be imeddiatelly instantiated even if the
requested page does not need to all the 30 tables.

The process of table definition involves some logic such as instantiate a
new Table object, check all the fields, do migrations, check reserved
keywords, check the tablename atc...

Now if you turn

db = DAL(... lazy_tables=True)

for each request web2py will just store some data in a dictionary
{tablename: {fields: ., options:}, no table will be
instantiated ultil needed.

So when in your program you do

db(db.table1),select() # in this time web2py will fire the table
instantiation and all the process, so it will happen only for the table you
need and you saved 29.

Thats it.

-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-09 Thread Andrew W
Excellent.  Great explanation.  

On Monday, September 10, 2012 1:15:32 PM UTC+12, rochacbruno wrote:

 On Sun, Sep 9, 2012 at 9:27 PM, Andrew W awill...@gmail.com javascript:
  wrote:

 (although I still don't quite really understand what a lazy table is).


 imagine you have

 models/db.py

 db = DAL(...)
 db.define_table(table1.)
 db.define_table(table2.)
 ...
 ...
 db.define_table(table30.)

 So, for each request (I mean every time user hits an url or click on 
 something) all that 30 tables will be imeddiatelly instantiated even if the 
 requested page does not need to all the 30 tables.

 The process of table definition involves some logic such as instantiate a 
 new Table object, check all the fields, do migrations, check reserved 
 keywords, check the tablename atc...

 Now if you turn

 db = DAL(... lazy_tables=True)

 for each request web2py will just store some data in a dictionary 
 {tablename: {fields: ., options:}, no table will be 
 instantiated ultil needed.

 So when in your program you do 

 db(db.table1),select() # in this time web2py will fire the table 
 instantiation and all the process, so it will happen only for the table you 
 need and you saved 29.

 Thats it.  




-- 





Re: [web2py] Modelless app no longer works with web2py 2.0.x ???

2012-09-09 Thread Andrew W
Hi Bruno,
I got the same error with movuca, which I downloaded today:

 File D:\Mercurial\web2py\gluon\dal.py, line 7149, in __getattr__
if ogetattr(self,'_lazy_tables') and \
AttributeError: 'DataBase' object has no attribute '_lazy_tables'





On Monday, September 10, 2012 7:24:15 AM UTC+12, rochacbruno wrote:


 Here is the solution: 
 https://github.com/rochacbruno/web2py_model_less_app/blob/master/modules/myapp.py#L82

 That approach subclasses DAL so it need to include _lazy_tables = {} 

 But, now that we have lazy_tables in default DAL, I recommend you to use 
 the default web2py scheme with lazy_tables=True, and you will not have the 
 ols problem of lot of tables defined.

 BTW: I am still using the modelless class based scheme and it is working 
 good.


 *Bruno Cezar Rocha** - @rochacbruno*
 rocha...@gmail.com javascript: | Mobile: +55 (11) 99210-8821
 www.CursoDePython.com.br | www.rochacbruno.com.br
 Blog: Using Python to get all the external links from a 
 webpagehttp://rochacbruno.com.br/using-python-to-get-all-the-external-links-from-a-webpage/
   Get a signature like this. 
 http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18
  Click 
 here.http://r1.wisestamp.com/r/landing?promo=18dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_18




 On Sun, Sep 9, 2012 at 3:22 PM, Don_X don.cl...@gmail.com 
 javascript:wrote:

 Considering that I have many tables in my model files on the main app I 
 am building 

 Wanting to take the modelless approach ( slice submitted by BrunoRocha )

 in order to avoid possible future bottleneck and/or latency 

 I wanted to advise that the modelless app no longer works under web2py 
 2.0.x

 When I downloaded and installed the running test app to check it out with 
 any 2.0.x

 I get the following error ticket msg :

 type 'exceptions.AttributeError' 'DataBase' object has no attribute 
 '_lazy_tables'


 Can anyone help me with this ??? ...  so I can make it right ... before I 
 incorporate this approach in my app dev habit ..

 is there a patch for it ??? ...

 thank you

 Don



  -- 
  
  
  





--