bug with default view

163 views
Skip to first unread message

Jose

unread,
Jun 17, 2011, 10:16:16 AM6/17/11
to web2py-users
Hi,

In later versions of the trunk the default view does not work. If I
create a function without creating ls associated view, should load the
default view, well, this is what fails. [invalid view]

Jose

Anthony

unread,
Jun 17, 2011, 10:35:14 AM6/17/11
to web...@googlegroups.com
Are you having this problem with requests on the local machine, or only remote requests? Due to a security vulnerability, generic views are turned off by default unless the request is local. In db.py of the 'welcome' app, the following has been added:
 
response.generic_patterns = ['*'] if request.is_local else []
 
 
response.generic_patterns is a list of glob patterns that can be used to match /controller/function.extension to determine which generic views should be available for which controllers and functions. The above line allows all generic views, but only when request.is_local is True. You can set the generic_patterns centrally in a model file (as above), or you can set it within specific controllers or functions. For example:
 
In default.py:
 
def myaction():
    response.generic_patterns = ['html', 'load']
    # more code
    return dict(...)
 
The above will enable generic.html and generic.load views specifically for requests to /default/myaction.[html/load].
 
Anthony

Jose

unread,
Jun 17, 2011, 12:33:06 PM6/17/11
to web2py-users
Thanks Anthony.

Oskari

unread,
Jul 6, 2011, 10:33:12 AM7/6/11
to web2py-users
When has this behaviour changed? I can't seem to find it on log

On Jun 17, 7:33 pm, Jose <jjac...@gmail.com> wrote:
> On 17 jun, 11:35, Anthony <abasta...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > On Friday, June 17, 2011 10:16:16 AM UTC-4, Jose wrote:
>
> > > Hi,
>
> > > In later versions of the trunk the default view does not work. If I
> > > create a function without creating ls associated view, should load the
> > > default view, well, this is what fails. [invalid view]
>
> > Are you having this problem with requests on the local machine, or only
> > remote requests? Due to a security vulnerability, generic views are turned
> > off by default unless the request is local. In db.py of the 'welcome' app,
> > the following has been added:
>
> >response.generic_patterns= ['*'] if request.is_local else []
>
> >response.generic_patternsis a list of glob patterns that can be used to
> > match /controller/function.extension to determine which generic views should
> > be available for which controllers and functions. The above line allows all
> > generic views, but only when request.is_local is True. You can set the
> > generic_patterns centrally in a model file (as above), or you can set it
> > within specific controllers or functions. For example:
>
> > In default.py:
>
> > def myaction():
> >    response.generic_patterns= ['html', 'load']

Anthony

unread,
Jul 6, 2011, 10:49:32 AM7/6/11
to web...@googlegroups.com

On Wednesday, July 6, 2011 10:33:12 AM UTC-4, Oskari wrote:
When has this behaviour changed? I can't seem to find it on log

On Jun 17, 7:33 pm, Jose <jja...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages