<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body style="background-color: rgb(255, 255, 255); color: rgb(0, 0,
0);" smarttemplateinserted="true" bgcolor="#FFFFFF" text="#000000">
I'm having trouble doing routing with class-based dispatching.<br>
<br>
In my url_map, I have a rule: "<Rule '/Home/<name>' (HEAD,
OPTIONS, GET) -> Home>".<br>
<br>
The view_func set to:<br>
<blockquote type="cite">self.RenderTemplateView.as_view( self.label,
self.label+'.html', 'templates')</blockquote>
where self.label='Home', and there's a template in
"templates/Home.html" that renders differently depending on whether
<name> has a value or is None.<br>
<br>
RenderTemplateView is defined as:<br>
<blockquote type="cite"> class
RenderTemplateView(flask.views.View):<br>
def __init__(self, template_name, *args, **kwargs):<br>
self.template_name = template_name<br>
<br>
def dispatch_request(self, *args, **kwargs):<br>
return flask.render_template(self.template_name)<br>
</blockquote>
<br>
Call it with <a class="moz-txt-link-rfc2396E" href="http://127.0.0.1:5000/Home/thing">"http://127.0.0.1:5000/Home/thing"</a> renders the
template, except that the <name> variable is bound to None,
not to "thing". If I add "name='thing' " to the render_template
call, it does get included in the display.<br>
<br>
I've tried a number of things, including inserting a line "x = 1/0"
before the render_template call to get a traceback, then examining
the sequence of calls; I couldn't find anything helpful.<br>
<br>
Decorator-based routing works fine, but isn't an option for me.<br>
<br>
Any good words appreciated,<br>
<br>
<br>
<div class="moz-signature">-- <br>
<pre>Don Dwiggins
Advanced Publishing Technology
</pre>
</div>
<div class="st4cursor"></div>
</body>
</html>