<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Better Form Generation with Mako and Pylons</title>
	<atom:link href="http://techspot.zzzeek.org/?feed=rss2&#038;p=28" rel="self" type="application/rss+xml" />
	<link>http://techspot.zzzeek.org/?p=28</link>
	<description>the rare comment from Mike Bayer</description>
	<pubDate>Tue, 07 Sep 2010 18:31:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Chris</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-2361</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Wed, 30 Dec 2009 20:47:06 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-2361</guid>
		<description>&lt;p&gt;zzzeek,
This is excellent stuff, helped me clean up my form gen/processing code quite a bit. &lt;/p&gt;

&lt;p&gt;...And in general, I really appreciate your blog posts about web development; tremendous amount of learning for me.  If you could only post more often :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>zzzeek,
This is excellent stuff, helped me clean up my form gen/processing code quite a bit. </p>

<p>...And in general, I really appreciate your blog posts about web development; tremendous amount of learning for me.  If you could only post more often :)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Lewis</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-2214</link>
		<dc:creator>Mike Lewis</dc:creator>
		<pubDate>Mon, 13 Apr 2009 04:22:51 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-2214</guid>
		<description>&lt;p&gt;Hi. I really like the idea of this. Unfortunately, I couldn't get the example working (probably something to do with versions). Anyways, it appears to make the action for the form something like . Anyways, I picked through the source and getting rid of "url or" on like 41 of form&lt;em&gt;tags.mako (just making it have to use url&lt;/em&gt;kwargs) did the trick.&lt;/p&gt;

&lt;p&gt;Thanks for the nice writeup and everything else you've done :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi. I really like the idea of this. Unfortunately, I couldn't get the example working (probably something to do with versions). Anyways, it appears to make the action for the form something like . Anyways, I picked through the source and getting rid of "url or" on like 41 of form<em>tags.mako (just making it have to use url</em>kwargs) did the trick.</p>

<p>Thanks for the nice writeup and everything else you've done :)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Feifarek</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-2014</link>
		<dc:creator>Matt Feifarek</dc:creator>
		<pubDate>Tue, 09 Sep 2008 22:55:11 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-2014</guid>
		<description>&lt;p&gt;One possible weirdness...&lt;/p&gt;

&lt;p&gt;If one doesn't successfully pass the validation step, ones browser is sitting with a form (with errors) on /comment/post/. This URL is invalid for any followup GET.&lt;/p&gt;

&lt;p&gt;If they GET that page, you get a big nasty error:
AttributeError: 'CommentController' object has no attribute 'form_result'&lt;/p&gt;

&lt;p&gt;Likewise, if they ARE successful, and they reload, or GET that page, the same thing happens. That's easier, as it's a pretty standard practice to redirect upon success (if only to avoid the dual-submit problem).&lt;/p&gt;

&lt;p&gt;The former is more troublesome; it could be try/excepted, but that's a little nasty; bad URLs shouldn't be this easy to find.&lt;/p&gt;

&lt;p&gt;But, I know where you're coming with formencode switching action dispatch on you. I don't like that either.&lt;/p&gt;

&lt;p&gt;I DO like when the same URL is mapped into two different actions via their request method via routes. For example, the url /comment/89/edit can lead to an action called 'edit' for GET (which returns a form) and to an action called 'update" for POST (which does some validation, database stuff, whatever). This ends up working very nicely.&lt;/p&gt;

&lt;p&gt;But I've learned from the more important meat of your little project; I like this way of making forms, and I think that we can work out our own quirky url-dispatch neuroses on our own time.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>One possible weirdness...</p>

<p>If one doesn't successfully pass the validation step, ones browser is sitting with a form (with errors) on /comment/post/. This URL is invalid for any followup GET.</p>

<p>If they GET that page, you get a big nasty error:
AttributeError: 'CommentController' object has no attribute 'form_result'</p>

<p>Likewise, if they ARE successful, and they reload, or GET that page, the same thing happens. That's easier, as it's a pretty standard practice to redirect upon success (if only to avoid the dual-submit problem).</p>

