[web2py] Re: Using cache.action in a module

2018-08-03 Thread Anthony
> > I guess I could cache it at the controller level. But the incoming url is > like "scheme://app/control/func/subfunc?vars...". So I guess I'd parse it > at the controller level and then apply caching only for > "func/subfunc?vars..." which is the json-returning part. I've not really > us

[web2py] Re: Using cache.action in a module

2018-08-02 Thread Joe Barnhart
I developed a widget pattern that resembles the Auth class. It returns a dictionary when you create at the controller level. During the first creation of the widget (which is in a module) it builds structure and passes it out in a dict() to make the page. Later when Ajax is called it bypasse

[web2py] Re: Using cache.action in a module

2018-08-01 Thread Anthony
By the way, why do you want to use cache.action for a non-action? Even if this is an Ajax request, can't you still decorate the action that receives the request? If you only want to cache part of the generated response, then why not just use current.cache.ram, etc.? Anthony On Wednesday, Augus

[web2py] Re: Using cache.action in a module

2018-08-01 Thread Anthony
Sorry, didn't realize you were trying to decorate a method. cache.action is designed to cache controller actions, so it is not expecting to decorate any functions that take arguments (methods always take at least the self argument). On Wednesday, August 1, 2018 at 4:27:02 AM UTC-4, Joe Barnhart

[web2py] Re: Using cache.action in a module

2018-08-01 Thread Joe Barnhart
Ah, well. It seems a bit beyond me. I think it's failing because I'm caching a bound instance method (i.e. has "self"). I get "wrapped+_f takes no arguments, 1 given)". def lazy_cache_action(time_expire=DEFAULT_TIME_EXPIRE, cache_model=None, prefix=None, session=False, vars=True, l

[web2py] Re: Using cache.action in a module

2018-08-01 Thread Joe Barnhart
Oops, I meant of course; current.cache.action instead of current.cache On Wednesday, August 1, 2018 at 12:48:00 AM UTC-7, Joe Barnhart wrote: > > You're a fountain of ideas! I missed that one in the book. > > I wonder if this would work. Off to go try it... > > def lazy_cache_action(self,

[web2py] Re: Using cache.action in a module

2018-08-01 Thread Joe Barnhart
You're a fountain of ideas! I missed that one in the book. I wonder if this would work. Off to go try it... def lazy_cache_action(self, time_expire=DEFAULT_TIME_EXPIRE, cache_model=None, prefix=None, session=False, vars=True, lang=True, user_agent=False, public=True, vali

[web2py] Re: Using cache.action in a module

2018-07-31 Thread Anthony
On Tuesday, July 31, 2018 at 1:57:46 AM UTC-4, Joe Barnhart wrote: > > I was wondering about this. I tried to search the group but didn't find > anything relevant. Took a look at the source code and it seemed like I > could use in a module which is called to produce a string of Javascript on >