<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>yergler.net &#187; development</title>
	<atom:link href="http://yergler.net/blog/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://yergler.net</link>
	<description>Because eventually I&#039;ll be right. Theoretically.</description>
	<lastBuildDate>Wed, 23 May 2012 01:10:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Unicode output from Zope 3</title>
		<link>http://yergler.net/blog/2008/07/19/unicode-output-from-zope-3/</link>
		<comments>http://yergler.net/blog/2008/07/19/unicode-output-from-zope-3/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 19:57:33 +0000</pubDate>
		<dc:creator>Nathan Yergler</dc:creator>
				<category><![CDATA[cc]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[license engine]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://yergler.net/blog/?p=563</guid>
		<description><![CDATA[The Creative Commons licene engine has gone through several iterations, the most recent being a Zope 3 / Grok application. This has actually been a great implementation for us[1], but since the day it was deployed there&#8217;s been a warning in README.txt: If you get a UnicodeDecodeError from the cc.engine (you'll see this if it's [...]]]></description>
			<content:encoded><![CDATA[<p>The Creative Commons licene engine has gone through several iterations, the most recent being a Zope 3 / Grok application. This has actually been a great implementation for us[1], but since the day it was deployed there&#8217;s been a warning in <a href="http://code.creativecommons.org/svnroot/cc.engine/trunk/README.txt"><code>README.txt</code></a>:</p>
<pre>
If you get a UnicodeDecodeError from the cc.engine (you'll see this if it's
running in the foreground) when you try to access the http://host:9080/license/
then it's likely that the install of python you are using is set to use ASCII
as it's default output.  You can change this to UTF-8 by creating the file
/usr/lib/python&lt;version&gt;/sitecustomize.py and adding these lines:

  import sys
  sys.setdefaultencoding("utf-8")
</pre>
<p>This always struck me as a bit inelegant &#8212; having to muck with something outside my application directory.  After all, this belief that the application should be self-contained is the reason I use <a href="http://pypi.python.org/zc.buildout">zc.buildout</a> and share Jim&#8217;s belief in the evil of the system Python.  Like a lot of inelegant things, though, it never rose quite to the level of annoyance needed to motivate me to <em>do it right</em>.</p>
<p>Today I was working on moving the license engine to a different server[2] and ran into this problem again.  I decided to dig in and see if I could track it down.  In fact I did track down the initial problem &#8212; I was <a href="http://code.creativecommons.org/viewsvn?view=rev&#038;revision=10535">making a comparison</a> between an encoded Unicode string and without specifying an explicit codec to use for the decode.  Unfortunately once I fixed that I found it was <a href="http://en.wikipedia.org/wiki/Turtles_all_the_way_down">turtles all the way down</a>.</p>
<p>Turns out the default Zope 3 page template machinery uses <a href="http://www.python.org/doc/lib/module-StringIO.html"><code>StringIO</code></a> to collect the output.  <code>StringIO</code> uses, uh, strings &#8212; strings with the default system encoding.  Reading the module documentation, it would appear that mixing String and Unicode input in your StringIO will cause this sort of issue.</p>
<p>Andres suggested marking my templates as UTF-8 XML using something like:</p>
<pre>
 < ?xml version="1.0" encoding="UTF-8" ?>
</pre>
<p>but even after doing this and fixing the resulting entity errors, there&#8217;s still obviously some 8 bit Strings leaking into the output.  In conversations on IRC the question was then asked: &#8220;is there a reason you don&#8217;t want a reasonable system wide encoding if your locale can support it?&#8221;</p>
<p>I guess not[3].</p>
<p><strong>UPDATE</strong> Martijn has a tangentially related <a href="http://faassen.n--tree.net/blog/view/weblog/2005/08/02/0">post</a> which sheds some light on why Python does/should ship with <code>ascii</code> as the default codec.  At least people smarter than me have problems with this sort of thing, too.</p>
<hr noshade />
<p>fn1. Yes, I may be a bit biased &#8212; I wrote the Zope3/Grok implementation.  Of course, I wrote the previous implementation, too, and I can say without a doubt it was&#8230; <em>&#8220;sub-optimal&#8221;</em>.</p>
<p>fn2. We&#8217;re doing a lot of shuffling lately to complete a 32 to 64 bit conversion; see the <a href="http://labs.creativecommons.org/2008/07/15/32-to-64bit-remotely/">CC Labs blog post</a> for the harrowing details.</p>
<p>fn3. So the warning remains.</p>
]]></content:encoded>
			<wfw:commentRss>http://yergler.net/blog/2008/07/19/unicode-output-from-zope-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sane Merging in SVN</title>
		<link>http://yergler.net/blog/2007/11/06/sane-merging-in-svn/</link>
		<comments>http://yergler.net/blog/2007/11/06/sane-merging-in-svn/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 18:32:25 +0000</pubDate>
		<dc:creator>Nathan Yergler</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://yergler.net/blog/2007/11/06/sane-merging-in-svn/</guid>
		<description><![CDATA[We use &#8220;Subversion&#8221;:http://subversion.tigris.org for &#8220;version control&#8221;:http://en.wikipedia.org/wiki/Revision_control at &#8220;work&#8221;:http://creativecommons.org. We try to version control everything: code, content, graphics, site configuration. &#8220;Everything&#8221;:http://cctools.svn.sourceforge.net. This does wonders for our sanity, but we can do more. Recently (n < 6 months)) we&#8217;ve started doing something we should have done from Day 1: develop in one tree, deploy in another. In [...]]]></description>
			<content:encoded><![CDATA[<p>We use &#8220;Subversion&#8221;:http://subversion.tigris.org for &#8220;version control&#8221;:http://en.wikipedia.org/wiki/Revision_control at &#8220;work&#8221;:http://creativecommons.org.  We try to version control everything: code, content, graphics, site configuration.  &#8220;Everything&#8221;:http://cctools.svn.sourceforge.net.  This does wonders for our sanity, but we can do more.  Recently (<code>n < 6</code> months)</code>) we&#8217;ve started doing something we should have done from Day 1: develop in one tree, deploy in another.  In our case we&#8217;re developing in the <code>trunk</code>, and there&#8217;s a long-lived branch cleverly named <code>production</code>.  This is great, with one little problem: cherry-picking revisions to merge in Subversion is a pain in the ass.</p>
<p>Last week I was looking at the &#8220;upcoming features&#8221;:http://subversion.tigris.org/roadmap.html in Subversion 1.5.  &#8220;Asheesh&#8221;:http://asheesh.org/note/ had pointed out the &#8220;merge tracking&#8221;:http://subversion.tigris.org/merge-tracking/ feature, which sounded lovely.  And it probably will be.  The thing I discovered, though, is that you can get it today in the form of &#8220;svnmerge&#8221;:http://www.orcaware.com/svn/wiki/Svnmerge.py.</p>
<p><code>svnmerge</code> allows you to track what revisions you&#8217;ve merged from a branch (or trunk), block certain revisions (features you might not want to deploy just yet), and performs the merges for you when that time arrives (including generating a nice commit message containing all the log messages you&#8217;re merging; handy).  I spent an hour yesterday and an hour today getting the merges recorded for the packages I&#8217;m currently working on, and it already feels better.  No more wondering if I remembered to merge something; just <code>svnmerge avail</code> and see if anything shows up.</p>
<p>Sure, it&#8217;ll be great to get this feature into the core application (and an interactive mode ala &#8220;darcs&#8221;:http://darcs.net would be slick, too), but to paraphrase Scarlett O&#8217;Hara, &#8220;with god as my witness, I will never <code>svn merge</code> again&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://yergler.net/blog/2007/11/06/sane-merging-in-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