<p>The former is more troublesome; it could be try/excepted, but that's a little nasty; bad URLs shouldn't be this easy to find.</p>

<p>But, I know where you're coming with formencode switching action dispatch on you. I don't like that either.</p>

<p>I DO like when the same URL is mapped into two different actions via their request method via routes. For example, the url /comment/89/edit can lead to an action called 'edit' for GET (which returns a form) and to an action called 'update" for POST (which does some validation, database stuff, whatever). This ends up working very nicely.</p>

<p>But I've learned from the more important meat of your little project; I like this way of making forms, and I think that we can work out our own quirky url-dispatch neuroses on our own time.</p>

<p>Thanks.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Olaf Conradi</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-1998</link>
		<dc:creator>Olaf Conradi</dc:creator>
		<pubDate>Sat, 02 Aug 2008 09:46:39 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-1998</guid>
		<description>&lt;p&gt;The validate decorator should contain:&lt;/p&gt;

&lt;p&gt;if errors:
    request.environ['REQUEST_METHOD'] = 'GET'&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The validate decorator should contain:</p>

<p>if errors:
    request.environ['REQUEST_METHOD'] = 'GET'</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Olaf Conradi</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-1997</link>
		<dc:creator>Olaf Conradi</dc:creator>
		<pubDate>Sat, 02 Aug 2008 09:33:33 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-1997</guid>
		<description>&lt;p&gt;I like this idea, but how do you deal with hiding the validating controller like so:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@rest.dispatch_on(POST='_mako_post')
def index(self):
    return render('/mako_helpers.html')

@mako_validate(schema=CommentForm, input_controller=index)
def _mako_post(self):
    c.name = self.form_result['name']
    return render('/thanks.html')
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;On submit this leads to a loop between dispatch and input_controller.
With @validate(form='index', schema=CommentForm()) on Pylons 0.9.6 this used to work.&lt;/p&gt;

&lt;p&gt;Any ideas?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I like this idea, but how do you deal with hiding the validating controller like so:</p>

<pre><code>@rest.dispatch_on(POST='_mako_post')
def index(self):
    return render('/mako_helpers.html')

@mako_validate(schema=CommentForm, input_controller=index)
def _mako_post(self):
    c.name = self.form_result['name']
    return render('/thanks.html')
</code></pre>

<p>On submit this leads to a loop between dispatch and input_controller.
With @validate(form='index', schema=CommentForm()) on Pylons 0.9.6 this used to work.</p>

<p>Any ideas?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Noah Gift</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-1984</link>
		<dc:creator>Noah Gift</dc:creator>
		<pubDate>Sun, 06 Jul 2008 00:23:29 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-1984</guid>
		<description>&lt;p&gt;Mike,&lt;/p&gt;

&lt;p&gt;I would bet there are a LOT of interactive web companies that are looking to use Python in New York.  I think that more blogs posts that highlight how Python is a different beast than PHP and Java would be helpful.  PHP is pretty efficient for "throw away" projects, but often those projects could be reused later if they were written in Python.&lt;/p&gt;

&lt;p&gt;Although I am not currently living in New York, I think it would be good to get the word out that web development with Flash, Javascript and Python is a killer stack.  That is currently what I am doing.&lt;/p&gt;

&lt;p&gt;Noah&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Mike,</p>

<p>I would bet there are a LOT of interactive web companies that are looking to use Python in New York.  I think that more blogs posts that highlight how Python is a different beast than PHP and Java would be helpful.  PHP is pretty efficient for "throw away" projects, but often those projects could be reused later if they were written in Python.</p>

<p>Although I am not currently living in New York, I think it would be good to get the word out that web development with Flash, Javascript and Python is a killer stack.  That is currently what I am doing.</p>

<p>Noah</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Feifarek</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-1982</link>
		<dc:creator>Matt Feifarek</dc:creator>
		<pubDate>Thu, 03 Jul 2008 16:40:16 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-1982</guid>
		<description>&lt;p&gt;Aha! I didn't catch that you put a hook in environment.py.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Aha! I didn't catch that you put a hook in environment.py.</p>

