<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Justin Lilly: Latest Entries</title><link>http://justinlilly.com/blog/</link><description /><language>en-us</language><lastBuildDate>Wed, 08 Jul 2009 12:31:23 -0400</lastBuildDate><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/justinlilly" type="application/rss+xml" /><item><title>Piping stdout when using Buildbot</title><link>http://feedproxy.google.com/~r/justinlilly/~3/ogmX1yN7aWU/</link><description>
&lt;p&gt;Just a quick tidbit for anyone googling like I have been all morning:
&lt;/p&gt;
&lt;p&gt;If you're attempting to pipe a command in a buildbot script, you need to issue it as a single string, not a list of strings. By using a single string, buildbot uses a shell, otherwise it doesn't. The &amp;gt; necessary for output redirection is a shell thing, which will only work in this method.
&lt;/p&gt;
&lt;p&gt;To recap:
&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;f1.addStep(ShellCommand(command=[&amp;#39;/home/www/bin/django&amp;#39;, &amp;#39;build_solr_schema&amp;#39;, &amp;#39;&amp;gt;&amp;#39;, &amp;#39;/etc/solr/conf/schema.xml&amp;#39;],
                    description=[&amp;#39;building&amp;#39;, &amp;#39;schema&amp;#39;], descriptionDone=[&amp;#39;schema&amp;#39;,&amp;#39;built&amp;#39;]))
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;becomes:
&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;f1.addStep(ShellCommand(command=&amp;quot;/home/www/bin/django build_solr_schema &amp;gt; /etc/solr/conf/schema.xml&amp;quot;,
                    description=[&amp;#39;building&amp;#39;, &amp;#39;schema&amp;#39;], descriptionDone=[&amp;#39;schema&amp;#39;,&amp;#39;built&amp;#39;]))
&lt;/pre&gt;&lt;/div&gt;</description><pubDate>Wed, 08 Jul 2009 12:31:23 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/jul/08/piping-stdout-when-using-buildbot/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/jul/08/piping-stdout-when-using-buildbot/</feedburner:origLink></item><item><title>6 things I learned about setuptools</title><link>http://feedproxy.google.com/~r/justinlilly/~3/flZOxjZ2FX8/</link><description>
&lt;p&gt;While building &lt;a href="http://pypi.python.org/pypi/pyvcs/"&gt;pyvcs&lt;/a&gt; and &lt;a href="http://pypi.python.org/pypi/django-vcs"&gt;django-vcs&lt;/a&gt; over 4th of July weekend with &lt;a href="http://lazypython.blogspot.com"&gt;Alex Gaynor&lt;/a&gt; [ &lt;a href="http://lazypython.blogspot.com/2009/07/announcing-pyvcs-django-vcs-and-piano.html"&gt;announcement&lt;/a&gt; ], there were a few interesting lessons learned, mostly revolving around how setuptools works. As Jacob mentions in his &lt;a href="http://jacobian.org/writing/django-apps-with-buildout/"&gt;post on buildout&lt;/a&gt;, you mostly have to cobble together the internals of setuptools from other setups. This works well at about 90% of the case. There are a few gotchas, however.
&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;
     &lt;code&gt;find_packages('directory')&lt;/code&gt; will look under &lt;code&gt;directory&lt;/code&gt; for a list of python modules to install. For our applications, we actually just wanted &lt;code&gt;find_packages()&lt;/code&gt;
 &lt;/li&gt;

 &lt;li&gt;
     You can't easily specify multiple authors for a project. We settled on &lt;code&gt;author = "First Author, Second Author"&lt;/code&gt;
 &lt;/li&gt;

 &lt;li&gt;
     Its a good idea to version target your requirements. Don't require &lt;code&gt;"pyvcs"&lt;/code&gt;, require &lt;code&gt;"pyvcs&amp;gt;=0.1"&lt;/code&gt;.
 &lt;/li&gt;

 &lt;li&gt;
     If your project contains django templates, set the &lt;code&gt;zip_safe&lt;/code&gt; property to &lt;code&gt;False&lt;/code&gt;.
 &lt;/li&gt;

 &lt;li&gt;
     The setup.py commands of &lt;code&gt;register&lt;/code&gt; or &lt;code&gt;sdist upload&lt;/code&gt; don't actually check that your project installs. For that, its likely better to use a virtualenv and test the installation.
 &lt;/li&gt;

 &lt;li&gt;
     &lt;code&gt;package_data&lt;/code&gt; is used to includes docs (or in our case, templates) with the project.
 &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This serves mostly as future reference for me, but hopefully helps someone else navigating the maze that is setuptools.
&lt;/p&gt;</description><pubDate>Sun, 05 Jul 2009 13:29:31 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/jul/05/6-things-learned-about-setuptools/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/jul/05/6-things-learned-about-setuptools/</feedburner:origLink></item><item><title>Using Database Views in Django</title><link>http://feedproxy.google.com/~r/justinlilly/~3/Hf7RRbRR4RE/</link><description>
&lt;p&gt;Database Views will make their appearance in the upcoming Django 1.1 release. Having used them for my latest project, there are a few gotchas when it comes to using them.
&lt;/p&gt;
&lt;p&gt;In our project, we were using &lt;a href="http://south.aeracode.org/"&gt;South&lt;/a&gt; for our database migrations. To ensure our database views were created, we added them to a south migration using db.execute. This worked very well for 90% of our usecase. The biggest hurdle for this ended up being testing. When syncdb runs, your unmanaged models (ie: database views) aren't generated. There were a few options available to us at this point.
&lt;/p&gt;
&lt;p&gt;Provide a replacement for django.test.TestCase which handles our DB View setup / teardown. The biggest benefit of this approach is it stays neatly out of the way. It also allows us to further alter TestCase if we have a need. In the end, we chose not to do this as it felt a bit sloppy and we ran the risk of breaking something if django TestCase were to change.
&lt;/p&gt;
&lt;p&gt;Another option was to use the post-syncdb signal to create the models. This approach also stays neatly out of the way. The downsides here were that it would conflict with South already generating our database view as well as it was a bit bigger blanket than we needed. Our problem was only for running tests. That said, if we weren't using South to manager our database options, I think this would have been the route we'd have gone.
&lt;/p&gt;
&lt;p&gt;Instead, we opted to provide a function for setup &amp;amp; teardown which handles the view creation. These functions are explicit and fix the issue exactly where we need it. The downside here is it seems like an extra step when creating tests for an app which would be nice not to have to go through.
&lt;/p&gt;
&lt;p&gt;The other big gotcha for database views is that you can't delete from them. This means that due to django's cascading delete's, you may recieve errors when attempting to delete an object that has references to a database view. The proper way to handle this is to invalidate the foreign keys that an object has to this database view before deleting it. Setting the ForeignKey to None before deletion will ensure that it actually works. You can follow the process of the resulting ticket for this at &lt;a href="http://code.djangoproject.com/ticket/10829"&gt;#10829&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;Overall, I feel the work that has gone into db views has been amazing. When you need one, they're exactly what you need. Here's hoping the above helps you avoid those gotchas.
&lt;/p&gt;</description><pubDate>Sat, 20 Jun 2009 11:35:31 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/jun/20/using-database-views-django/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/jun/20/using-database-views-django/</feedburner:origLink></item><item><title>EuroDjangoCon: Django @ 30,000 feet</title><link>http://feedproxy.google.com/~r/justinlilly/~3/uxTldOd_zok/</link><description>
&lt;p&gt;So I gave my talk related to django from the ideas of a manager at EuroDjangoCon. It was a blast and thanks to all of those who were present and asked questions. You can find my slides below.&lt;/p&gt;


&lt;iframe src='http://docs.google.com/EmbedSlideshow?docid=akxfhmr4dtk_595jnp5chc&amp;amp;size=l' frameborder='0' width='700' height='559'&gt;&lt;/iframe&gt;</description><pubDate>Mon, 04 May 2009 11:37:23 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/may/04/eurodjangocon-django-30000-feet/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/may/04/eurodjangocon-django-30000-feet/</feedburner:origLink></item><item><title>Customizing Django Forms with Multiwidget</title><link>http://feedproxy.google.com/~r/justinlilly/~3/6vbRdGB3hO0/</link><description>
&lt;p&gt;Before my talk at django-nyc tonight, I thought it might be good to post some slides so I can point people at where to find the code and slides from tonight. I'll come back and flesh out a text version of the talk, but for now, you can find a code repository on &lt;a href="http://github.com/justinlilly/django_multiwidget_demo/tree"&gt;github&lt;/a&gt; and the slides &lt;a href="http://docs.google.com/Presentation?id=akxfhmr4dtk_57pvzfcrcc"&gt;on google&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Mon, 27 Apr 2009 18:11:16 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/apr/27/customizing-django-forms-multiwidget/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/apr/27/customizing-django-forms-multiwidget/</feedburner:origLink></item><item><title>Virtualenv Wrapper Helper</title><link>http://feedproxy.google.com/~r/justinlilly/~3/os_VfnWTyaI/</link><description>
&lt;p&gt;A bit inspired by all the awesome stuff happening at PyCon, I've done a bit of hacking on my shell to improve the use of virtualenv_wrapper. Remembering to checkout the correct virtualenv is a bit of a pain, especially when you move around your filesystem as much as I do. To fix this, I've written &lt;a href="http://github.com/justinlilly/jlilly-bashy-dotfiles/commit/04899f005397499e89da6d562b062545e70d7975"&gt;a bit of code&lt;/a&gt; for my bash prompt to ease the pain.
&lt;/p&gt;
&lt;p&gt;It works by looking for the existance of a .venv file every time you &lt;code&gt;cd&lt;/code&gt; into a directory.  If it exists, it will attempt to &lt;code&gt;workon&lt;/code&gt; the contents of the file, which should be the project name. For instance, for my oebfare project (more news forthcoming on that), the file contains the words "oebfare" as that's the name of my virtualenv. Due to this, you can get general awesomeness such as the following:
&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;# prompt edited to save space
12:02 AM: (~/Code/django) jlilly$ cd baconfile/
(baconfile):12:03 AM: (~/Code/django/baconfile) (master) jlilly$ cd ..
(baconfile):12:03 AM: (~/Code/django) jlilly$ cd oebfare/
(oebfare):12:03 AM: (~/Code/django/oebfare) (master) jlilly$
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When we &lt;code&gt;cd&lt;/code&gt; into the baconfile dir, we get the virtualenv for baconfile. We can cd out of that directory and about the filesystem, but when we enter a directory that contains a different .venv file, we get a different virtualenv.
&lt;/p&gt;</description><pubDate>Sat, 28 Mar 2009 23:57:19 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/mar/28/virtualenv-wrapper-helper/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/mar/28/virtualenv-wrapper-helper/</feedburner:origLink></item><item><title>NameError: global name &amp;#39;log&amp;#39; is not defined</title><link>http://feedproxy.google.com/~r/justinlilly/~3/FGd-lFGvMzo/</link><description>
&lt;p&gt;I've spent a portion of this evening trying to get caught up with the crazy amounts of development that have been going on with the &lt;a class="reference external" href="http://github.com/justinlilly/oebfare/network/"&gt;oebfare&lt;/a&gt; blogging engine over the past few weeks. I have a nice little ubuntu VM setup that works really nicely, but when gathering the requirements for the projects, I hit a snag. I apparently had a borked setuptools (installed via apt) which resulted in the error:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
NameError: global name 'log' is not defined
&lt;/pre&gt;
&lt;p&gt;To fix this, find your setuptools location. For me, it was relatively easy as I'm using virtualenvwrapper so it was located in ~/.virtualenvs/oebfare/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg&lt;/p&gt;
&lt;p&gt;After a brief google search, I came across a patch which seems to fix the issue, which you can find &lt;a class="reference external" href="http://bugs.python.org/file10198/setuptools_patch.txt"&gt;here&lt;/a&gt;. To apply the patch, rename your .egg file to a .zip, extract it, patch the repository, zip it back up, rename it, and you should be set. Here are the commands I ran to do that.&lt;/p&gt;
&lt;pre class="literal-block"&gt;
321  mv setuptools-0.6c8-py2.5.egg setuptools-0.6c8-py2.5.zip
322  extract setuptools-0.6c8-py2.5.zip   # alias to extract an archived file
323  cd setuptools/
324  wget http://bugs.python.org/file10198/setuptools_patch.txt
325  patch -p0 &amp;lt; setuptools_patch.txt # this one didn't work. I was off by 1
326  patch -p1 &amp;lt; setuptools_patch.txt
327  ..  # alias to cd ..
328  rm setuptools-0.6c8-py2.5.zip
329  zip setuptools setuptools-0.6c8-py2.5.zip  # I never remember the proper order
330  zip setuptools-0.6c8-py2.5.zip setuptools
331  mv setuptools-0.6c8-py2.5.zip setuptools-0.6c8-py2.5.egg
&lt;/pre&gt;
&lt;p&gt;Hope it helps someone!&lt;/p&gt;
</description><pubDate>Sun, 22 Mar 2009 00:49:35 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/mar/22/nameerror-global-name-log-not-defined/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/mar/22/nameerror-global-name-log-not-defined/</feedburner:origLink></item><item><title>psycopg2 InternalError ?</title><link>http://feedproxy.google.com/~r/justinlilly/~3/AgmQ2YPGjac/</link><description>
&lt;p&gt;For those who've hit the following complaint with django (like I just did):&lt;/p&gt;
&lt;blockquote&gt;
psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block&lt;/blockquote&gt;
&lt;p&gt;You need to set up PostGIS and ensure that the table you're looking at has been created from the template_postgis template.  Just a warning, check your database logs for more info.&lt;/p&gt;
</description><pubDate>Fri, 13 Mar 2009 11:28:38 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/mar/13/psycopg2-internalerror/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/mar/13/psycopg2-internalerror/</feedburner:origLink></item><item><title>A better look for Comments</title><link>http://feedproxy.google.com/~r/justinlilly/~3/fd7RUQFlcno/</link><description>
&lt;img alt="http://img.skitch.com/20090210-ff21cc3bqutqp2epnyp4p5hhes.jpg" class="float-right" src="http://img.skitch.com/20090210-ff21cc3bqutqp2epnyp4p5hhes.jpg" /&gt;
&lt;img alt="http://img.skitch.com/20090210-nyeurf3ek1exsk1sgc77xdx73t.jpg" class="float-right" src="http://img.skitch.com/20090210-nyeurf3ek1exsk1sgc77xdx73t.jpg" /&gt;
&lt;p&gt;I've been in the process of unforking my code from &lt;a class="reference external" href="http://oebfare.com/"&gt;brosner's&lt;/a&gt;
&lt;a class="reference external" href="http://github.com/brosner/oebfare/tree/master/"&gt;oebfare&lt;/a&gt; blogging engine. In doing so, I've decided to remove some
of the pain points along the way.&lt;/p&gt;
&lt;p&gt;For me, a big one is how comments are represented in the admin. The
content-type, object-id paradigm make a ton of sense on the back end
of things, but when it comes to seeing which comments map to which
posts, it leaves a lot to be desired. By overriding the ModelAdmin for
the comments app, its simple to include the name of the object being
commented on.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="n"&gt;admin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;site&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unregister&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Comment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CommentsDisplayGenericObjectAdmin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CommentsAdmin&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;list_display&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;commented_object&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;ip_address&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="s"&gt;&amp;#39;submit_date&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;is_public&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;is_removed&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;commented_object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;&amp;lt;a href=&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;/a&amp;gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commented_obj_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content_object&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                                        &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content_object&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;commented_object&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;allow_tags&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;commented_obj_url&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="c"&gt;# hackish, needs to actually do a reverse lookup&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;/admin/&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s"&gt;/&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_meta&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;app_label&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                     &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_meta&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;module_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                     &lt;span class="n"&gt;obj&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;admin&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;site&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Comment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CommentsDisplayGenericObjectAdmin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And there you have it. A much simpler view in the admin.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt;: Missed an attribute on the commented object which shortens code a bit. Thanks &lt;a class="reference external" href="http://www.biologeek.com/django/"&gt;David&lt;/a&gt;&lt;/p&gt;
</description><pubDate>Tue, 10 Feb 2009 00:43:24 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/feb/10/better-look-comments/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/feb/10/better-look-comments/</feedburner:origLink></item><item><title>Django App Engine Doc Fix</title><link>http://feedproxy.google.com/~r/justinlilly/~3/iKL-WE-iIqk/</link><description>
&lt;p&gt;For those setting up Django on Google App Engine on version after the signals refactor, the following fix is needed for the code supplied by Google.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="c"&gt;# Log errors.&lt;/span&gt;
&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dispatch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dispatcher&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="n"&gt;log_exception&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;signals&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;got_request_exception&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Unregister the rollback event handler.&lt;/span&gt;
&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dispatch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dispatcher&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_rollback_on_exception&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;signals&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;got_request_exception&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;becomes:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="c"&gt;# Log errors.&lt;/span&gt;
&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dispatch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Signal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
   &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;signals&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;got_request_exception&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;log_exception&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Unregister the rollback event handler.&lt;/span&gt;
&lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dispatch&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Signal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;disconnect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;signals&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;got_request_exception&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_rollback_on_exception&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
</description><pubDate>Fri, 06 Feb 2009 23:01:09 -0400</pubDate><guid isPermaLink="false">http://justinlilly.com/blog/2009/feb/06/django-app-engine-doc-fix/</guid><feedburner:origLink>http://justinlilly.com/blog/2009/feb/06/django-app-engine-doc-fix/</feedburner:origLink></item></channel></rss>
