<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Simple &#8216;on-server&#8217; mobile AJAX in Django</title>
	<atom:link href="http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/feed/" rel="self" type="application/rss+xml" />
	<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/</link>
	<description>Living the mobile dream</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:39:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Mike</title>
		<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/comment-page-1/#comment-1390</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Tue, 09 Nov 2010 20:08:58 +0000</pubDate>
		<guid isPermaLink="false">http://tripleodeon.com/?p=318#comment-1390</guid>
		<description>I found your blog on bing and will bookmark it now. Keep up the nice work.</description>
		<content:encoded><![CDATA[<p>I found your blog on bing and will bookmark it now. Keep up the nice work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/comment-page-1/#comment-15</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 21 Jul 2009 09:22:44 +0000</pubDate>
		<guid isPermaLink="false">http://tripleodeon.com/?p=318#comment-15</guid>
		<description>That&#039;s pretty nifty.

It&#039;s things like this that make me love Django :)

I was thinking of extending the built in Template object and render_to_response function to decide which template to use (mobile, json, xml, desktop etc.), meaning you could take that little bit of code out of your views.</description>
		<content:encoded><![CDATA[<p>That&#8217;s pretty nifty.</p>
<p>It&#8217;s things like this that make me love Django <img src='http://tripleodeon.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I was thinking of extending the built in Template object and render_to_response function to decide which template to use (mobile, json, xml, desktop etc.), meaning you could take that little bit of code out of your views.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/comment-page-1/#comment-10</link>
		<dc:creator>James</dc:creator>
		<pubDate>Sun, 19 Jul 2009 05:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://tripleodeon.com/?p=318#comment-10</guid>
		<description>Hi Steve,

w.r.t. to mobilization, I use middleware that decides which page to display (based on &lt;a href=&#039;http://mobiforge.com/designing/story/a-very-modern-mobile-switching-algorithm-part-i&#039; rel=&quot;nofollow&quot;&gt;this algorithm&lt;/a&gt;) and then pops its decision into the request object.

A context processor then puts the master mobile-or-desktop template name into a universal context variable called page_template, and then my page.html template (which all pages derive from) is literally just:

{%extends page_template%}

(NB: page_template is a variable, not a literal - that&#039;s the trick)

I then just need something like page.mobile.html and page.desktop.html with the appropriate skeleton of the two types of page (but with mostly the same key blocks), that this extends tag will refer to.

... in other words I am able to dictate the top-level look from the incoming request without doing anything too unnatural with respect to templates and settings :-)

I need to write this up I guess.</description>
		<content:encoded><![CDATA[<p>Hi Steve,</p>
<p>w.r.t. to mobilization, I use middleware that decides which page to display (based on <a href='http://mobiforge.com/designing/story/a-very-modern-mobile-switching-algorithm-part-i' rel="nofollow">this algorithm</a>) and then pops its decision into the request object.</p>
<p>A context processor then puts the master mobile-or-desktop template name into a universal context variable called page_template, and then my page.html template (which all pages derive from) is literally just:</p>
<p>{%extends page_template%}</p>
<p>(NB: page_template is a variable, not a literal &#8211; that&#8217;s the trick)</p>
<p>I then just need something like page.mobile.html and page.desktop.html with the appropriate skeleton of the two types of page (but with mostly the same key blocks), that this extends tag will refer to.</p>
<p>&#8230; in other words I am able to dictate the top-level look from the incoming request without doing anything too unnatural with respect to templates and settings <img src='http://tripleodeon.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I need to write this up I guess.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Anderson</title>
		<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/comment-page-1/#comment-11</link>
		<dc:creator>Steve Anderson</dc:creator>
		<pubDate>Thu, 16 Jul 2009 22:04:38 +0000</pubDate>
		<guid isPermaLink="false">http://tripleodeon.com/?p=318#comment-11</guid>
		<description>I&#039;ve just realized that you actually do this in quite a nice way, by building up the string in your view and calling render on the correct template. Makes sense. I must have misread.

Even so, it&#039;s handy to know about changing settings on the fly being dangerous.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve just realized that you actually do this in quite a nice way, by building up the string in your view and calling render on the correct template. Makes sense. I must have misread.</p>
<p>Even so, it&#8217;s handy to know about changing settings on the fly being dangerous.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Anderson</title>
		<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/comment-page-1/#comment-12</link>
		<dc:creator>Steve Anderson</dc:creator>
		<pubDate>Thu, 16 Jul 2009 22:01:45 +0000</pubDate>
		<guid isPermaLink="false">http://tripleodeon.com/?p=318#comment-12</guid>
		<description>One thing to be wary of with Django, is that switching templates in real time based on the request is NOT THREAD SAFE, and you must be extremely careful to reset any settings that you modify at runtime. The Django docs (http://docs.djangoproject.com/en/dev/topics/settings/#altering-settings-at-runtime) display a very mysterious message simply telling us never to do anything of the sort, but don&#039;t really explain why!

This talk by Simon Willison sums up a few of the annoying things about settings.py, one of which being that changing settings at runtime is not thread safe - http://simonwillison.net/2009/talks/eurodjangocon-heresies/.

I unfortunately learned this when trying to write my own mobilization middleware for Django (http://www.djangosnippets.org/snippets/1437/). I&#039;m still looking for a decent way to do dynamic template switching with Django, but the globalness of settings.py makes this a bit difficult.

Simon has suggested some improvements (http://simonwillison.net/2009/May/19/djng/), but of course this involves some significant reworking of the Django core.

I think we definitely need to look into a better way of doing this for Django, as it is a growing need of a lot of apps built in the framework. It&#039;d be good to hear your thoughts...</description>
		<content:encoded><![CDATA[<p>One thing to be wary of with Django, is that switching templates in real time based on the request is NOT THREAD SAFE, and you must be extremely careful to reset any settings that you modify at runtime. The Django docs (<a href="http://docs.djangoproject.com/en/dev/topics/settings/#altering-settings-at-runtime" rel="nofollow">http://docs.djangoproject.com/en/dev/topics/settings/#altering-settings-at-runtime</a>) display a very mysterious message simply telling us never to do anything of the sort, but don&#8217;t really explain why!</p>
<p>This talk by Simon Willison sums up a few of the annoying things about settings.py, one of which being that changing settings at runtime is not thread safe &#8211; <a href="http://simonwillison.net/2009/talks/eurodjangocon-heresies/" rel="nofollow">http://simonwillison.net/2009/talks/eurodjangocon-heresies/</a>.</p>
<p>I unfortunately learned this when trying to write my own mobilization middleware for Django (<a href="http://www.djangosnippets.org/snippets/1437/" rel="nofollow">http://www.djangosnippets.org/snippets/1437/</a>). I&#8217;m still looking for a decent way to do dynamic template switching with Django, but the globalness of settings.py makes this a bit difficult.</p>
<p>Simon has suggested some improvements (<a href="http://simonwillison.net/2009/May/19/djng/" rel="nofollow">http://simonwillison.net/2009/May/19/djng/</a>), but of course this involves some significant reworking of the Django core.</p>
<p>I think we definitely need to look into a better way of doing this for Django, as it is a growing need of a lot of apps built in the framework. It&#8217;d be good to hear your thoughts&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/comment-page-1/#comment-14</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Wed, 17 Jun 2009 13:19:17 +0000</pubDate>
		<guid isPermaLink="false">http://tripleodeon.com/?p=318#comment-14</guid>
		<description>Neat. I think this approach has applications beyond the mobile/XHR context, too, though they may not be quite as interesting. Could eliminate the need for custom inclusion tags in some cases.

Specifying output format via filename extension is simple and REST-y. Takes me back to the first piece of software I saw that did that dynamically and well: Blosxom.

(Found this via the Djangosnippets Twitter feed, BTW.)</description>
		<content:encoded><![CDATA[<p>Neat. I think this approach has applications beyond the mobile/XHR context, too, though they may not be quite as interesting. Could eliminate the need for custom inclusion tags in some cases.</p>
<p>Specifying output format via filename extension is simple and REST-y. Takes me back to the first piece of software I saw that did that dynamically and well: Blosxom.</p>
<p>(Found this via the Djangosnippets Twitter feed, BTW.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Rieger</title>
		<link>http://tripleodeon.com/2009/06/simple-on-server-mobile-ajax-in-django/comment-page-1/#comment-13</link>
		<dc:creator>Bryan Rieger</dc:creator>
		<pubDate>Wed, 17 Jun 2009 11:59:48 +0000</pubDate>
		<guid isPermaLink="false">http://tripleodeon.com/?p=318#comment-13</guid>
		<description>Very nice idea indeed. I the fact that you&#039;re still able to support both clients with and without Javascript using this approach.

BTW - nice note on http://ivyroot.com ;)</description>
		<content:encoded><![CDATA[<p>Very nice idea indeed. I the fact that you&#8217;re still able to support both clients with and without Javascript using this approach.</p>
<p>BTW &#8211; nice note on <a href="http://ivyroot.com" rel="nofollow">http://ivyroot.com</a> <img src='http://tripleodeon.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