<p>Thanks!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Krishgy</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-1980</link>
		<dc:creator>Krishgy</dc:creator>
		<pubDate>Thu, 03 Jul 2008 14:50:54 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-1980</guid>
		<description>&lt;p&gt;You know what, I am using Mako templates to generate the Java struts projects based on Appfuse struts-spring-hibernate.&lt;/p&gt;

&lt;p&gt;Mako does the job very well. Similarly we used mako to generate our device configuration in very nicer XML content which is used for millions for people across the world to configure the flow meters. &lt;/p&gt;

&lt;p&gt;Though I hack Pylons, SqlAlchemy and Mako at home, we use Python very rare in our office. I am marketing Python and Mako at our office for code generation.&lt;/p&gt;

&lt;p&gt;Thanks a lot Mike.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You know what, I am using Mako templates to generate the Java struts projects based on Appfuse struts-spring-hibernate.</p>

<p>Mako does the job very well. Similarly we used mako to generate our device configuration in very nicer XML content which is used for millions for people across the world to configure the flow meters. </p>

<p>Though I hack Pylons, SqlAlchemy and Mako at home, we use Python very rare in our office. I am marketing Python and Mako at our office for code generation.</p>

<p>Thanks a lot Mike.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: zzzeek</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-1977</link>
		<dc:creator>zzzeek</dc:creator>
		<pubDate>Wed, 02 Jul 2008 21:46:22 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-1977</guid>
		<description>&lt;p&gt;try running the entire example, with Pylons 0.9.7, as is.  There's configuration in the config/environment.py to get the custom tags.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>try running the entire example, with Pylons 0.9.7, as is.  There's configuration in the config/environment.py to get the custom tags.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Feifarek</title>
		<link>http://techspot.zzzeek.org/?p=28#comment-1976</link>
		<dc:creator>Matt Feifarek</dc:creator>
		<pubDate>Wed, 02 Jul 2008 21:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://techspot.zzzeek.org/?p=28#comment-1976</guid>
		<description>&lt;p&gt;I love the idea of this; trying to implement a similar thing to play with it and see how it goes, and I get a Mako syntax error:&lt;/p&gt;

&lt;p&gt;SyntaxException: (SyntaxError) invalid syntax (, line 1) ...&lt;/p&gt;

&lt;p&gt;I tried this with Mako version 1.8 and 2.2&lt;/p&gt;

&lt;p&gt;Thinking it might be a version problem, I made a virtualenv without access to site-wide site-packages and installed formhelper into it with dependencies, and ran that.&lt;/p&gt;

&lt;p&gt;I get:
ImportError: cannot import name StatusCodeRedirect&lt;/p&gt;

&lt;p&gt;So I forced the virtualenv to install pylons dev version, which works. But now I can't tell which bit is necessary to try out your custom tag trick.&lt;/p&gt;

&lt;p&gt;I can import a namespace, and access its members, but through the old ${newspace.member(name='foo')} syntax, not  which still causes a syntax error.&lt;/p&gt;

&lt;p&gt;Great idea, I'm looking forward to getting it running ;-)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I love the idea of this; trying to implement a similar thing to play with it and see how it goes, and I get a Mako syntax error:</p>

<p>SyntaxException: (SyntaxError) invalid syntax (, line 1) ...</p>

<p>I tried this with Mako version 1.8 and 2.2</p>

<p>Thinking it might be a version problem, I made a virtualenv without access to site-wide site-packages and installed formhelper into it with dependencies, and ran that.</p>

<p>I get:
ImportError: cannot import name StatusCodeRedirect</p>

<p>So I forced the virtualenv to install pylons dev version, which works. But now I can't tell which bit is necessary to try out your custom tag trick.</p>

<p>I can import a namespace, and access its members, but through the old ${newspace.member(name='foo')} syntax, not  which still causes a syntax error.</p>

<p>Great idea, I'm looking forward to getting it running ;-)</p>]]></content:encoded>
	</item>
</channel>
</rss>
