This was changed due to a security risk. You now have to explicitly enable 
generic views by specifying response.generic_patterns somewhere -- it is a 
list of globs matching controller/function.extension.

To enable all generic views, add this in a model file:

response.generic_patterns = ['*']  # security risk

To enable the generic.load view only:

response.generic_patterns = ['load']  # still a security risk

To enable generic.load for particular functions:

response.generic_patterns = ['load'] if request.function in ['func1', 
'func2', etc.] else []

or, inside the particular function itself, just do:

response.generic_patterns = ['load']

Anthony


On Wednesday, September 21, 2011 12:00:59 PM UTC-4, juanduke wrote:
>
> Hi all:
>
> I think this topic is related with backward compatibilty discussed in 
> another thread, but anyway.
>
> The situation: 
> I've developed an app using web2py src version 1.95.1, in this app I load a 
> form, from the view calling web2py_component using extension ".load"
> Something like this:
> #View:
>
> web2py_component( '{{=URL(r=request, 
> f="myControllerFunction",extension="load")}}','id_of_some_div');
>
>
> I read somewhere in the book, that if web2py cant find a .load file, will 
> use "generic.load" file (i.e. if theres not exist myform.load, web2py use 
> generic.load)
> and this behavior/magic, is what happend in v.1.95.1
>
> The app is working perfectly on 1.95.1 And I repeat, I dont have .load file 
> in my app, except generic.load.
>
> *But...*,
>
> When  I move my app to Version 1.98.2 (2011-08-04 00:47:09) (last stable 
> version), I do some basic testing using my app, and when I access to the 
> components, appears: *Invalid view default/myform.load *error message. I 
> think this is right, because I dont created .load file, but WHY web2py dont 
> use *generic.load* file in this case, like in v1.95.1.
>
> Finally, my quick fix was: create the corresponding .load files (one for 
> each component I call), and paste inside the new files the same content of 
> *generic.load*
>
> What I want to ask is:
> - if this is new restriction/behavior of 1.98.2, or some minor bug in 
> 1.95.1, or what?
> - Is there another solution? 
> - I'm missing something that need to know? 
> - Someone can explain to me?
>
> Thanks in advance!!
> Bye.
>
> PD: sorry for my bad english.
>

Reply via email to