[Flask] Question on Pluggable Views

Don Dwiggins ddwiggins at advpubtech.com
Mon May 9 13:55:01 EDT 2016


Has anyone here used pluggable views, as described in 
http://flask.pocoo.org/docs/0.10/views/ ?

I'm curious about the role of the first argument to the "as_view" method 
of the View class.  In the last example of the Basic Principle section, 
the text states " The class itself is instantiated with the parameters 
passed to the as_view() function.", but in the example, template_name is 
the only parameter to __init__; the first parameter to as_view, 
'about_page', doesn't seem to be used.

Experimenting a bit, I find that this first parameter needs to be 
present, and must be a string -- that's all.  Actually, it's the 
parameters after the first that get passed to the __init__ method.

In my code, I'm using an empty string for it in all cases, and it 
appears to work well.  However, I have a nagging feeling that this first 
parameter ought to be useful for something.

Any good thoughts welcome,
-- 

Don Dwiggins
Advanced Publishing Technology

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160509/b16353b2/attachment.html>


More information about the Flask mailing list