<?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>CS developers</title>
	<atom:link href="http://codesyntax.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codesyntax.wordpress.com</link>
	<description>Bob's your uncle</description>
	<lastBuildDate>Wed, 17 Sep 2008 11:10:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codesyntax.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>CS developers</title>
		<link>http://codesyntax.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codesyntax.wordpress.com/osd.xml" title="CS developers" />
	<atom:link rel='hub' href='http://codesyntax.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Case study: EuskalKultura.com. Improving the performance of a Plone Site</title>
		<link>http://codesyntax.wordpress.com/2008/09/17/case-study-euskalkulturacom-improving-the-performance-of-a-plone-site/</link>
		<comments>http://codesyntax.wordpress.com/2008/09/17/case-study-euskalkulturacom-improving-the-performance-of-a-plone-site/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 11:10:45 +0000</pubDate>
		<dc:creator>erral</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[btree]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[zodb]]></category>

		<guid isPermaLink="false">http://codesyntax.wordpress.com/?p=17</guid>
		<description><![CDATA[We published EuskalKultura.com in early June. EuskalKultura is a website for Basque people living far away from is homeland, mainly in America (both southern and northern America). It&#8217;s just a Plone 2.5 with some custom products such as birthday greetings and other one or two custom archetypes with 3 or 4 fields. But the main [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=17&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We published <a href="http://www.euskalkultura.com">EuskalKultura.com</a> in early June. EuskalKultura is a website for Basque people living far away from is homeland, mainly in America (both southern and northern America). It&#8217;s just a Plone 2.5 with some custom products such as birthday greetings and other one or two custom archetypes with 3 or 4 fields.</p>
<p>But the main work before publishing it was to import the information of the <a href="http://web.archive.org/web/20070515003751/http://www.euskalkultura.com/">old website</a>. The old site was a PHP based website with lots and lots of items (mainly news items but also events, restaurant information, interviews, &#8230;), all of then multilingual, mainly in Basque and Spanish. So we have to write some scripts to pull the data from the MySQL database and create the content in Plone throug invokeFactory, with the usual UnicodeDecodeErrors <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>After testing it we managed to import all the data and create all that newsitems and events, all of them properly linked thanks to <a href="http://plone.org/products/linguaplone">LinguaPlone</a> to have fully translated website.</p>
<p>Short after publishing the website, we discovered that it was consuming a lot of RAM. We hosted it in a memory limited account in a FreeBSD account at <a href="http://highspeedrails.com">HighSpeedRails</a>, but we have both excessive use of RAM and constant restarts. HighSpeedRails provides some scripts to control the memory consumption of your Zope applications, and restarts it when passes the established limit. We also tried to upgrade the memory limit, and put it higher, but our Plone started to eat all available memory in the hosting service.</p>
<p>So, we decided to reproduce the situation locally, fix it if possible and reproduce again the fixed website.</p>
<p>Thanks to <a href="http://pypi.python.org/pypi/zc.buildout">zc.buildout</a>, reproducing the environment was quite easy, I just had to checkout the corresponding buildout from our svn server and run ./bin/buildout. We downloaded the 1.5 GB size Data.fs and <a href="http://www.flickr.com/photos/libargutxi">Lur</a> wrote a python script to try to reproduce server&#8217;s load parsing <a href="http://apache.org">Apache</a> logs. In the meantime, I wrote a harder test-plan, using also Apache logs, to use it with <a href="http://jakarta.apache.org/jmeter/">JMeter</a>, taking many ideas from the <a href="http://www.openplans.org/projects/plone-performance-sprint-2007/benchmarking-with-jmeter">Plone Performance Sprint 2007</a>.</p>
<p>In our initial tests, we easily got our Plone site consume 700 MB (and growing) of RAM after running it for half an our (or less).</p>
<p>It was our, and client&#8217;s idea, to be able to select the content featured at the home, so we used <a href="http://plone.org/products/compositepack">CompositePack</a> to get it. We created a new layout for it, and write a browser view to avoid featured newsitems appear in the news listing. The code under the hood, was proved to be totally inefficient, and after some analysis of the website, we realized that the home page was automatic, I mean, our client wasn&#8217;t using that feature.-</p>
<p>Our client, also used newsitems (all of them saved inside a folder) to create diferent kind of newsitems: short articles, featured newsitems, common newsitems, &#8230; and wanted to show in the home page all newsitems except the ones keyworded as XXXX. Again, the code to get that newsitem was highly inneficient.</p>
<p>So, we decided to get rid of CompositePack for the home page, and to use <a href="http://www.dieter.handshake.de/pyprojects/zope/AdvancedQuery.html">AdvancedQuery</a> to be able to make <em>not</em> queries to the Plone Catalog.</p>
<p>Those minor changes, proved to be great, because the navigation on the website improved a lot, it was quite faster, and the response time of the home paged decreased notably.</p>
<p>Another bottleneck was found in the keyword portlet. Our client uses keywords to tag news items and events, and wanted a way to have a list of all keywords used in news items and events, each one in the corresponding section. We fastly created a view getting those keywords from the catalog (with a catalog query and a inneficient algorithm <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ), and using the strategy copied from <a href="http://plone.org/products/quills">Quills</a>, we created a <a href="http://dev.plone.org/collective/browser/Quills/branches/1.5/traversal.py">traversal adapter</a> to have a view with all the news items keyworded with the selected one. The process of getting the list of needed keywords was slow, so we changed it with a static list of keywords, updated on daily-basis through a cronjob.</p>
<p>We also moved all news items stored in plain Plone folders to <a href="http://dev.plone.org/plone/browser/CMFPlone/branches/2.5/profiles/default/types/Large_Plone_Folder.xml">Plone Large Folders</a> (based on BTrees and disabled out-of-the-box in Plone 2.5). We had no ordering requirements in the news items or events folder, because their main view is a properly configured Topic/Collection, so the change wasn&#8217;t dramatic, but time-consuming. It took hours to cut-and-paste and recatalog all that news item and events.</p>
<p>We also took a look on all customized templates, and made some improvements to avoid common Plone problems: avoid using <em>getObject</em> once and again, use existing views instead of <em>home-made-scripts</em>, &#8230;</p>
<p>Finaly, we also removed from our buildout some unneeded products, improved the packaging of our base products and put the zodb-object-cache option to the default (5000 objects).</p>
<p>After running again the python script and the JMeter test plan <strong>together</strong>, we found that our Plone site wasn&#8217;t consuming more than 300 MB of RAM, although having the script running all the night. <strong>Incredible!!!</strong></p>
<p>We made some more tests, changin the zodb-object-cache option of our Zope instance, to a more significant value (<a href="http://hvelarde.vox.com/library/post/zodb-performance-a-small-change-can-make-a-big-difference.html">following Hector Velarde&#8217;s advice</a>). We tried with 10000, 20000, 30000 or 50000, but we didn&#8217;t get any improvement neither in memory consumption nor in CPU usage according to <em>top</em> (OK, perhaps this is not the way to monitor a process, but that&#8217;s the way we were taught <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ), so we decided to set the value to 5000.</p>
<p>So, we downloaded the live Data.fs on friday (thanks <em>cron</em>), run the news items and events cut-and-paste scripts on saturday and sunday, make all the changes on monday and re-upload the Data.fs again on monday midnight. On tuesday, we just made the last configuration changes, and got it running.</p>
<p>After 8 hours running, it&#8217;s just consuming 340 MB of RAM, some more than in our local tests, but far away from the 700 MB-after-5-minutes, we had in the previous situation.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codesyntax.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codesyntax.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codesyntax.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codesyntax.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codesyntax.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codesyntax.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codesyntax.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codesyntax.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codesyntax.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codesyntax.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codesyntax.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codesyntax.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codesyntax.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codesyntax.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codesyntax.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codesyntax.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=17&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codesyntax.wordpress.com/2008/09/17/case-study-euskalkulturacom-improving-the-performance-of-a-plone-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04461b7e97f449ee55d05045186dd64f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">erral</media:title>
		</media:content>
	</item>
		<item>
		<title>My Plone doesn&#8217;t show translated msgids located in a locales directory !!</title>
		<link>http://codesyntax.wordpress.com/2008/04/16/plone-doesnt-show-translated-msgids/</link>
		<comments>http://codesyntax.wordpress.com/2008/04/16/plone-doesnt-show-translated-msgids/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 11:34:34 +0000</pubDate>
		<dc:creator>erral</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[five]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[pts]]></category>
		<category><![CDATA[zope3]]></category>

		<guid isPermaLink="false">http://codesyntax.wordpress.com/?p=16</guid>
		<description><![CDATA[In a project I&#8217;m currently working on, I have written a product following the new way of writing Plone products: creating an egg and putting its translations in a locales directory. After translating the msgids, creating the po files and reading once and again the Maurits&#8217; post although I&#8217;m on Plone 2.5, I was seeing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=16&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In a project I&#8217;m currently working on, I have written a product following the <em>new way</em> of writing Plone products: creating an egg and putting its translations in a locales directory.</p>
<p>After translating the msgids, creating the po files and reading once and again the <a href="http://maurits.vanrees.org/weblog/archive/2007/09/i18n-locales-and-plone-3.0">Maurits&#8217; post</a> although I&#8217;m on Plone 2.5, I was seeing always the same translated strings, always in the language my browser was configured in, no matter I changed the language using Plone&#8217;s language selector.</p>
<p>After googling a bit, I found this <a href="http://codespeak.net/z3/five/i18n.html">Five and i18n tutorial</a> in which Phillip says:</p>
<blockquote><p>The goal of the sprint was to allow both fallback translation services (PTS, Localizer) and Zope 3 translation domains come to the same conclusion regarding which language should be chosen.  The use case is that you have a site running Localizer or PTS and a bunch of &#8220;old&#8221; products using either one of those for translation.  Now you have an additional, &#8220;new&#8221; Five-based product using Zope 3 translation domains. Most of the time, a page contains user messages from more than one domain, so you would all domains be translated to the same language.</p></blockquote>
<p>So, I just have to add an overrides.zcml file to my product (and load it in my buildout), with the following content:<br />
<code><br />
&lt;adapter<br />
for="zope.publisher.interfaces.http.IHTTPRequest"<br />
provides="zope.i18n.interfaces.IUserPreferredLanguages"<br />
factory="Products.Five.i18n.PTSLanguages"<br />
/&gt;</code></p>
<p>Now, Five and Zope3 components of my Plone site, negotiate the language just like PTS does, so I have correctly translated msgids in my site.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codesyntax.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codesyntax.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codesyntax.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codesyntax.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codesyntax.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codesyntax.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codesyntax.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codesyntax.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codesyntax.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codesyntax.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codesyntax.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codesyntax.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codesyntax.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codesyntax.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codesyntax.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codesyntax.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=16&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codesyntax.wordpress.com/2008/04/16/plone-doesnt-show-translated-msgids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04461b7e97f449ee55d05045186dd64f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">erral</media:title>
		</media:content>
	</item>
		<item>
		<title>Painless big XML file parsing in Python</title>
		<link>http://codesyntax.wordpress.com/2008/03/05/painless-big-xml-file-parsing-in-python/</link>
		<comments>http://codesyntax.wordpress.com/2008/03/05/painless-big-xml-file-parsing-in-python/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 15:50:14 +0000</pubDate>
		<dc:creator>Mikel Larreategi</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[python xml kelpi]]></category>

		<guid isPermaLink="false">http://codesyntax.wordpress.com/?p=15</guid>
		<description><![CDATA[Parsing big (some 60 MB is already big for me) XML files in Python was a bit painful until now. I used to import minidom and sometimes sax. The problem with minidom is that the whole XML file loads into memory and you can&#8217;t do anything else until you process the file. If you do [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=15&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Parsing big (some 60 MB is already big for me) XML files in Python was a bit painful until now. I used to import <a href="http://docs.python.org/lib/module-xml.dom.minidom.html"><b>minidom</b></a> and sometimes <a href="http://docs.python.org/lib/module-xml.sax.html"><b>sax</b></a>.</p>
<p>The problem with minidom is that the whole XML file loads into memory and you can&#8217;t do anything else until you process the file. If you do it with sax, you have to work detecting every element start and end.</p>
<p>I learnt today a better solution from Erral: using <b><a href="http://codespeak.net/lxml/">lxml</a></b> . Just a couple of lines so that you see how can we convert an XML file into a list of dicts. Just like:</p>
<pre>
from lxml import etree
coords = etree.parse("/path/to/your/xml/file").getroot()
coords_list = []
for coord in coords:
    this = {}
    for child in coord.getchildren():
        this[child.tag] = child.text
        coords_list.append(this)</pre>
<p>Quite straightforward, isn&#8217;t it? It&#8217;s already in Kelpi: <a href="http://kelpi.com/script/e83d7e">XML to list of dict parsing</a></p>
<p>(posted by Gari)</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codesyntax.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codesyntax.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codesyntax.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codesyntax.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codesyntax.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codesyntax.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codesyntax.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codesyntax.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codesyntax.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codesyntax.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codesyntax.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codesyntax.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codesyntax.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codesyntax.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codesyntax.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codesyntax.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=15&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codesyntax.wordpress.com/2008/03/05/painless-big-xml-file-parsing-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/57ed3c23cf3f0fda234ca3eaee30772f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">CodeSyntax</media:title>
		</media:content>
	</item>
		<item>
		<title>Paster is your friend</title>
		<link>http://codesyntax.wordpress.com/2008/02/26/paster-is-your-friend/</link>
		<comments>http://codesyntax.wordpress.com/2008/02/26/paster-is-your-friend/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 09:03:46 +0000</pubDate>
		<dc:creator>erral</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[code-generation]]></category>
		<category><![CDATA[paster]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://codesyntax.wordpress.com/?p=14</guid>
		<description><![CDATA[If you are starting a new Plone project, paster is definetely your friend. Your necesary and helpful friend.paster can be seen as a code generation tool, and perhaps it can be seen as something to avoid, but it helps, and helps a lot, to write all that boilerplate code you need to write each time [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=14&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are starting a new <a href="http://plone.org/products/plone" class="reference">Plone</a> project, <a href="http://pythonpaste.org/script" class="reference">paster</a> is definetely your friend. Your necesary and helpful friend.<a href="http://pythonpaste.org/script" class="reference">paster</a> can be seen as a code generation tool, and perhaps it can be seen as something to avoid, but it helps, and helps a lot, to write all that <i>boilerplate</i> code you need to write each time you start a <a href="http://plone.org/products/plone" class="reference">Plone</a> project, such as the buildout.cfg file (now that <a href="http://pypi.python.org/pypi/zc.buildout" class="reference">zc.buildout</a> seems to be the <i>de facto</i> standard to manage both development and deployment of <a href="http://plone.org/products/plone" class="reference">Plone</a> projects), skin, css and javascript registratin in a so called <i>theme product</i>, or new profile and content-type registration ina <i>content-type</i> or <i>archetype</i> product.</p>
<p>One of the thing I like the most from <a href="http://pythonpaste.org/script" class="reference">paster</a> is the &#8216;&#8211;svn-repository&#8217; option. Before using paste, I found myself many times importing incomplete projects to our svn repository or deleting and later checkouting products. Now, each time I create a new product, or egg, I only have to add a &#8216;&#8211;svn-repository=http://url-to-my-svn&#8217; and I&#8217;m done. <a href="http://pythonpaste.org/script" class="reference">paster</a> creates the <i>trunk</i>, <i>branches</i> and <i>tags</i> structure, it checkouts the trunk, adds the files, and everything is set to start working.<a href="http://pythonpaste.org/script" class="reference"></a></p>
<p><a href="http://pythonpaste.org/script" class="reference">paster</a> would be nothing for <a href="http://plone.org/products/plone" class="reference">Plone</a> if <a href="http://plone.org/products/zopeskel" class="reference">ZopeSkel</a> wouldn&#8217;t exist. <a href="http://plone.org/products/zopeskel" class="reference">ZopeSkel</a> is a collection of <a href="http://pythonpaste.org/script" class="reference">paster</a> templates you can use to create your producs. For example, there is a template to create a <i>theme product</i> or a buildout file or an archetypes based product. To use is, you just have to invoke paster with the name of the template:</p>
<pre>erral@lindari:/tmp$ paster create -t plone3_buildout myproject --svn-repository=http://myurl</pre>
<p>Answer just a couple of questions and you&#8217;ll have a ready-to-go buildout configuration file in your repository.</p>
<p>The <i>archetype</i> template and the support of local <a href="http://plone.org/products/zopeskel" class="reference">ZopeSkel</a> commands (as <a href="http://www.mustap.com/pythonzone_post_234_zopeskel-with-local-commands" class="reference">explained by Mustapha</a> helps you to create a new <a href="http://plone.org/products/archetypes" class="reference">Archetypes</a> based content-type. But not only it creates the base <i>boilerplate</i> code. Thanks to the local-command support, you can add new content-types, new portlets or even new browser views, just anytime after creating the project. You can add today a browser view, and tomorrow a new content-type. You just have to worry to invoke the correct <a href="///home/erral/Desktop/paster.html#id1" title="id2" name="id2"><span class="problematic">`</span></a>paster`command, everything else (add configure.zcml lines, new Generic Setup profile configuration files, etc) is done by <a href="http://pythonpaste.org/script" class="reference">paster</a>:</p>
<pre>erral@lindari:/tmp$ paster create -t archetype my.content
...
erral@lindari:/tmp$ cd my.content/
erral@lindari:/tmp$ ls
erral@lindari:/tmp/my.content$ paster addcontent --list
Available templates:
  atschema:     A handy AT schema builder
  contenttype:  A content type skeleton
  portlet:      A Plone 3 portlet
  view:         A browser view skeleton
  zcmlmeta:     A ZCML meta directive skeleton
erral@lindari:/tmp/my.content$ ls my/content/
browser    configure.zcml  __init__.py    portlets  tests
config.py  content         interfaces.py  profiles  tests.py
erral@lindari:/tmp/my.content$ paster addcontent contenttype
...
erral@lindari:/tmp/my.content$ ls my/content/content
configure.zcml  __init__.py  mynewcontenttype.py</pre>
<p>Awesome !!!</p>
<p>Many people don&#8217;t like code generation tools. I don&#8217;t know I should call <a href="http://pythonpaste.org/script" class="reference">paster</a> a code generation tool or a <i>helpful-boilerplate-writing-avoider-tool</i>. Is something <b>you will want to use</b> after trying it for the first time.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codesyntax.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codesyntax.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codesyntax.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codesyntax.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codesyntax.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codesyntax.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codesyntax.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codesyntax.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codesyntax.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codesyntax.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codesyntax.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codesyntax.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codesyntax.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codesyntax.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codesyntax.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codesyntax.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=14&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codesyntax.wordpress.com/2008/02/26/paster-is-your-friend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04461b7e97f449ee55d05045186dd64f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">erral</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Plone4ArtistsAudio in a zc.buildout based Plone installation</title>
		<link>http://codesyntax.wordpress.com/2008/01/22/using-plone4artistsaudio-in-a-zcbuildout-based-plone-installation/</link>
		<comments>http://codesyntax.wordpress.com/2008/01/22/using-plone4artistsaudio-in-a-zcbuildout-based-plone-installation/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 16:45:44 +0000</pubDate>
		<dc:creator>erral</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[buildout]]></category>
		<category><![CDATA[plone4artists]]></category>
		<category><![CDATA[plone4artistsaudio]]></category>

		<guid isPermaLink="false">http://codesyntax.wordpress.com/2008/01/22/using-plone4artistsaudio-in-a-zcbuildout-based-plone-installation/</guid>
		<description><![CDATA[For two recently launched websites (Karkara.com and Eibar.org) I have used Plone4ArtistsAudio, to easily create an audio album with podcasting capabilities without creating a new content-type. P4AAudio, is a product for Plone that exposes some python libraries to re-use common Plone content-types, like Files, to use them like an audio album. For example, Gari has [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=11&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For two recently launched websites (<a href="http://www.karkara.com" title="Karkara.com: Orioko eta Aiako orainkaria">Karkara.com</a> and <a href="http://eibar.org" title="Eibar.ORG: Eibarko peoria">Eibar.org</a>) I have used <a href="http://plone4artists.org/products/plone4artistsaudio/">Plone4ArtistsAudio,</a> to easily create an audio album with podcasting capabilities without creating a new content-type. P4AAudio, is a product for <a href="http://plone.org">Plone</a> that exposes some python libraries to re-use common Plone content-types, like Files, to use them like an audio album.</p>
<p>For example, Gari has in <a href="http://eibar.org/blogak/teknosexua">his blog</a> a folder called <i>podcast,</i> where he uploads <a href="http://eibar.org/blogak/teknosexua/podcast">his radio programs</a> broadcasted by <a href="http://www.eitb.com" title="http://www.eitb.com/euskadiirratia/">Euskadi Irratia</a> every two weeks. I added Plone4ArtistsAudio to this Plone installation and enabled media in this folder, and only in this folder, and all audio files uploaded like Plone standard files were audio enhanced <i>automagically</i> to have this pretty look and feel.</p>
<p><img src="http://codesyntax.files.wordpress.com/2008/01/podcast-gari.jpg?w=450" alt="Gari’s podcast folder" /></p>
<p>This is pretty cool: I had to add no custom content-type (so, no new portal types) to Plone. Some zope3 concepts like interfaces, adaptation or event subscribers are used by Plone4ArtistsAudio to create this product.</p>
<p>But everything has its cons. The installation of Plone4ArtistsAudio was a pain. In our latest projects we have used <a href="http://pypi.python.org/pypi/zc.buildout">zc.buildout</a> to deploy our sites following <a href="http://martinaspeli.net">Martin</a>&#8216;s <a href="http://plone.org/documentation/tutorial/buildout" title="zc.buildout tutorial">tutorial on Plone.org</a> and many other suggestions from Plone community.</p>
<p>Plone4ArtistsAudio is just a bundle of python modules p4a.audio, p4a.ploneaudio, p4a.common, p4a.z2utils and plone.app.form. It ships all these modules inside a folder called pythonlib and it add this folder to the sys.path when loading.</p>
<p>For some reason, this way of including the modules in the PYTHONPATH is not compatible with the <i>buildout way of working</i>, because when starting, zope complained about plone.app.form not being found.</p>
<p>After some searching on the Internet, I found that <a href="http://tinyurl.com/2clwma">something similar</a> happened with <a href="http://plonegetpaid.com">PloneGetPaid</a> but I couldn&#8217;t fix it. So, after some help by Tim Terlegård, I decided to leave Plone4ArtistsAudio in my products folder, but add the libraries it ships as develop-eggs. Be careful, you cannot add this libraries directly as installable eggs from the PyPI, because some of them are marked to be zip_safe eggs, which aren&#8217;t because they need the zcml files inside them loaded by Zope.</p>
<p>So, my buildout.cfg file is now something like this:</p>
<pre>[buildout]
newest = false
index = http://download.zope.org/ppix
versions = versions

parts =
    plone
    zope2
    productdistros
    cachefu
    instance zopepyeggs =
    elementtree
    p4a.audio
    p4a.common
    p4a.fileimage
    p4a.ploneaudio
    p4a.z2utils
    plone.app.form

develop =
    src/p4a.audio
    src/p4a.common
    src/p4a.fileimage
    src/p4a.ploneaudio
    src/p4a.z2utils
    src/plone.app.form  [...]</pre>
<p>And svn:externals set to the following URLs inside src directory:</p>
<pre>
p4a.audio http://www.plone4artists.org/svn/projects/p4a.audio/tags/release-1.0.1/
p4a.ploneaudio http://www.plone4artists.org/svn/projects/p4a.ploneaudio/tags/release-1.0.1/
p4a.common http://www.plone4artists.org/svn/projects/p4a.common/tags/release-1.0/
p4a.z2utils http://www.plone4artists.org/svn/projects/p4a.z2utils/tags/release-1.0/
p4a.fileimage http://www.plone4artists.org/svn/projects/p4a.fileimage/tags/release-1.0/
plone.app.form -r 18164 https://svn.plone.org/svn/plone/plone.app.form/branches/plone-2.5/</pre>
<p>So, Plone4ArtistsAudio is a great product, it provides not only a nice interface without adding new content types, but also uses zope3 concepts like interfaces, adapters and subscriber and it also provides a podcast RSS feed, but its installation is not as easy as dropping the product in the Products folder.</p>
<p>Wow, this first post was quite long, but I hope it will be helpful for those trying to install Plone4ArtistsAudio in their buildout based Plone.</p>
<p>Happy <i>Ploning</i> and happy <i>buildouting..</i> <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/codesyntax.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/codesyntax.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codesyntax.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codesyntax.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codesyntax.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codesyntax.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codesyntax.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codesyntax.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codesyntax.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codesyntax.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codesyntax.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codesyntax.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codesyntax.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codesyntax.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codesyntax.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codesyntax.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codesyntax.wordpress.com&amp;blog=2544240&amp;post=11&amp;subd=codesyntax&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codesyntax.wordpress.com/2008/01/22/using-plone4artistsaudio-in-a-zcbuildout-based-plone-installation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/04461b7e97f449ee55d05045186dd64f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">erral</media:title>
		</media:content>

		<media:content url="http://codesyntax.files.wordpress.com/2008/01/podcast-gari.jpg" medium="image">
			<media:title type="html">Gari’s podcast folder</media:title>
		</media:content>
	</item>
	</channel>
</rss>
