<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Drinkable Chicken &#187; appengine</title>
	<atom:link href="http://4.flowsnake.org/archives/tag/appengine/feed" rel="self" type="application/rss+xml" />
	<link>http://4.flowsnake.org</link>
	<description>A Pythoneer&#039;s adventures with Scheme, etc.</description>
	<lastBuildDate>Fri, 15 Jul 2011 08:53:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Magi-Nation Search 0.7</title>
		<link>http://4.flowsnake.org/archives/583</link>
		<comments>http://4.flowsnake.org/archives/583#comments</comments>
		<pubDate>Sat, 13 Jun 2009 03:49:08 +0000</pubDate>
		<dc:creator>Hans Nowak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[magi-nation]]></category>

		<guid isPermaLink="false">http://4.flowsnake.org/?p=583</guid>
		<description><![CDATA[For what it&#8217;s worth, version 0.7 of Magi-Nation Search is online. This version contains all cards released in the US, including promos. (Or so it should be anyway&#8230; let me know if there are cards missing.) Also, it now has its own project page. (This is a modest start of the new project site, which [...]]]></description>
			<content:encoded><![CDATA[<p>For what it&#8217;s worth, version 0.7 of <a href="http://maginationsearch.appspot.com/">Magi-Nation Search</a> is online. This version contains all cards released in the US, including promos. (Or so it should be anyway&#8230; let me know if there are cards missing.)</p>
<p>Also, it now has its own <a href="http://projects.flowsnake.org/mnsearch.html">project page</a>. (This is a modest start of the new <a href="http://projects.flowsnake.org/">project site</a>, which should eventually replace the old <a href="http://zephyrfalcon.org/labs/">labs</a> page. Yes, it looks like ass in Internet Explorer&#8230; but then again, who uses IE nowadays anyway? :-)</p>
<p>(It&#8217;s small stuff, but I would love to do a version for <a href="http://l5r.alderac.com/">L5R</a>, or something, someday&#8230; ^_^)</p>
]]></content:encoded>
			<wfw:commentRss>http://4.flowsnake.org/archives/583/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magi-Nation Search</title>
		<link>http://4.flowsnake.org/archives/576</link>
		<comments>http://4.flowsnake.org/archives/576#comments</comments>
		<pubDate>Tue, 02 Jun 2009 00:57:36 +0000</pubDate>
		<dc:creator>Hans Nowak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[magi-nation]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://4.flowsnake.org/?p=576</guid>
		<description><![CDATA[Remember that old CCG Magi-Nation? Some kind soul has been working on a searchable card database (kind of like Gatherer for MtG) for this game&#8230; Magi-Nation Search. The site is still under construction, and a bit sluggish, but usable&#8230; and it uses Python as the query language! How cool is that? :-) Update: As it [...]]]></description>
			<content:encoded><![CDATA[<p>Remember that old CCG <a href="http://http://web.archive.org/web/20030206095504/www.magi-nation.com/Duel/">Magi-Nation</a>? Some kind soul has been working on a searchable card database (kind of like <a href="http://gatherer.wizards.com/Pages/Default.aspx">Gatherer</a> for MtG) for this game&#8230; <a href="http://maginationsearch.appspot.com/">Magi-Nation Search</a>. The site is still under construction, and a bit sluggish, but usable&#8230; and it uses Python as the query language! How cool is that? :-)</p>
<p><strong>Update:</strong> As it turns out, that version was dog slow, due to the initial loading of cards which took 14s on my machine. &gt;.&lt; A new version, which takes 0.5s, is available now.</p>
]]></content:encoded>
			<wfw:commentRss>http://4.flowsnake.org/archives/576/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Security</title>
		<link>http://4.flowsnake.org/archives/545</link>
		<comments>http://4.flowsnake.org/archives/545#comments</comments>
		<pubDate>Sun, 01 Mar 2009 12:30:46 +0000</pubDate>
		<dc:creator>Hans Nowak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://4.flowsnake.org/?p=545</guid>
		<description><![CDATA[This is great stuff: A Challenge To Break Python Security. The challenge is simple: Open a fresh Python interpreter and do: &#62;&#62;&#62; from safelite import FileReader You can use FileReader to read files on your filesystem Now find a way to write to the filesystem from your interpreter This has been discussed extensively for the [...]]]></description>
			<content:encoded><![CDATA[<p>This is great stuff: <a href="http://tav.espians.com/a-challenge-to-break-python-security.html">A Challenge To Break Python Security</a>.</p>
<blockquote><p>The challenge is simple:</p>
<ul>
<li> Open a fresh Python interpreter and do:
<pre class="doctest-block"><span class="doctest-input">&gt;&gt;&gt; from safelite import FileReader</span></pre>
</li>
<li>You can use <tt class="docutils literal"><span class="pre">FileReader</span></tt> to read files on your filesystem</li>
<li>Now find a way to <em>write</em> to the filesystem from your interpreter</li>
</ul>
</blockquote>
<p>This has been <a href="http://mail.python.org/pipermail/python-dev/2009-February/086401.html">discussed</a> extensively for the last few days on python-dev. It&#8217;s funny how code seems to be pretty secure at first glance, then someone comes up with another loophole.</p>
<p>It especially piqued my interest since I am working on yet another searchable card database, this time using Google App Engine. Kind of like <a href="http://ww2.wizards.com/gatherer/index.aspx?">Gatherer</a>, but for a different CCG than Magic, and (hopefully) more flexible. What does this have to do with security? Simple: the most flexible way to search cards is to store them as Python objects, then search them using a Python expression, e.g.</p>
<pre>card.red and card.black and (card.creature or card.instant) and card.cost &gt; 2</pre>
<p>&#8230;or, a more convoluted query:</p>
<pre>(card.red or card.black) and not card.multicolor \
and card.type == 'Dragon' and card.set.year &gt; 2006</pre>
<p>Now, executing an arbitary Python expression entered on a web page, is of course very unsafe. So I need to find ways to make it more secure, while still preserving the flexibility of a Python-based search. Although I&#8217;m not sure how much it matters in this particular case, because:</p>
<ul>
<li>According to the App Engine docs, <a href="http://code.google.com/appengine/docs/whatisgoogleappengine.html">an application cannot write to the system</a>, so no overwriting of files (?).</li>
</ul>
<ul>
<li>I&#8217;m not using the data store at all, and there is no user registration, so there&#8217;s no sensitive data to be accessed or manipulated.</li>
</ul>
<ul>
<li>Projects like <a href="http://www.trypython.org/">Try Python</a> and <a href="http://tryruby.hobix.com/">Try Ruby</a> seem to fare pretty well without imposing many restrictions on the user.</li>
</ul>
<p>That said, there might be other ways to mess with the site. Personally I don&#8217;t care if a user manages to screw up their own session due to malicious hackery, as long as it doesn&#8217;t affect other users. :-)</p>
<p>Anyway, the site isn&#8217;t ready yet, I still need to add more cards and flesh out the API. If you want to try it (locally), drop me a note, and I&#8217;ll send you the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://4.flowsnake.org/archives/545/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom filters in Google App Engine</title>
		<link>http://4.flowsnake.org/archives/459</link>
		<comments>http://4.flowsnake.org/archives/459#comments</comments>
		<pubDate>Tue, 20 Jan 2009 04:42:26 +0000</pubDate>
		<dc:creator>Hans Nowak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://4.flowsnake.org/?p=459</guid>
		<description><![CDATA[I wanted to add custom filters to my Google App Engine application&#8230; There are instructions on how to do this in several places, but some of them contradict each other, and it took me a little while to get it working. Anyway, I thought I&#8217;d share the setup that did the trick for me. Let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to add custom filters to my Google App Engine application&#8230; There are instructions on how to do this in several places, but some of them contradict each other, and it took me a little while to get it working. Anyway, I thought I&#8217;d share the setup that did the trick for me.</p>
<p>Let&#8217;s say your application is in a directory <em>app</em>. Create a directory <em>app/common</em>. Drop an empty <em>__init__.py</em> in it, and the file containing your filters; say, <em>my_filters.py</em>.</p>
<p>Here&#8217;s some sample code for <em>app/common/my_filters.py</em>:</p>
<pre>from google.appengine.ext import webapp

register = webapp.template.create_template_register()

@register.filter
def foobar(value):
    return "(%s)" % str(value)</pre>
<p>This creates a simple (and rather useless :-) filter named <em>foobar</em>, that takes an argument and returns its string values, surrounded by parentheses. <em>register.filter</em> can be used as a decorator. Any functions in the file that are not registered, will not be recognized as filters.</p>
<p>In the application&#8217;s main file, add the following (at the toplevel):</p>
<pre>from google.appengine.ext.webapp import template

template.register_template_library('common.my_filters')</pre>
<p>Now, in your templates, you should be able to do things like</p>
<pre>{{ "hello"|foobar }}</pre>
<p>That&#8217;s all. I saw some explanations online that talked about using the <em>templatetags</em> directory and such, but that doesn&#8217;t seem to be necessary with App Engine.</p>
]]></content:encoded>
			<wfw:commentRss>http://4.flowsnake.org/archives/459/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Random thought</title>
		<link>http://4.flowsnake.org/archives/385</link>
		<comments>http://4.flowsnake.org/archives/385#comments</comments>
		<pubDate>Wed, 31 Dec 2008 13:21:23 +0000</pubDate>
		<dc:creator>Hans Nowak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[idea]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scheme]]></category>

		<guid isPermaLink="false">http://4.flowsnake.org/?p=385</guid>
		<description><![CDATA[If I finish my Scheme interpreter (written in Python), and it comes out halfway decent, it would technically be possible to use Google App Engine with Scheme&#8230; *ponders*]]></description>
			<content:encoded><![CDATA[<p>If I finish my Scheme interpreter (written in Python), and it comes out halfway decent, it would technically be possible to use Google App Engine with Scheme&#8230;</p>
<p>*ponders*</p>
]]></content:encoded>
			<wfw:commentRss>http://4.flowsnake.org/archives/385/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>arrive(party, late)</title>
		<link>http://4.flowsnake.org/archives/380</link>
		<comments>http://4.flowsnake.org/archives/380#comments</comments>
		<pubDate>Tue, 30 Dec 2008 01:45:47 +0000</pubDate>
		<dc:creator>Hans Nowak</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[appengine]]></category>

		<guid isPermaLink="false">http://4.flowsnake.org/?p=380</guid>
		<description><![CDATA[For what it&#8217;s worth, I&#8217;ve been tinkering a bit with Google App Engine. So far I like it&#8230; I especially appreciate that I can focus on writing Python code, rather than having to work around a traditional database&#8217;s rigidity. (You know&#8230; creating a database schema, and a model in an ORM to mimick it, then [...]]]></description>
			<content:encoded><![CDATA[<p>For what it&#8217;s worth, I&#8217;ve been tinkering a bit with Google App Engine. So far I like it&#8230; I especially appreciate that I can focus on writing Python code, rather than having to work around a traditional database&#8217;s rigidity. (You know&#8230; creating a database schema, and a model in an ORM to mimick it, then keeping them in sync, all the while pretending that you&#8217;re storing and retrieving objects rather than rows in tables.)</p>
<p>Of course, for all I know GAE does exactly that behind the scenes, but it *feels* different. So far, I find it much more pleasant to work with than &#8220;regular&#8221; web application frameworks. Maybe this statement reveals my inexperience with web programming, but still, that&#8217;s what it feels like right now. :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://4.flowsnake.org/archives/380/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

