<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ruslan's Blog &#187; python</title>
	<atom:link href="http://ruslanspivak.com/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://ruslanspivak.com</link>
	<description>Musings on dynamic languages and more than that</description>
	<lastBuildDate>Wed, 02 Jun 2010 19:16:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ruslanspivak.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/04a636b5f08c182c190ff6d8ae67239e?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ruslan's Blog &#187; python</title>
		<link>http://ruslanspivak.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ruslanspivak.com/osd.xml" title="Ruslan&#039;s Blog" />
	<atom:link rel='hub' href='http://ruslanspivak.com/?pushpress=hub'/>
		<item>
		<title>Urlencode and urldecode from a command line</title>
		<link>http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/</link>
		<comments>http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 18:22:08 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[bash]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=224</guid>
		<description><![CDATA[Recently I have worked with a REST Web service and had to URL encode a lot of values from the command line. If all you need is to URL encode data for a POST request you can use curl with &#8211;data-urlencode parameter, but I needed to encode values that went into a URL query string. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=224&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I have worked with a REST Web service and had to URL encode a lot of values from the command line.</p>
<p>If all you need is to URL encode data for a POST request you can use <a href="http://curl.haxx.se/">curl</a> with <strong><em>&#8211;data-urlencode</em></strong> parameter, but I needed to encode values that went into a URL query string.<br />
So for the task I wrote a short code in Python to do just that (there are examples available in BASH or Perl, but this is a pure Python using only standard library):</p>
<pre style="color:#f8f8f8;background-color:#0c1021;font-size:8pt;">python -c <span style="color:#61ce3c;">"import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"</span></pre>
<p>Assign it to an alias by putting single quotes around the expression and you&#8217;re good to go:</p>
<pre style="color:#f8f8f8;background-color:#0c1021;font-size:8pt;">$ alias <span style="color:#ff6400;">urlencode</span>=<span style="color:#61ce3c;">'python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'</span></pre>
<p>Example:</p>
<pre style="color:#f8f8f8;background-color:#0c1021;font-size:8pt;">$ <span style="font-weight:bold;">urlencode 'q werty=/;'</span>
q+werty%3D%2F%3B</pre>
<p>And the decode part:</p>
<pre style="color:#f8f8f8;background-color:#0c1021;font-size:8pt;">python -c <span style="color:#61ce3c;">"import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"</span></pre>
<pre style="color:#f8f8f8;background-color:#0c1021;font-size:8pt;">$ alias <span style="color:#ff6400;">urldecode</span>=<span style="color:#61ce3c;">'python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'</span></pre>
<pre style="color:#f8f8f8;background-color:#0c1021;font-size:8pt;">$ <span style="font-weight:bold;">urldecode 'q+werty%3D%2F%3B'</span>
q werty=/;</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=224&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2010/06/02/urlencode-and-urldecode-from-a-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
		<item>
		<title>Review of Grok 1.0 Web Development</title>
		<link>http://ruslanspivak.com/2010/04/12/review-of-grok-1-0-web-development/</link>
		<comments>http://ruslanspivak.com/2010/04/12/review-of-grok-1-0-web-development/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 10:03:59 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[book]]></category>
		<category><![CDATA[grok]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=204</guid>
		<description><![CDATA[It took me a while to finish reading the book but here we go. I wasn&#8217;t disappointed by the book and absolutely sure that it delivers on its promise to show that Grok can be an excellent fit for many kinds of Web development projects. I think I&#8217;ll have to finish my Grok based blog [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=204&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>It took me a while to finish reading <a href="http://www.packtpub.com/grok-1-0-web-development/book?utm_source=ruslanspivak.com&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_002621">the book</a> but here we go.</p>
<p><a href="http://www.packtpub.com/grok-1-0-web-development/book?utm_source=ruslanspivak.com&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_002621"><img class="alignleft size-thumbnail wp-image-207" title="grok" src="http://ruslanspivak.files.wordpress.com/2010/04/grok1.jpg?w=121&#038;h=150" alt="" width="121" height="150" /></a> I wasn&#8217;t disappointed by the book and absolutely sure that it delivers on its promise to show that <a href="http://grok.zope.org/">Grok</a> can be an excellent fit for many kinds of Web development projects.</p>
<p>I think I&#8217;ll have to finish my <a href="http://github.com/rspivak/grok-awesome">Grok based blog</a> now :)</p>
<p>Grok is largely based on <a href="http://docs.zope.org/zopetoolkit/">Zope Tookit</a> and that&#8217;s a very powerful set of libraries developed over many years that provides support for forms, full text search, authentication, i18n, security, components, persistence, testing, and many more.</p>
<p>Main distinguishing Grok concepts emphasized by the book:</p>
<ul>
<li>component architecture</li>
<li>object database (ZODB)</li>
<li>object publishing and traversal</li>
<li>convention over configuration and <em>do not repeat yourself</em> (<em>DRY</em>) principle</li>
</ul>
<p>The book introduces a simple <em>&#8220;to-do&#8221;</em> application to the readers. Gradually the application grows with new features like storing data in object database, forms, full text catalog search, security, component architecture.</p>
<p>There is a separate chapter devoted to integration with relational databases. This is especially important topic for Grok because traditionally Zope and Grok were tightly bound to ZODB.</p>
<p>All in all it&#8217;s been a pleasant read and I think it&#8217;s a great introduction to Grok web framework.</p>
<p>P.S. I may sound very optimistic regarding Grok and Zope, but I can&#8217;t do anything about it &#8211; I have a soft spot for Grok, it&#8217;s an excellent piece of software :)</p>
<p>Enjoy it!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/204/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=204&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2010/04/12/review-of-grok-1-0-web-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>

		<media:content url="http://ruslanspivak.files.wordpress.com/2010/04/grok1.jpg?w=121" medium="image">
			<media:title type="html">grok</media:title>
		</media:content>
	</item>
		<item>
		<title>Preview of Grok 1.0 Web Development by Carlos de la Guardia</title>
		<link>http://ruslanspivak.com/2010/02/26/preview-of-grok-1-0-web-development-by-carlos-de-la-guardia/</link>
		<comments>http://ruslanspivak.com/2010/02/26/preview-of-grok-1-0-web-development-by-carlos-de-la-guardia/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 07:20:50 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[book]]></category>
		<category><![CDATA[grok]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=188</guid>
		<description><![CDATA[I&#8217;ve been asked by PACKT publishing to review a new book  Grok 1.0 Web Development. I gladly accepted their proposal. For those interested &#8211; yes, they sent me a free PDF version of the book, but I would buy the book anyway because it is about the project I love and associate myself with even [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=188&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been asked by <a href="http://www.packtpub.com">PACKT publishing</a> to review a new book  <a href="http://www.packtpub.com/grok-1-0-web-development/book?utm_source=ruslanspivak.com&amp;utm_medium=bookrev&amp;utm_content=blog&amp;utm_campaign=mdb_002621">Grok 1.0 Web Development</a>.</p>
<p>I gladly accepted their proposal. For those interested &#8211; yes, they sent me a free PDF version of the book, but I would buy the book anyway because it is about the project I love and associate myself with even though I&#8217;ve not been actively participating in it recently.</p>
<p>Personally I think that the release of this book is a major event for the whole Grok community. Having comprehensive documentation for people just starting with a <a href="http://grok.zope.org/">smashing Web framework Grok</a> is of utter importance.</p>
<p>What&#8217;s interesting is that I&#8217;ve been thinking about writing a book on Grok myself, but Carlos de la Guardia beat me to the punch and after skimming through the book I&#8217;m glad he did :)</p>
<p>What I liked instantaneously about the book is the presence of a chapter on integration with relational databases, the topic that in the Zope world was kind of obscure in the past.</p>
<p>When I finish reading the book I&#8217;ll post a full review so stay tuned and meanwhile you can take a sneak peak at the book by reading a freely available <a href="http://www.packtpub.com/files/7481-grok-1-0-Web-development-sample-chapter-5-forms.pdf">Chapter No 5: Forms</a></p>
<p><span style="color:#000000;"><br />
</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/188/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=188&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2010/02/26/preview-of-grok-1-0-web-development-by-carlos-de-la-guardia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
		<item>
		<title>My first crack at Nokia N900 Maemo Python development</title>
		<link>http://ruslanspivak.com/2009/12/28/my-first-crack-at-nokia-n900-maemo-python-development/</link>
		<comments>http://ruslanspivak.com/2009/12/28/my-first-crack-at-nokia-n900-maemo-python-development/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 09:54:09 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[maemo]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=161</guid>
		<description><![CDATA[Got my shiny new Nokia N900 &#8211; to say that I&#8217;m happy is an understatement :) For me as a long standing Linux user and Pythonista N900 has an unassailable advantage &#8211; its Maemo platform is Linux based and I can program in Python for the platform. So it&#8217;s time to get my feet wet [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=161&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Got my shiny new <a href="http://maemo.nokia.com/n900/">Nokia N900</a> &#8211; to say that I&#8217;m happy is an understatement :)</p>
<p>For me as a long standing Linux user and Pythonista N900 has an unassailable advantage &#8211; its <a href="http://maemo.org/">Maemo</a> platform is Linux based and I can program in Python for the platform.</p>
<p>So it&#8217;s time to get my feet wet and learn some Maemo programming. I decided to take a stab at writing a small <a href="http://ichi2.net/anki/index.html">Anki</a> client using Python and Qt. As a result I have a working but still very raw prototype called <a href="http://github.com/rspivak/ktanki">KTAnki</a> that successfully runs on my N900.</p>
<p>For <a href="http://github.com/rspivak/ktanki">KTAnki</a> I used <a href="http://www.riverbankcomputing.co.uk/software/pyqt/intro">PyQt4</a> library, though I should take a closer look at Nokia&#8217;s own bindings &#8211; <a href="http://www.pyside.org/">PySide</a>.</p>
<p>Here are some resources that I found helpful when prototyping my first Maemo PyQt application:</p>
<ol>
<li><a href="http://wiki.maemo.org/N900_USB_networking">N900 USB Networking</a></li>
<li><a href="http://wiki.maemo.org/PyMaemo/QuickStartGuide">PyMaemo QuickStart Guide</a></li>
<li><a href="http://wiki.forum.nokia.com/index.php/Getting_started_with_PyQt_for_Maemo">Getting started with PyQt for Maemo</a></li>
<li><a href="http://www.slideshare.net/guestb404461/pyqt-application-development-on-maemo">PyQt Application Development On Maemo</a></li>
<li><a href="http://blogs.forum.nokia.com/blog/kate-alholas-forum-nokia-blog/2009/12/01/hildonized-applications-for-maemo-5-with-qt4.5.3-and-qt4.6">Hildonized applications for Maemo 5 with Qt4.5.3 and Qt4.6</a></li>
<li><a href="http://www.qtrac.eu/pyqtbook.html">Rapid GUI Programming with Python and Qt</a></li>
<li><a href="http://doc.trolltech.com/">Qt Reference Documentation</a></li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=161&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2009/12/28/my-first-crack-at-nokia-n900-maemo-python-development/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
		<item>
		<title>CSSBuilder for Data URIs</title>
		<link>http://ruslanspivak.com/2009/11/30/cssbuilder-for-data-uris/</link>
		<comments>http://ruslanspivak.com/2009/11/30/cssbuilder-for-data-uris/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 08:15:57 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=152</guid>
		<description><![CDATA[I&#8217;ve added a new repository for CSSBuilder at http://github.com/rspivak/cssbuilder CSSBuilder is a command line utility and library written in Python for embedding Data URIs into CSS files. You can find more information about Data URI at: http://en.wikipedia.org/wiki/Data_URI_scheme http://www.nczonline.net/blog/2009/10/27/data-uris-explained/ http://www.phpied.com/data-urls-what-are-they-and-how-to-use/ &#160;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=152&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added a new repository for CSSBuilder at <a href="http://github.com/rspivak/cssbuilder">http://github.com/rspivak/cssbuilder</a></p>
<p>CSSBuilder is a command line utility and library written in Python for embedding Data URIs into CSS files.</p>
<p>You can find more information about Data URI at:</p>
<p><a href="http://en.wikipedia.org/wiki/Data_URI_scheme">http://en.wikipedia.org/wiki/Data_URI_scheme</a></p>
<p><a href="http://www.nczonline.net/blog/2009/10/27/data-uris-explained/">http://www.nczonline.net/blog/2009/10/27/data-uris-explained/</a></p>
<p><a href="http://www.phpied.com/data-urls-what-are-they-and-how-to-use/">http://www.phpied.com/data-urls-what-are-they-and-how-to-use/</a></p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=152&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2009/11/30/cssbuilder-for-data-uris/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
		<item>
		<title>Rebinding variable outside of the local scope</title>
		<link>http://ruslanspivak.com/2009/10/07/rebinding-variable-outside-of-the-local-scope/</link>
		<comments>http://ruslanspivak.com/2009/10/07/rebinding-variable-outside-of-the-local-scope/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 04:04:52 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=130</guid>
		<description><![CDATA[The other day I had to explain why in Python in contrast to Perl/Lisp/Scheme one can&#8217;t rebind variable outside of the local scope besides the global scope, i.e. the following function will result in an UnboundLocalError exception in Python 2.x def outer(): count = 0 def inner(): count += 1 # rebinding inner() print count [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=130&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>The other day I had to explain why in Python in contrast to Perl/Lisp/Scheme one can&#8217;t rebind variable outside of the local scope besides the global scope, i.e. the following function will result in an <em>UnboundLocalError</em> exception in <em><strong>Python 2.x</strong></em></p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">outer</span>():
    count = 0
    <span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">inner</span>():
        count += 1 <span style="color:#AEAEAE;font-style:italic;"># </span><span style="color:#AEAEAE;font-style:italic;">rebinding
</span>    inner()
    <span style="color:#FBDE2D;">print</span> count</pre>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#00ffff;">&gt;&gt;&gt; </span><span style="font-weight:bold;">outer()</span>
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "scope.py", line 8, in outer
    inner()
  File "scope.py", line 6, in inner
    count += 1 # rebinding
UnboundLocalError: local variable 'count' referenced before assignment</pre>
<p>There are several workarounds.</p>
<p>For one thing it is possible to use a variable holding a mutable object:</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">outer</span>():
    ns = <span style="color:#F8F8F8;">dict</span>(count=0)
    <span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">inner</span>():
        ns[<span style="color:#61CE3C;">'count'</span>] += 1 <span style="color:#AEAEAE;font-style:italic;"># </span><span style="color:#AEAEAE;font-style:italic;">rebinding
</span>    inner()
    <span style="color:#FBDE2D;">print</span> ns[<span style="color:#61CE3C;">'count'</span>]</pre>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#00ffff;">&gt;&gt;&gt; </span><span style="font-weight:bold;">outer()</span>
1</pre>
<p>Another approach is to use a function object itself to store the variable:</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">outer</span>():
    outer.count = 0
    <span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">inner</span>():
        outer.count += 1 <span style="color:#AEAEAE;font-style:italic;"># </span><span style="color:#AEAEAE;font-style:italic;">rebinding
</span>    inner()
    <span style="color:#FBDE2D;">print</span> outer.count</pre>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#00ffff;">&gt;&gt;&gt; </span><span style="font-weight:bold;">outer()</span>
1</pre>
<p>The good news is that there is no need for workarounds anymore in <em><strong>Python 3</strong></em> which introduced <a href="http://docs.python.org/3.1/reference/simple_stmts.html#nonlocal"><strong>nonlocal</strong></a> keyword:</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">outer</span>():
    count = 0
    <span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">inner</span>():
        nonlocal count
        count += 1 <span style="color:#AEAEAE;font-style:italic;"># </span><span style="color:#AEAEAE;font-style:italic;">rebinding
</span>    inner()
    <span style="color:#FBDE2D;">print</span>(count)
</pre>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#00ffff;">&gt;&gt;&gt; </span><span style="font-weight:bold;">outer()</span>
1</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/130/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=130&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2009/10/07/rebinding-variable-outside-of-the-local-scope/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
		<item>
		<title>IPython profile for Grok</title>
		<link>http://ruslanspivak.com/2009/03/30/ipython-profile-for-grok/</link>
		<comments>http://ruslanspivak.com/2009/03/30/ipython-profile-for-grok/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 06:46:27 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[grok]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=111</guid>
		<description><![CDATA[To use IPython shell from Grok based project is easy, just add ipython to eggs directive in your buildout.cfg My part with ipython added looks like this: [app] recipe = zc.recipe.egg eggs = grok-awesome ipython Paste PasteScript PasteDeploy interpreter = python-console But I wanted to be able to inspect Grok instance and use path TAB [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=111&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>To use IPython shell from Grok based project is easy, just add <em>ipython</em> to eggs directive in your <em>buildout.cfg</em></p>
<p>My part with <em>ipython</em> added looks like this:</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;">[<span style="color:#8DA6CE;">app</span>]
<span style="color:#FF6400;">recipe</span> = zc.recipe.egg
<span style="color:#FF6400;">eggs</span> = grok-awesome
       ipython
       Paste
       PasteScript
       PasteDeploy
<span style="color:#FF6400;">interpreter</span> = python-console</pre>
<p>But I wanted to be able to inspect Grok instance and use path TAB auto-completion to navigate ZODB hierarchy.</p>
<p>Inspired by existing IPython profile fo Zope2 I whipped out basic implementation for Grok.</p>
<p>It&#8217;s available under <a href="http://github.com/rspivak/grok-ipython/tree">grok-ipython</a>. Now all IPython power can be used when inspecting objects in Grok instance:</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#F8F8F8;background-color:#0C1021;">(mygrok)[alienoid@capricorn grok-awesome]$ bin/ipython -p grok</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">IPython shell for Grok.</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#F8F8F8;background-color:#0C1021;">Bound object names:</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">-------------------</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">  root</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">  ctx</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#F8F8F8;background-color:#0C1021;">Bound command names:</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">--------------------</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">  cdg / ;cdg</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">  lsg / ;lsg</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">  pwdg</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">  sync</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">  commit</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#F8F8F8;background-color:#0C1021;">Grok IPython 0.9.1   Py 2.5.2</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">1</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">root</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;">Out[</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">1</span><span style="color:#cd0000;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">&lt;zope.app.folder.folder.Folder object at 0x9003e6c&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">2</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">ctx</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;">Out[</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">2</span><span style="color:#cd0000;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">&lt;zope.app.folder.folder.Folder object at 0x9003e6c&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">3</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">;cdg blog</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#00cd00;background-color:#0C1021;">------&gt; </span><span style="color:#F8F8F8;background-color:#0C1021;">cdg("blog")</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;">Out[</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">3</span><span style="color:#cd0000;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">u'/blog'</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">4</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">ctx</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;">Out[</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">4</span><span style="color:#cd0000;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">&lt;grokawesome.blog.Blog object at 0x81d2d6c&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">5</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">;cdg </span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">my-first-post  second-post    </span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">5</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">;cdg my-first-post</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#00cd00;background-color:#0C1021;">------&gt; </span><span style="color:#F8F8F8;background-color:#0C1021;">cdg("my-first-post")</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;">Out[</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">5</span><span style="color:#cd0000;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">u'/blog/my-first-post'</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">6</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">ctx</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;">Out[</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">6</span><span style="color:#cd0000;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">&lt;grokawesome.entry.BlogEntry object at 0xb7d556ac&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">7</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">pwdg</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;">Out[</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">7</span><span style="color:#cd0000;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">u'/blog/my-first-post'</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">8</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">ctx?</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Type:</span><span style="color:#F8F8F8;background-color:#0C1021;">           </span><span style="color:#F8F8F8;background-color:#0C1021;">BlogEntry</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Base Class:</span><span style="color:#F8F8F8;background-color:#0C1021;">     </span><span style="color:#F8F8F8;background-color:#0C1021;">&lt;class 'grokawesome.entry.BlogEntry'&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">String Form:</span><span style="color:#F8F8F8;background-color:#0C1021;">    </span><span style="color:#F8F8F8;background-color:#0C1021;">&lt;grokawesome.entry.BlogEntry object at 0xb7d556ac&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Namespace:</span><span style="color:#F8F8F8;background-color:#0C1021;">      </span><span style="color:#F8F8F8;background-color:#0C1021;">Interactive</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Length:</span><span style="color:#F8F8F8;background-color:#0C1021;">         </span><span style="color:#F8F8F8;background-color:#0C1021;">0</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">File:</span><span style="color:#F8F8F8;background-color:#0C1021;">           </span><span style="color:#F8F8F8;background-color:#0C1021;">/home/alienoid/mygrok/grok-awesome/src/grokawesome/entry.py</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Docstring:</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">    &lt;no docstring&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span>
<span style="color:#00cd00;background-color:#0C1021;">In [</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">9</span><span style="color:#00cd00;background-color:#0C1021;">]: </span><span style="color:#F8F8F8;background-color:#0C1021;">ctx??</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Type:             </span><span style="color:#F8F8F8;background-color:#0C1021;">BlogEntry</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Base Class:       </span><span style="color:#F8F8F8;background-color:#0C1021;">&lt;class 'grokawesome.entry.BlogEntry'&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">String Form:</span><span style="color:#F8F8F8;background-color:#0C1021;">   &lt;grokawesome.entry.BlogEntry object at 0xb7d556ac&gt;</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Namespace:        </span><span style="color:#F8F8F8;background-color:#0C1021;">Interactive</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Length:           </span><span style="color:#F8F8F8;background-color:#0C1021;">0</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">File:             </span><span style="color:#F8F8F8;background-color:#0C1021;">/home/alienoid/mygrok/grok-awesome/src/grokawesome/entry.py</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#cd0000;background-color:#0C1021;font-weight:bold;">Source:</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">class</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">BlogEntry</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">(</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">grok</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">Container</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">)</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">:</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">    </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">grok</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">implements</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">(</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">IBlogEntry</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">)</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#F8F8F8;background-color:#0C1021;">    </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">portal_type</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#0000ee;background-color:#0C1021;font-weight:bold;">'blogentry'</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">    </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">created</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">property</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">DCProperty</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">(</span><span style="color:#0000ee;background-color:#0C1021;font-weight:bold;">'created'</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">)</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">    </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">modified</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">property</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">DCProperty</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">(</span><span style="color:#0000ee;background-color:#0C1021;font-weight:bold;">'modified'</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">)</span><span style="color:#F8F8F8;background-color:#0C1021;">

</span><span style="color:#F8F8F8;background-color:#0C1021;">    </span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">def</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">__init__</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">(</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">self</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">,</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">title</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">,</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">content</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">,</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">                 </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">summary</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#0000ee;background-color:#0C1021;font-weight:bold;">u''</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">,</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">                 </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">categories</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">None</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">,</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">                 </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">allow_comments</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">False</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">)</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">:</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">        </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">super</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">(</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">BlogEntry</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">,</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">self</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">)</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">__init__</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">(</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">)</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">        </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">self</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">title</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">title</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">        </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">self</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">content</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">content</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">        </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">self</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">summary</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#0000ee;background-color:#0C1021;font-weight:bold;">''</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">if</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">summary</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">is</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">None</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">else</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">summary</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">        </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">self</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">categories</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">[</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">]</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">if</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">categories</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">is</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">None</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#00cd00;background-color:#0C1021;font-weight:bold;">else</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">categories</span><span style="color:#F8F8F8;background-color:#0C1021;">
</span><span style="color:#F8F8F8;background-color:#0C1021;">        </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">self</span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">.</span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">allow_comments</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#cdcd00;background-color:#0C1021;font-weight:bold;">=</span><span style="color:#F8F8F8;background-color:#0C1021;"> </span><span style="color:#ffffff;background-color:#0C1021;font-weight:bold;">allow_comments</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=111&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2009/03/30/ipython-profile-for-grok/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
		<item>
		<title>TinyMCE widget in Grok</title>
		<link>http://ruslanspivak.com/2009/03/24/tinymce-widget-in-grok/</link>
		<comments>http://ruslanspivak.com/2009/03/24/tinymce-widget-in-grok/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:48:26 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[grok]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=100</guid>
		<description><![CDATA[I have added TinyMCE widget to grok-awesome for editing html and it was easy as pie. If you want TinyMCE in your Grok based project it can be achieved with following steps: 1. Add dependencies to setup.py into install_requires section: 'hurry.tinymce', 'hurry.zopetinymce', hurry.tinymce allows you to include TinyMCE into your project without additional burden, you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=100&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I have added TinyMCE widget to <a href="http://github.com/rspivak">grok-awesome</a> for editing html and it was easy as pie.</p>
<p>If you want <a href="http://tinymce.moxiecode.com/">TinyMCE</a> in your Grok based project it can be achieved with following steps:</p>
<p><strong>1</strong>. Add dependencies to <em>setup.py</em> into <em>install_requires</em> section:</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;">                        <span style="color:#61CE3C;">'hurry.tinymce'</span>,
                        <span style="color:#61CE3C;">'hurry.zopetinymce'</span>,</pre>
<p><a href="http://pypi.python.org/pypi/hurry.tinymce/">hurry.tinymce</a> allows you to include TinyMCE into your project without additional burden, you don&#8217;t need to do anything. Well, almost &#8211; just make sure to call:<br />
<strong><em>from hurry.tinymce import tinymce<br />
tinymce.need()</em></strong><br />
to trigger inclusion of TinyMCE in the web page.</p>
<p><strong>2</strong>. Create custom widget which calls <em>tinymce.need()</em> as noted above  and initializes TinyMCE</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#FBDE2D;">from</span> zope.app.form.browser <span style="color:#FBDE2D;">import</span> TextAreaWidget
<span style="color:#FBDE2D;">from</span> hurry.tinymce <span style="color:#FBDE2D;">import</span> tinymce

<span style="color:#FF6400;">template</span> = <span style="color:#61CE3C;">"""%(widget_html)s
&lt;script type="</span>text/javascript<span style="color:#61CE3C;">"&gt;
  tinyMCE.init({
    mode : "</span>exact<span style="color:#61CE3C;">",
    elements: "</span>%(elements)s<span style="color:#61CE3C;">",
    theme: "</span>advanced<span style="color:#61CE3C;">"
  });
&lt;/script&gt;"""</span>

<span style="color:#FBDE2D;">class</span> <span style="color:#8DA6CE;">TinyMCEWidget</span>(TextAreaWidget):
    <span style="color:#61CE3C;">"""Widget to edit html using TinyMCE WYSIWYG editor."""</span>

    <span style="color:#FBDE2D;">def</span> <span style="color:#FF6400;">__call__</span>(<span style="color:#FBDE2D;">self</span>, *args, **kw):
        widget_html = <span style="color:#F8F8F8;">super</span>(TinyMCEWidget, <span style="color:#FBDE2D;">self</span>).__call__(*args, **kw)
        tinymce.need()
        <span style="color:#FBDE2D;">return</span> template % {<span style="color:#61CE3C;">'widget_html'</span>: widget_html,
                           <span style="color:#61CE3C;">'elements'</span>: <span style="color:#FBDE2D;">self</span>.name,
                           }</pre>
<p><strong>3</strong>. In your add/edit form use your custom widget for the field you want and off you go:</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;">form_fields[<span style="color:#61CE3C;">'content'</span>].custom_widget = TinyMCEWidget</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=100&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2009/03/24/tinymce-widget-in-grok/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
		<item>
		<title>Decode hex pairwise with zip</title>
		<link>http://ruslanspivak.com/2009/03/20/decode-hex-pairwise-with-zip/</link>
		<comments>http://ruslanspivak.com/2009/03/20/decode-hex-pairwise-with-zip/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 16:34:55 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=68</guid>
		<description><![CDATA[The other day I had to decode strings containing hex numbers into plain integers. I could use built-in int([ x [, radix]]) with radix=16 to convert a string to an integer and forget about it, but I needed to decode pairs from the hex number so that in the end from the string &#8216;FFEEDD&#8217; I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=68&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>The other day I had to decode strings containing hex numbers into plain integers.</p>
<p>I could use built-in <strong><em>int([ x [, radix]])</em></strong> with <strong><em>radix=16</em></strong> to convert a string to an integer and forget about it, but I needed to decode pairs from the hex number so that in the end from the string &#8216;FFEEDD&#8217; I get 255, 238, 221</p>
<p>But wouldn&#8217;t you know it, there is a standard solution to get pairs in Python and it&#8217;s built-in <em>zip</em> function.</p>
<p>It&#8217;s a well known function for experienced developers, but there is one documented feature of it that doesn&#8217;t always catch one&#8217;s eye and it&#8217;s a general form for clustering a data series into n-length groups <strong>zip(*[iter(s)]*n)</strong> which is described in official docs for <a href="http://docs.python.org/library/functions.html">zip built-in</a>.</p>
<p>With that in mind solution to my problem boils down to a one-line decoder:</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#00ff00;background-color:#0C1021;">&gt;&gt;&gt; </span><span style="font-weight:bold;">s = 'FFDDEE'</span>
<span style="color:#00ff00;background-color:#0C1021;">&gt;&gt;&gt; </span><span style="font-weight:bold;">[int(''.join(pair), 16) for pair in zip(*[iter(s)]*2)]</span>
[255, 221, 238]</pre>
<p>For those wondering how it works:</p>
<p>1) <em>iter(s)</em> creates iterable from the <em>s</em></p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#00ff00;background-color:#0C1021;">&gt;&gt;&gt; </span><span style="font-weight:bold;">iter(s)</span>
&lt;iterator object at 0x8a3c2cc&gt;</pre>
<p>2) <em>[iter(s)] * 2</em> creates list of 2 iterators that all use the same underlying iterable <em>iter(s)</em>. The important thing is that created iterators <strong><em>share the same iterable</em></strong>, so when some data is consumed by first iterator that data becomes unavailable for the second iterator and vice versa.</p>
<p>You can see from the output that iterator objects are located at the same address. If you are new to this behavior you can read on about <a href="http://docs.python.org/library/stdtypes.html#typesseq">shallow copies</a>.</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#00ff00;background-color:#0C1021;">&gt;&gt;&gt; </span><span style="font-weight:bold;">[iter(s)]*2</span>
[&lt;iterator object at 0x8a3c2cc&gt;, &lt;iterator object at 0x8a3c2cc&gt;]</pre>
<p>3) leading <strong>*</strong> in zip&#8217;s parameter unpacks list from step (2) into two separate parameters for zip function. Basically it becomes <em>zip(iterator, iterator)</em>.</p>
<p>More about unpacking argument list you can read in official <a href="http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists">docs</a>.</p>
<pre style="color:#F8F8F8;background-color:#0C1021;font-size:8pt;"><span style="color:#00ff00;background-color:#0C1021;">&gt;&gt;&gt; </span><span style="font-weight:bold;">zip(*[iter(s)]*2)</span>
[('F', 'F'), ('D', 'D'), ('E', 'E')]</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=68&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2009/03/20/decode-hex-pairwise-with-zip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
		<item>
		<title>Grok Awesome</title>
		<link>http://ruslanspivak.com/2009/03/12/grok-awesome/</link>
		<comments>http://ruslanspivak.com/2009/03/12/grok-awesome/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 20:15:07 +0000</pubDate>
		<dc:creator>Ruslan Spivak</dc:creator>
				<category><![CDATA[grok]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://ruslanspivak.com/?p=49</guid>
		<description><![CDATA[I&#8217;ve started developing blog software for &#8220;A Smashing Web Framework&#8221; Grok. The reasons behind that: There is no full-featured blog software for Grok. There is a simple version Grokstar, but as for me it doesn&#8217;t fit the bill. I created simple blog for Zope3 several years ago and let it languish. Now it&#8217;s time to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=49&subd=ruslanspivak&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started developing blog software for &#8220;A Smashing Web Framework&#8221; <a href="http://grok.zope.org/">Grok</a>.</p>
<p>The reasons behind that:</p>
<ul>
<li>There is no full-featured blog software for Grok. There is a simple version <a href="http://svn.zope.org/Grokstar/">Grokstar</a>, but as for me it doesn&#8217;t fit the bill.</li>
<li>I created simple blog for Zope3 several years ago and let it languish. Now it&#8217;s time to revive it taking into account how Grok simplifies development with Zope3 technologies.</li>
<li>I&#8217;m not completely happy with WordPress. For one thing, I&#8217;d like to have easy-to-use REST API so I can use it in my Emacs to make posts.</li>
<li>I simply love <a href="http://grok.zope.org/">Grok</a>. You should try it and you&#8217;ll love it too.</li>
</ul>
<p>My fledgling project lives on GitHub and it&#8217;s called <a href="http://github.com/rspivak/grok-awesome/tree/master">grok-awesome</a> :)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ruslanspivak.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ruslanspivak.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ruslanspivak.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ruslanspivak.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ruslanspivak.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ruslanspivak.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ruslanspivak.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ruslanspivak.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ruslanspivak.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ruslanspivak.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ruslanspivak.com&blog=1522719&post=49&subd=ruslanspivak&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://ruslanspivak.com/2009/03/12/grok-awesome/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4d73d92d1e35b86c5c45667b7a036da3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">alienoid</media:title>
		</media:content>
	</item>
	</channel>
</rss>