<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Fragments of Code</title>
	<atom:link href="http://fragmentsofcode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://fragmentsofcode.wordpress.com</link>
	<description>Some assembly required</description>
	<lastBuildDate>Mon, 12 Oct 2009 17:12:01 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='fragmentsofcode.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/8dc26754fcbb8bef13f8c73bd8b27539?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Fragments of Code</title>
		<link>http://fragmentsofcode.wordpress.com</link>
	</image>
			<item>
		<title>xlwt convenience methods</title>
		<link>http://fragmentsofcode.wordpress.com/2009/10/09/xlwt-convenience-methods/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/10/09/xlwt-convenience-methods/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 17:31:54 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[xlwt]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=363</guid>
		<description><![CDATA[As I started using xlwt, I found myself wanting some more convenient methods for dumping tabular data into a worksheet, especially when all the data can be treated as strings.  Tabular data in this context is an iterable of iterables, such as a list of tuples.
Here&#8217;s what I&#8217;ve got so far:
"""Excel utilities.

'Tabular data' in this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=363&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As I started using <a href="http://www.python-excel.org/">xlwt</a>, I found myself wanting some more convenient methods for dumping tabular data into a worksheet, especially when all the data can be treated as strings.  Tabular data in this context is an iterable of iterables, such as a list of tuples.</p>
<p>Here&#8217;s what I&#8217;ve got so far:</p>
<pre>"""Excel utilities.

'Tabular data' in this context is an iterable of iterables.
"""

import xlwt

def to_workbook(tabular_data, workbook=None, sheetname=None):
    """
    Returns the Excel workbook (creating a new workbook
    if necessary) with the tabular data written to a worksheet
    with the name passed in the 'sheetname' parameter (or a
    default value if sheetname is None or empty).
    """
    wb = workbook or xlwt.Workbook()
    ws = wb.add_sheet(sheetname or 'Data')
    to_worksheet(tabular_data, ws)
    return wb

def to_worksheet(tabular_data, worksheet):
    """
    Writes the tabular data to the worksheet (returns None).
    Thanks to John Machin for the tip on using enumerate().
    """
    for row_index, row_data in enumerate(tabular_data):
        worksheet_row = worksheet.row(row_index)
        for col_index, col_data in enumerate(row_data):
            worksheet_row.write(col_index, col_data)
</pre>
<p>In a Django context, then, you have a very straightforward way turning a query into an Excel file using the <code>values_list()</code> QuerySet method, e.g.:</p>
<pre>wb = to_workbook(MyModel.objects.values_list())</pre>
<p>Since <code>values_list()</code> outputs the attribute values for each object in the same order in which they&#8217;re defined in the model class, you can insert a row of headings to your table:</p>
<pre>
table = MyModel.objects.values_list()
headings = [f.name for f in MyModel._meta.fields]
table.insert(0, headings)
wb = to_workbook(table)
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/363/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/363/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=363&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/10/09/xlwt-convenience-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>A Generic context processor for Django settings</title>
		<link>http://fragmentsofcode.wordpress.com/2009/09/15/a-generic-context-processor-for-django-settings/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/09/15/a-generic-context-processor-for-django-settings/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 01:01:22 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[context processors]]></category>
		<category><![CDATA[settings]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=361</guid>
		<description><![CDATA[I found myself creating a number of simple custom context processors which simply return custom settings that I have added to my Django settings module (I actually keep these custom settings in my_settings.py and import then into settings.py, just to keep them separate).  I decided it was a good idea to add exception handling to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=361&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I found myself creating a number of simple custom context processors which simply return custom settings that I have added to my Django settings module (I actually keep these custom settings in <code>my_settings.py</code> and import then into <code>settings.py</code>, just to keep them separate).  I decided it was a good idea to add exception handling to these functions so that I would get a useful error message if I tried to use a particular context processor without implementing its required setting(s).  So, after some refactoring, I came up with this:</p>
<pre>from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

class SettingsContextProcessor(object):
    """
    Class for creating simple context processors that
    return one or more Django settings.
    """

    def __init__(self, *setting_names):
        self.setting_names = setting_names

    def __call__(self, request):
        extra_context = {}
        for sn in self.setting_names:
            try:
                extra_context[sn] = getattr(settings, sn)
            except AttributeError, e:
                raise ImproperlyConfigured('Missing required setting: %s' % sn)
        return extra_context</pre>
<p>Now I can create custom settings-based context processors like this:</p>
<pre>google_analytics = SettingsContextProcessor('GOOGLE_ANALYTICS_PROFILE_ID')
jquery = SettingsContextProcessor('JQUERY_VERSION')
jqueryui = SettingsContextProcessor('JQUERYUI_VERSION')
static_media = SettingsContextProcessor('STATIC_MEDIA_URL')
yui = SettingsContextProcessor('YUI_VERSION')</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/361/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/361/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/361/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=361&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/09/15/a-generic-context-processor-for-django-settings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>Disable WordPress Flash Uploader with Apache</title>
		<link>http://fragmentsofcode.wordpress.com/2009/09/10/disable-wordpress-flash-uploader-with-apache/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/09/10/disable-wordpress-flash-uploader-with-apache/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 15:13:14 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=351</guid>
		<description><![CDATA[OK, this doesn&#8217;t really disable it, but it does make the &#8220;browser uploader&#8221; the default &#8230;
&#60;Directory /path/to/wp/wp-admin&#62;
  &#60;Files media-new.php&#62;
    # Force browser uploader instead of Flash
    RewriteCond %{QUERY_STRING} !=flash=0
    RewriteRule ^/(.*) /$1?flash=0
  &#60;/Files&#62;
&#60;/Directory&#62;
(WordPress 2.8.4)
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=351&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>OK, this doesn&#8217;t really disable it, but it does make the &#8220;browser uploader&#8221; the default &#8230;</p>
<pre>&lt;Directory /path/to/wp/wp-admin&gt;
  &lt;Files media-new.php&gt;
    # Force browser uploader instead of Flash
    RewriteCond %{QUERY_STRING} !=flash=0
    RewriteRule ^/(.*) /$1?flash=0
  &lt;/Files&gt;
&lt;/Directory&gt;</pre>
<p>(WordPress 2.8.4)</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/351/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=351&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/09/10/disable-wordpress-flash-uploader-with-apache/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>Django&#8217;s Achilles&#8217; Heel</title>
		<link>http://fragmentsofcode.wordpress.com/2009/08/21/djangos-achilles-heel/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/08/21/djangos-achilles-heel/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 15:10:49 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=347</guid>
		<description><![CDATA[It should clear from this blog that I&#8217;m a big fan of Django.  I use it for as much of my work as possible.  Recently a couple of other developers in my shop have entered the Django arena, which, as a general proposition, is a good thing &#8212; in that we&#8217;re using the framework more [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=347&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It should clear from this blog that I&#8217;m a big fan of Django.  I use it for as much of my work as possible.  Recently a couple of other developers in my shop have entered the Django arena, which, as a general proposition, is a good thing &#8212; in that we&#8217;re using the framework more widely.  But as a result, one of Django&#8217;s few weaknesses has been made more painfully obvious, namely, the fragility of Django projects.</p>
<p>The problem is that one import error in any installed app&#8217;s models, any referenced URLconf, view module, or other module imported by one of those breaks the entire project immediately and horribly.  This makes the installation of new apps and updates of installed apps inherently risky to the entire site, which IMO is a *bad thing*.  Now, I haven&#8217;t delved into the guts of Django&#8217;s initialization process to see what, if anything, could be done about this, but on a conceptual level it seems that the project as a whole should have some way to recover from a bad app or module, unless it&#8217;s related to the core functionality of the project (like a middleware or context processor module).</p>
<p>Is that unreasonable?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/347/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=347&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/08/21/djangos-achilles-heel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>Django and Web Services</title>
		<link>http://fragmentsofcode.wordpress.com/2009/08/02/django-and-web-services/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/08/02/django-and-web-services/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 00:17:57 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[lxml]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XML-RPC]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=340</guid>
		<description><![CDATA[Or, developing Django data applications without a database.
In recent months I have been working intensively on a user interface to a data store that lives behind a web services API.  While this might not be considered a natural fit for Django, the smart de-coupling of URLs, views, and templates from data models means that the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=340&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Or, developing Django data applications without a database.</strong></p>
<p>In recent months I have been working intensively on a user interface to a data store that lives behind a web services API.  While this might not be considered a natural fit for Django, the smart de-coupling of URLs, views, and templates from data models means that the former retain their value even without the latter.  And hey, it&#8217;s all just Python, right?  Django models are just one way to handle data in your application, albeit a very convenient and powerful one when dealing with an RDBMS.</p>
<p>Before working on this project, I had already developed two other Django apps based on data sources accessed via HTTP, both of which were read-only, which of course made things quite a bit simpler.  The first of these was an XML-RPC interface (built with <a href="https://launchpad.net/django-xmlrpc">django_xmlrpc</a>, Python&#8217;s standard xmlrpclib module and <a href="http://pypi.python.org/pypi/python-ldap/">python-ldap</a>) to an LDAP directory.  I manage user and group information for a number of staff applications, including Django itself, for which it is very useful to draw upon a central source of personnel data.  The Django-based service provides convenient methods for common operations while hiding the complexities of LDAP connections and search queries.</p>
<p>The second app dealt with requests to web services of a library catalog which return content in a custom XML format.  Since only HTTP GET requests were required, I used Python&#8217;s standard urllib and urllib2 modules for the request/response handling, and <a href="http://codespeak.net/lxml/">lxml.etree</a> for the XML parsing and XSLT application (see also my <a href="http://fragmentsofcode.wordpress.com/2009/03/13/lxml-makes-xml-almost-fun/">previous post on the virtues of lxml</a>).</p>
<p>The current project, as opposed to the previous two, involves both read and write actions on the backend data store.  Also, because the web services API implements a REST architecture, the &#8220;client&#8221; code I was tasked with has to support a wider range of HTTP request methods (not just GET and POST) and responses.  Finally, the client code stack includes a full-blown user interface (the ultimate purpose of the app) for managing the backend data.  In my next post, I&#8217;ll talk about how I broke down the problem.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/340/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/340/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=340&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/08/02/django-and-web-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>Tweaking Django auth admin</title>
		<link>http://fragmentsofcode.wordpress.com/2009/05/26/tweaking-django-auth-admin/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/05/26/tweaking-django-auth-admin/#comments</comments>
		<pubDate>Tue, 26 May 2009 15:40:56 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[authentication]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=333</guid>
		<description><![CDATA[So, I wanted one of those horizontal multi-selects with &#8220;available&#8221; and &#8220;chosen&#8221; boxes to associate users with groups in the Django auth admin UI.  Turns out it all I had to do was import the UserAdmin class from django.contrib.auth.admin and override the filter_horizontal attribute:
from django.contrib.auth.admin import UserAdmin
UserAdmin.filter_horizontal = (&#8216;user_permissions&#8217;, &#8216;groups&#8217;)

from django.contrib.auth.admin import UserAdmin

UserAdmin.filter_horizontal = ('user_permissions', [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=333&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So, I wanted one of those horizontal multi-selects with &#8220;available&#8221; and &#8220;chosen&#8221; boxes to associate users with groups in the Django auth admin UI.  Turns out it all I had to do was import the UserAdmin class from django.contrib.auth.admin and override the filter_horizontal attribute:</p>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">from django.contrib.auth.admin import UserAdmin</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">UserAdmin.filter_horizontal = (&#8216;user_permissions&#8217;, &#8216;groups&#8217;)</div>
<pre>
from django.contrib.auth.admin import UserAdmin

UserAdmin.filter_horizontal = ('user_permissions', 'groups')</pre>
<p>Since importing the UserAdmin class runs the admin module from django.contrib.auth, the UserAdmin and GroupAdmin classes are registered for the admin site.  All I have to do then is import my custom admin module in my URLconf instead of the one from django.contrib.auth to make sure my customizations are applied in my admin site.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/333/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=333&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/05/26/tweaking-django-auth-admin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>Vista x64 challenges</title>
		<link>http://fragmentsofcode.wordpress.com/2009/03/14/vista-x64-challenges/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/03/14/vista-x64-challenges/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 16:44:15 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OpenOffice.org]]></category>
		<category><![CDATA[Vista]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=320</guid>
		<description><![CDATA[On balance I&#8217;m satisfied with Vista x64, but I&#8217;ve run into a few challenges and at least one casualty.
The casualty was my Palm Tungsten E2, which can&#8217;t connect to Vista64 with the USB cable.  According to Palm, you can connect with Bluetooth, but I don&#8217;t have Bluetooth on the computer.  Fortunately I don&#8217;t use the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=320&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>On balance I&#8217;m satisfied with Vista x64, but I&#8217;ve run into a few challenges and at least one casualty.</p>
<p>The casualty was my <strong>Palm Tungsten E2</strong>, which can&#8217;t connect to Vista64 with the USB cable.  <a href="http://kb.palm.com/SRVS/NUA/launchKB.asp?c=44532">According to Palm</a>, you can connect with Bluetooth, but I don&#8217;t have Bluetooth on the computer.  Fortunately I don&#8217;t use the Palm much anymore and I synced mainly to back it up.</p>
<p>As for the challenges, it seems that some applications, notably <strong>OpenOffice.org 3</strong>, have to be installed using XP-SP2 compatibility mode.  Also, some installation software doesn&#8217;t trigger privilege elevation which may be required to write to certain registry keys or system folders, so the &#8220;Run as Administrator&#8221; and &#8220;CMD prompt here as administrator&#8221; <strong><a href="http://technet.microsoft.com/en-us/magazine/2008.06.elevation.aspx">Elevation PowerToys</a></strong> are practically necessary.  <strong>Sun&#8217;s Java RE</strong> (which I probably wouldn&#8217;t install except that it&#8217;s a dependency of OOo) has an <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6747132">annoying bug</a> in it&#8217;s control panel such that you can&#8217;t change the settings, so you can&#8217;t disable automatic updating.  The workaround is to run <strong>bin/javacpl.exe</strong> as administrator using the Elevation PowerToy.  Using <strong>32-bit Windows help files </strong>(.hlp) requires a <a href="http://support.microsoft.com/kb/917607">special download</a> (this affects all Vista versions) as Microsoft is no longer updating the older help program and so doesn&#8217;t distribute it with the OS.  Only two of the four buttons on my <strong>Kensington Expert Trackball Mouse</strong> work, and Vista thinks it&#8217;s a regular mouse &#8212; but it wasn&#8217;t working fully under XP-SP3 either.  Don&#8217;t bother to install the MouseWorks software, although some folks claim they&#8217;ve gotten it work (or at least the OS to use the driver).  I would guess at this point Kensington isn&#8217;t going to release a Vista-compatible driver for the older devices.</p>
<p>I can live with two buttons.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/320/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/320/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/320/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/320/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/320/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/320/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/320/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/320/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/320/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/320/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=320&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/03/14/vista-x64-challenges/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>lxml makes XML (almost) fun</title>
		<link>http://fragmentsofcode.wordpress.com/2009/03/13/lxml-makes-xml-almost-fun/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/03/13/lxml-makes-xml-almost-fun/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 01:11:44 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[lxml]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/2009/03/13/lxml-makes-xml-almost-fun/</guid>
		<description><![CDATA[Working with XML isn’t my favorite task. Sure, I get why it’s useful for data transfer, but I’d rather deal with an interface that hides the gory details … meaning the raw XML.  Of course, sometimes that isn’t possible.  The Python standard library modules as of version 2.4 only offers the DOM and SAX APIs, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=311&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Working with XML isn’t my favorite task. Sure, I get why it’s useful for data transfer, but I’d rather deal with an interface that hides the gory details … meaning the raw XML.  Of course, sometimes that isn’t possible.  The Python standard library modules as of version 2.4 only offers the DOM and SAX APIs, which, while useful, just don’t offer enough power and flexibility to do ad hoc XML processing without significant pain, at least for the casual user. Python 2.5 adds the ElementTree API (xml.etree.ElementTree), but we’re still missing full XPath and XSLT support.</p>
<p>In steps <a href="http://codespeak.net/lxml/">lxml</a>, a library that really makes everything else obsolete. Prior to lxml there was <a href="http://sourceforge.net/projects/foursuite/">4Suite</a>, but its latest release was posted in December 2006 and the project appears to be dead.  Fortunately, lxml runs on Python 2.3 or later (I’m stuck on 2.4 for the time being).  The only hiccup, depending on your environment, can be getting the C dependencies installed – libxml and libxslt. But if you’re going to do some serious work with XML, it’s worth the effort to get lxml installed.  You won’t want to go back.</p>
<p><strong>DOM</strong></p>
<pre>&gt;&gt;&gt; xmlsrc = '&lt;root&gt;&lt;element&gt;text&lt;/element&gt;&lt;/root&gt;'
&gt;&gt;&gt; from xml.dom.minidom import parseString
&gt;&gt;&gt; parseString(xmlsrc).getElementsByTagName('element')[0].firstChild.nodeValue
u'text'</pre>
<p>Yikes!</p>
<p><strong>lxml</strong></p>
<pre>&gt;&gt;&gt; xml = '&lt;root&gt;&lt;element&gt;text&lt;/element&gt;&lt;/root&gt;'
&gt;&gt;&gt; from lxml import etree
&gt;&gt;&gt; etree.fromstring(xml).findtext('//element')
'text'</pre>
<p>Ahh &#8230; better.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/311/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=311&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/03/13/lxml-makes-xml-almost-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>Django gotcha: related objects deleted by default</title>
		<link>http://fragmentsofcode.wordpress.com/2009/03/06/django-gotcha-related-objects-deleted-by-default/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/03/06/django-gotcha-related-objects-deleted-by-default/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 02:19:35 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=296</guid>
		<description><![CDATA[I discovered &#8220;accidentally&#8221; recently that the Django model delete() method not only deletes the model instance, but all its related objects &#8212; at least those which are related to the original object via a ForeignKey field.  (The source code is so labyrinthine that I gave up trying to determine exactly what it does.)  This is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=296&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I discovered &#8220;accidentally&#8221; recently that the Django model delete() method not only deletes the model instance, but all its related objects &#8212; at least those which are related to the original object via a ForeignKey field.  (The source code is so labyrinthine that I gave up trying to determine exactly what it does.)  This is not necessarily a bad thing; many times it&#8217;s exactly what you want to preserve the &#8220;referential integrity&#8221; of your data.  For instance, if you have some kind of &#8220;collection&#8221; object and a number of &#8220;item&#8221; objects which are related to it in a one-to-many relationship, it&#8217;s reasonable to expect that when the collection is deleted, the related items are also deleted.</p>
<p>Now, in the Django admin app, when you click the button to delete an item you get a helpful warning informing you of all the other objects you will delete if you proceed.  But what if you&#8217;re using the API directly?  No warning there, it just whacks the whole lot.  At first I thought maybe this was an ORM thing, but it&#8217;s not.  In fact it has nothing to do with the backend database: Django manually fetches all the related objects and deletes them.  For example, in my case the backend is MySQL 5.0 and MyISAM tables.  In MySQL 5.0 only InnoDB tables support foreign key constraints; MyISAM tables will parse the syntax but do nothing with it.  In any case, the constraints that Django generates do not include an ON DELETE clause, so MySQL 5.0 would use &#8220;RESTRICT&#8221; as the default value, meaning that the database will not allow the deletion of a row from the &#8220;parent&#8221; table if the primary key value exists in the referenced foreign key of a row in the related table.  I suppose that&#8217;s good as far as it goes, but you shouldn&#8217;t be messing with the database directly, right?  Anyway, that&#8217;s not relevant because we&#8217;re not talking about raw SQL commands, but the Django model API methods.</p>
<p>So, there&#8217;s an <a href="http://code.djangoproject.com/ticket/7539">outstanding proposal</a> to add keyword arguments to the ForeignKey model field to control how DELETE and UPDATE on the parent model affect the related model.  The status of the proposal is unclear and there hasn&#8217;t been a lot of serious discussion on the mailing lists AFAICT.  I would guess that since you can override the delete() method on a per-model basis, and presumably other issues are more pressing, that the core developers don&#8217;t want to worry about this right now.  They may be right, but I sure had an unpleasant surprise when I discovered this behavior the wrong way.</p>
<p>I have an organizational directory database with Persons and OrgUnits.  Persons are automatically added and removed based on information retrieved an another data source (LDAP).  An OrgUnit (e.g., a department) can have a &#8220;head&#8221;, which is a person:</p>
<p><code>head = models.ForeignKey(Person, blank=True, null=True, related_name='head_of')</code></p>
<p>Now, of course, if a Person who happened to be the head of a department left the organization I wouldn&#8217;t want the department to be deleted, right?  In this case, as it turns out, it was worse than that.  Since the OrgUnit structure is hierarchical, the OrgUnit model has a one-to-many relationship with itself:</p>
<p><code>parent = models.ForeignKey('self', null=True, blank=True, related_name='children')</code></p>
<p>Now what happens if the head of a top-level OrgUnit is deleted?  The OrgUnit of which he/she was head is deleted, and every &#8220;descendant&#8221; OrgUnit under that one!  So, I had to override the delete() methods on both the Person and OrgUnit models.</p>
<p>Person:</p>
<p><code>def delete(self):<br />
"""<br />
Override default model method so an OrgUnit is not deleted<br />
when its head is deleted.<br />
"""<br />
self.head_of.clear()<br />
super(Person, self).delete()</code></p>
<p>OrgUnit:</p>
<p><code>def delete(self):<br />
"""<br />
Override default model method so that OrgUnit children are<br />
not deleted when the parent OrgUnit is deleted.<br />
"""<br />
self.children.clear()<br />
super(OrgUnit, self).delete()</code></p>
<p>On balance, Django&#8217;s default behavior is probably the right thing to do &#8212; as long as you&#8217;re aware of it!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/296/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=296&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/03/06/django-gotcha-related-objects-deleted-by-default/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
		<item>
		<title>Doctests make me love unit testing</title>
		<link>http://fragmentsofcode.wordpress.com/2009/03/06/doctests-make-me-love-unit-testing/</link>
		<comments>http://fragmentsofcode.wordpress.com/2009/03/06/doctests-make-me-love-unit-testing/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 00:00:00 +0000</pubDate>
		<dc:creator>David Chandek-Stark</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[doctest]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://fragmentsofcode.wordpress.com/?p=291</guid>
		<description><![CDATA[I&#8217;ve long had the nagging feeling that I&#8217;m not writing enough tests for my code. It&#8217;s kind of like doing the dishes, not exactly a task I look forward to.  The fun of programming is solving the problems, not writing code that tests whether your solutions actually work! 
What I love about Python&#8217;s doctest is that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=291&subd=fragmentsofcode&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve long had the nagging feeling that I&#8217;m not writing enough tests for my code. It&#8217;s kind of like doing the dishes, not exactly a task I look forward to.  The fun of programming is solving the problems, not writing code that tests whether your solutions actually work! </p>
<p>What I love about Python&#8217;s <em>doctest </em>is that it fits so naturally into the flow of coding: you write the function signature, then write the docstring saying what it&#8217;s supposed to do, right?  So then, <em>right there</em>, you write one or more simple tests to demonstrate the basic functionality you expect &#8212; before you&#8217;ve written a line of code in the body of the function. You write the function, save the file and then &#8212; boom! &#8212; run the tests.  Immediate feedback.  And I start to feel like my approach to programming is changing, because I can see that writing tests is not just about due diligence or whatever, but it&#8217;s a technique that can actually help me <em>write code</em>.</p>
<p>And &#8212; you can paste in commands from the Python interactive interpreter unchanged.  Yet another reason why Python feels like it&#8217;s designed with the needs of programmers, <em>human beings</em>, in mind.  It&#8217;s trying to make your life easier, simpler, and more productive.  While Python isn&#8217;t perfect (no language is), those things alone make it rate pretty high in my book.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/fragmentsofcode.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/fragmentsofcode.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/fragmentsofcode.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/fragmentsofcode.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/fragmentsofcode.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/fragmentsofcode.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/fragmentsofcode.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/fragmentsofcode.wordpress.com/291/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/fragmentsofcode.wordpress.com/291/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/fragmentsofcode.wordpress.com/291/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=fragmentsofcode.wordpress.com&blog=5756830&post=291&subd=fragmentsofcode&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://fragmentsofcode.wordpress.com/2009/03/06/doctests-make-me-love-unit-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">dchandek</media:title>
		</media:content>
	</item>
	</channel>
</rss>