<?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>Digital snake and family</title>
	<atom:link href="http://glenfant.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://glenfant.wordpress.com</link>
	<description>Gossips about the Plone CMS, general Python based technologies and sometimes about beer, girls and blues</description>
	<lastBuildDate>Mon, 07 Nov 2011 00:02:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='glenfant.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Digital snake and family</title>
		<link>http://glenfant.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://glenfant.wordpress.com/osd.xml" title="Digital snake and family" />
	<atom:link rel='hub' href='http://glenfant.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Step debugging a Zope 2 / Plone instance with Eclipse + PyDev</title>
		<link>http://glenfant.wordpress.com/2011/11/07/step-debugging-zope-eclipse-pydev/</link>
		<comments>http://glenfant.wordpress.com/2011/11/07/step-debugging-zope-eclipse-pydev/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 00:02:48 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Zope 2]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=94</guid>
		<description><![CDATA[Hi, Most power users mays already know this. But this is a real enlightenment for newbies who are stuck with the command line pdb utility. Even for experienced developper as I am&#8230; supposed to be, this is a real advantage to have on screen at the same time the source code, with breakpoints in the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=94&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>Most power users mays already know this. But this is a real enlightenment for newbies who are stuck with the command line pdb utility. Even for experienced developper as I am&#8230; supposed to be, this is a real advantage to have on screen at the same time the source code, with breakpoints in the margin of it, the inspector for your global and local variables, the access to the call stack and execution frames.</p>
<p>Start reading <a href="http://www.pydev.org/manual_adv_remote_debugger.html">the fine manual here</a> and come back reading how to get this in Zope 2.</p>
<p>Of course I assume you have a recent Eclipse (Indigo) and Pydev (2.2.4)</p>
<p>Find in your Eclipse software directory the full path of the directory that contains &#8220;<strong>pydevd.py</strong>&#8220;. In other words :</p>
<pre>$ cd /your/eclipse/root
$ find . -name 'pydevd.py'</pre>
<p>In my MacBook the file is found in &#8220;<strong>/Developer/eclipse/plugins/org.python.pydev.debug_2.2.4.2011110216/pysrc</strong>&#8220;</p>
<p>(note that upgrades of PyDev may change this path to something else)</p>
<p>Edit your development buildout config file and add this in your plone.recipe.zope2instance part:</p>
<pre>[instance]
# recipe = plone.recipe.zope2instance
...
extra-paths =
    /Developer/eclipse/plugins/org.python.pydev.debug_2.2.4.2011110216/pysrc</pre>
<p>Of course re-run your buildout. Open the debug perspective in Eclipse and start the PyDev debugger server (see link above).</p>
<p>You can now add anywhere you want (need) the line &#8220;<strong>import pydevd;pydevd.set_trace()</strong>&#8220;, or use the shortcut &#8220;<strong>pydevd</strong>&#8221; to insert your first hard breakpoint.</p>
<p>Start your Zope instance and make the necessary clicks to execute the line that has the hard breakpoint. Wow, great : the next line of Python to be executed is hilited from there, you cand step, step over, go to the next return, and even add soft breakpoint double clicking in the left margin anywhere in your source code.</p>
<p>All other things you may need to know about debugging with PyDev <a href="http://www.pydev.org/manual_adv_debugger.html">are here</a> and usable &#8220;as is&#8221; in a Zope server.</p>
<p>Another great feature for those who develop with Windows : when debugging with Eclipse/Pydev you can start your development instance as a service, when before you needed to run the sloooooow &#8220;instance fg&#8221; and benefit of Eclipse remote debugging.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=94&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2011/11/07/step-debugging-zope-eclipse-pydev/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>
	</item>
		<item>
		<title>Bootstrap and install a buildout based project without Internet connection</title>
		<link>http://glenfant.wordpress.com/2011/07/31/bootstrap-and-install-a-buildout-based-project-without-internet-connection/</link>
		<comments>http://glenfant.wordpress.com/2011/07/31/bootstrap-and-install-a-buildout-based-project-without-internet-connection/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 19:30:21 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Buildout]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=74</guid>
		<description><![CDATA[Background Complex Python based solutions are now built with the great zc.buildout, like complicated ZEO clusters with heavily customized Plone site or others. zc.buildout is a great solution that&#8217;s now essential to share among developers a custom project as well as for distributing to users or customers. As everybody know, zc.buildout grabs components from the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=74&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Background</h2>
<p>Complex Python based solutions are now built with the great <strong>zc.buildout</strong>, like complicated ZEO clusters with heavily customized Plone site or others.</p>
<p>zc.buildout is a great solution that&#8217;s now essential to share among developers a custom project as well as for distributing to users or customers. As everybody know, zc.buildout grabs components from the Internet (mostly from the Pypi site) and makes the application assembling those components according to the integration directives in the various *.cfg files. But talking about zc.buildout in details in not the purpose of this blog post of course.</p>
<p>Installing the solution in the customer&#8217;s computers is supposed to be easy and straightforward. &#8220;Unfortunately&#8221;, running zc.buildout requires to bootstrap the project with the famous &#8220;<a title="bootstrap.py script" href="http://svn.zope.org/repos/main/zc.buildout/trunk/bootstrap/bootstrap.py">bootstrap.py</a>&#8221; file.</p>
<p>This script downloads and installs some essential resources that enable to run the &#8220;bin/buildout&#8221; command, like <a title="distribute @ Pypi" href="http://pypi.python.org/pypi/distribute">distribute</a> and <a title="zc.buildout @ Pypi" href="http://pypi.python.org/pypi/zc.buildout">zc.buildout</a> itself. But with some customers, there is no possible Internet connection on the installation target, due to a <del>paranoïd</del> strict security policy. And I don&#8217;t want to write a complicated installation manual that works around this issue. In addition, these customer have little or no IT required skills.</p>
<p>After asking to some experts in the Plone mailing lists, some answers provided some pointers from which I made my &#8220;<a href="http://plone.fr/Members/glenfant/offline_bootstrap.py/view">offline_bootstrap.py</a>&#8221; script that must be used in place of the classical &#8220;bootstrap.py&#8221; script in such situations.</p>
<h2>The solution</h2>
<h3>Prepare your buildout structure</h3>
<p>In particular, you must ensure that your &#8220;buildout.cfg&#8221; file has these options:</p>
<pre>[buildout]
...
# All packages are downloaded locally.
download-cache = downloads
# All eggs are installed here
eggs-directory = eggs
# You need this if there is an "extends = http://..."
extends-cache = ext-cache
...
versions = versions
...
[versions]
...
# Freeze your zc.buildout preferred version!
zc.buildout = x.y.z</pre>
<p>Add to the buildout directory the <a href="http://plone.fr/Members/glenfant/offline_bootstrap.py/view">&#8220;offline_bootstrap.py&#8221; script you can grab here</a>.</p>
<p>From the same place add a &#8220;<strong>bootstrap_resources/</strong>&#8221; directory. In this directory, add:</p>
<ul>
<li>&#8220;<a href="http://python-distribute.org/distribute_setup.py">distribute_setup.py</a>&#8220;</li>
<li>&#8220;<strong>distribute-x.y.z.tar.gz</strong>&#8220;. <em>Important</em>: Use the same version as the one indicated by the <strong>DEFAULT_VERSION</strong> in above mentioned &#8220;<strong>distribute_setup.py</strong>&#8220;. <a href="http://pypi.python.org/pypi/distribute">Find it from here</a>.</li>
<li>&#8220;<strong>zc.buildout-x.y.z.tar.gz</strong>&#8220;. <em>Important</em>: Use exactly the same version as the one pinned in your &#8220;<strong>buildout.cfg</strong>&#8221; as above described. <a href="http://pypi.python.org/pypi/zc.buildout">Find it from here</a></li>
</ul>
<p>From now you can bootstrap your zc.buildout and carry on  developing/testing/documenting your Python project as usual.</p>
<h2>Installing in an no-Internet platform</h2>
<p>Your beautiful project is ready to be installed in a customer computer that has no connection to the Internet. First add a new file in your buildout: &#8220;<strong>production_install.cfg</strong>&#8221; with these few lines:</p>
<pre>[buildout]
extends = production.cfg
install-from-cache = true
offline = true
newest = false</pre>
<p>Of course, I assume you made a &#8220;<strong>production.cfg</strong>&#8221; buildout profile that smiles on your integration platform.</p>
<p>You may now remove the database (typically the &#8220;<strong>var/</strong>&#8221; folder) from the buildout directory and make a tarball.</p>
<p>Inflate this tarball in the place your customer wants it on his computer. From the newly created folder, you just need to say this to the console :</p>
<pre>$ python offline_bootstrap.py -c production_install.cfg
$ bin/buildout -c production_install.cfg</pre>
<p>That should be all unless other application specific operations.</p>
<h2>Other things about &#8220;offline_bootstrap.py&#8221;</h2>
<p>&#8220;<strong>offline_bootstrap.py</strong>&#8221; accepts any option and argument the usual &#8220;<strong>bootstrap.py</strong>&#8221; takes. Except &#8220;<strong>&#8211;setup-source</strong>&#8221; and &#8220;<strong>&#8211;download-base</strong>&#8221; that are set specifically by &#8220;<strong>offline_bootstrap.py</strong>&#8220;.</p>
<h2>Questions or comments ?</h2>
<p>&#8230; are welcome.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/74/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/74/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/74/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=74&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2011/07/31/bootstrap-and-install-a-buildout-based-project-without-internet-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>
	</item>
		<item>
		<title>ZCML Wadda ? Want a live ZCML doc ?</title>
		<link>http://glenfant.wordpress.com/2011/04/20/zcml-wadda-want-a-live-zcml-doc/</link>
		<comments>http://glenfant.wordpress.com/2011/04/20/zcml-wadda-want-a-live-zcml-doc/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 15:54:18 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Zope 2]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=55</guid>
		<description><![CDATA[Abstract ZCML is a great feature in Zope 2 since the first Five years. Exploring a well designed Python package starts with its ZCML files and its main &#8220;interfaces.py&#8221; module. But newbies as I have been and others have pain to remember the various ZCML directives available, as well as the detailed attributes of them. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=55&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Abstract</strong></p>
<p>ZCML is a great feature in Zope 2 since the first Five years. Exploring a well designed Python package starts with its ZCML files and its main &#8220;interfaces.py&#8221; module.</p>
<p>But newbies as I have been and others have pain to remember the various ZCML directives available, as well as the detailed attributes of them.</p>
<p>Of course there are some documentations in printed books or in various blogs or docs about most directives. But there&#8217;s no central point (unless I didn&#8217;t search correctly) where you can read the documentation for all ZCML directives available in <strong>your</strong> Zope 2 instance with third party components that could add new ZCML vocabulary.</p>
<p>Of course, you may grep all &#8220;meta.zcml&#8221; files in your instance, search for the appropriate namespace, then the appropriate directive. And finally open the Python file that defines the schema of the mysterious ZCML, just as I explained in <a title="Doing my ZCML" href="http://glenfant.wordpress.com/2008/05/09/doing-my-zcml/">another ZCML related blog post</a>.</p>
<p>Grepping the &#8220;zope.configuration&#8221;, I hopefully found a magic function that provides a structured tree of all the registered ZCML directives well suited to provide a live documentation.</p>
<p>After some hours of work and exploration, I&#8217;m proud to give to the Zope 2 community &#8220;<a title="aws.zope2zcmldoc on Pypi" href="http://pypi.python.org/pypi/aws.zope2zcmldoc" target="_blank">aws.zope2zcmldoc</a>&#8221; that provides a live documentation on all ZCML namespaces, directives and subdirectives installed in your Zope 2 instance.</p>
<p><strong>Some screenshots</strong></p>
<div id="attachment_56" class="wp-caption aligncenter" style="width: 371px"><a href="http://glenfant.files.wordpress.com/2011/04/control-panel.png"><img class="size-full wp-image-56" title="control-panel" src="http://glenfant.files.wordpress.com/2011/04/control-panel.png?w=361&#038;h=413" alt="Available from the standard Zope control panel" width="361" height="413" /></a><p class="wp-caption-text">Available from the standard Zope control panel</p></div>
<div id="attachment_59" class="wp-caption aligncenter" style="width: 460px"><a href="http://glenfant.files.wordpress.com/2011/04/namespaces.png"><img class="size-full wp-image-59" title="namespaces" src="http://glenfant.files.wordpress.com/2011/04/namespaces.png?w=450&#038;h=243" alt="All namespaces" width="450" height="243" /></a><p class="wp-caption-text">All ZCML namespaces</p></div>
<div id="attachment_60" class="wp-caption aligncenter" style="width: 460px"><a href="http://glenfant.files.wordpress.com/2011/04/browser-namespace.png"><img class="size-full wp-image-60" title="browser-namespace" src="http://glenfant.files.wordpress.com/2011/04/browser-namespace.png?w=450&#038;h=408" alt="The &quot;browser&quot; namespace" width="450" height="408" /></a><p class="wp-caption-text">All directives from the &quot;browser&quot; namespace</p></div>
<div id="attachment_63" class="wp-caption aligncenter" style="width: 460px"><a href="http://glenfant.files.wordpress.com/2011/04/browser-pages.png"><img class="size-full wp-image-63" title="The &quot;pages&quot; directive" src="http://glenfant.files.wordpress.com/2011/04/browser-pages.png?w=450&#038;h=365" alt="The &quot;pages&quot; directive" width="450" height="365" /></a><p class="wp-caption-text">The &quot;pages&quot; directive in details</p></div>
<p>You can notice that the description text are translated in your favorite language when the translation is available.</p>
<p>aws.zope2zcmldoc is the new companion of Products.DocFinderTab, plone.reload, Products.Clouseau and zope2.zodbbrowser (and perhaps others I forgot, sorry) to your development instances.</p>
<p>Any feedback, is welcome.  Enjoy !</p>
<p>Ah yes, and many thanks to my actual employer <a title="Alter Way" href="http://www.alterway.fr" target="_blank">Alter Way</a> for sponsoring this piece of software.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=55&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2011/04/20/zcml-wadda-want-a-live-zcml-doc/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>

		<media:content url="http://glenfant.files.wordpress.com/2011/04/control-panel.png" medium="image">
			<media:title type="html">control-panel</media:title>
		</media:content>

		<media:content url="http://glenfant.files.wordpress.com/2011/04/namespaces.png" medium="image">
			<media:title type="html">namespaces</media:title>
		</media:content>

		<media:content url="http://glenfant.files.wordpress.com/2011/04/browser-namespace.png" medium="image">
			<media:title type="html">browser-namespace</media:title>
		</media:content>

		<media:content url="http://glenfant.files.wordpress.com/2011/04/browser-pages.png" medium="image">
			<media:title type="html">The &#34;pages&#34; directive</media:title>
		</media:content>
	</item>
		<item>
		<title>Using ZODB3 3.8 with Plone 3</title>
		<link>http://glenfant.wordpress.com/2010/12/18/using-zodb3-3-8-with-plone-3/</link>
		<comments>http://glenfant.wordpress.com/2010/12/18/using-zodb3-3-8-with-plone-3/#comments</comments>
		<pubDate>Sat, 18 Dec 2010 15:08:32 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Zope 2]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=51</guid>
		<description><![CDATA[Background Lots of you are still in process of maintaining Plone 3 sites for yourself or customers and didn&#8217;t go to Plone 4 for some good reason. The Plone 3 bundle is powered and tested with the latest Zope 2.10. This Zope version itself includes ZODB3 3.7. That has lots of issues that are now [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=51&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Background</strong></p>
<p>Lots of you are still in process of maintaining Plone 3 sites for yourself or customers and didn&#8217;t go to Plone 4 for some good reason.</p>
<p>The Plone 3 bundle is powered and tested with the latest Zope 2.10. This Zope version itself includes ZODB3 3.7. That has lots of issues that are now gone with later versions.</p>
<p>But wait, it&#8217;s not possible to use ZODB3 3.10.x since it seems it requires Python 2.6. ZODB3 3.9.x too has too many API changes and it seems that we need to go to a full Zope 2.11 to support this lates version.</p>
<p>ZODB3 3.8 seems a reasonable choice to improve the persistence support of your Plone 3 apps.</p>
<ul>
<li>It compiles with Python 2.4- It has a lot of new features</li>
<li>It has a lot of bugfixes</li>
<li>It has lots of additional tests, thus should be more reliable</li>
</ul>
<p>Have a look at <a title="ZODB 3.8 Change log" href="http://pypi.python.org/pypi/ZODB3/3.8.6#whats-new-in-zodb-3-8-6-2010-09-21" target="_blank">http://pypi.python.org/pypi/ZODB3/3.8.6#whats-new-in-zodb-3-8-6-2010-09-21</a> to see all the details.</p>
<p>This sample buildout extends the standard &#8220;buildout.cfg&#8221; that comes with the ZopeSket template &#8220;plone3_buildout&#8221;, and replaces the ZODB3 that comes with Zope 2.1.0 by the ZODB3 3.8.6 egg, as well as some Zope 2 components that need an explicit upgrade to cope with this new ZODB3 version.</p>
<hr />
<pre>[buildout]
# buildout.cfg as built from plone3_buildout ZopeSkel template
extends = buildout.cfg
eggs +=
    zope.proxy
    ZODB3
    zodbcode
    tempstorage

[zope2]
skip-fake-eggs =
    ZODB3
    zope.proxy
    zodbcode
    tempstorage
[versions]
# Marked as additional fake egg in [zope2]
ZODB3 = 3.8.6
zope.proxy = 3.4
zodbcode = 3.4.0
tempstorage = 2.11.3</pre>
<hr />
<p><strong>Some warnings and gotchas</strong></p>
<ul>
<li>This configuration has been tested as simple instance deployment. I didn&#8217;t yet test a ZEO cluster in such situation.</li>
<li>This configuration has been tested successfully with only some well known third party extension : LinguaPlone, Collage, PloneFormgen, Ploneboard. Some third party Plone extensions that may play with ZODB inners should be tested in depth (run at least unit tests) before going in production.</li>
</ul>
<p><strong>Another thing</strong></p>
<p>If something is going wrong with this new ZODB, you can go back to the original ZODB3 that comes with Zope 2.10.x. Unless you have been playing with new storages and options that come with ZODB3 3.8.<br />
Any feedback of others who tried this recipe or similar ones is welcome.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=51&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2010/12/18/using-zodb3-3-8-with-plone-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>
	</item>
		<item>
		<title>Changing workflow state  &#8211; quickly &#8211; on CMF/Plone content</title>
		<link>http://glenfant.wordpress.com/2010/04/02/changing-workflow-state-quickly-on-cmfplone-content/</link>
		<comments>http://glenfant.wordpress.com/2010/04/02/changing-workflow-state-quickly-on-cmfplone-content/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 07:31:37 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Zope 2]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=41</guid>
		<description><![CDATA[The tip of the gruik(*)&#8230; I have been investigated some months ago with Encolpe Degoute on how to set a workflow state on a content when the workflow is DCWorkflow powered (Plone of course). Things are not that simple since DCWorkflow does not provide a public API for this. Instead, we must execute the various [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=41&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><em>The tip of the gruik(*)&#8230;</em></strong></p>
<p>I have been investigated some months ago with <a title="Encolpe's blog" href="http://encolpe.wordpress.com/">Encolpe Degoute</a> on how to set a workflow state on a content when the workflow is DCWorkflow powered (Plone of course). Things are not that simple since DCWorkflow does not provide a public API for this. Instead, we must execute the various transitions that are slow and may trigger unwanted events.<br />
This small scripts uses deep inners private API of DCWorkflow (yeah, that&#8217;s evil, but&#8230;) and makes the expected job:</p>
<ul>
<li>Sets the workflow state of a content to whatever state without executing any transition</li>
</ul>
<ul>
<li>Sets its security martix as expected</li>
</ul>
<ul>
<li>Reindexes content security</li>
</ul>
<p>Here is the baby&#8230; In the hope it will be useful to others and maybe get improvements&#8230;</p>
<p>It has been used in many Plone apps and migration utilities.</p>
<hr />
<pre>from Products.CMFCore.utils import getToolByName
from DateTime import DateTime

def sample(folderish):
    folderish.invokeFactory(type_name='Document', id='blah', title="Blah")
    blah = folderish['blah']
    changeWorkflowState(blah, 'published', comments="No comment")
    return

def changeWorkflowState(content, state_id, acquire_permissions=False,
                        portal_workflow=None, **kw):
    """Change the workflow state of an object
    @param content: Content obj which state will be changed
    @param state_id: name of the state to put on content
    @param acquire_permissions: True-&gt;All permissions unchecked and on riles and
                                acquired
                                False-&gt;Applies new state security map
    @param portal_workflow: Provide workflow tool (optimisation) if known
    @param kw: change the values of same name of the state mapping
    @return: None
    """

    if portal_workflow is None:
        portal_workflow = getToolByName(content, 'portal_workflow')

    # Might raise IndexError if no workflow is associated to this type
    wf_def = portal_workflow.getWorkflowsFor(content)[0]
    wf_id= wf_def.getId()

    wf_state = {
        'action': None,
        'actor': None,
        'comments': "Setting state to %s" % state_id,
        'review_state': state_id,
        'time': DateTime(),
        }

    # Updating wf_state from keyword args
    for k in kw.keys():
        # Remove unknown items
        if not wf_state.has_key(k):
            del kw[k]
    if kw.has_key('review_state'):
        del kw['review_state']
    wf_state.update(kw)

    portal_workflow.setStatusOf(wf_id, content, wf_state)

    if acquire_permissions:
        # Acquire all permissions
        for permission in content.possible_permissions():
            content.manage_permission(permission, acquire=1)
    else:
        # Setting new state permissions
        wf_def.updateRoleMappingsFor(content)

    # Map changes to the catalogs
    content.reindexObject(idxs=['allowedRolesAndUsers', 'review_state'])
    return
</pre>
<hr /><strong>Pro</strong>:</p>
<ul>
<li>It&#8217;s damn fast. Consider using changeWorkflowState if you need to set the workflow on a huge set of contents in one transaction. Read a content migration or a bulk content creation.</li>
</ul>
<ul>
<li>You can set the workflow state you want, including a state that&#8217;s no in the workflow associated with the content ;o)</li>
</ul>
<p><strong>Cons</strong>:</p>
<ul>
<li>Doesn&#8217;t use legacy API. So this may or may not work with future versions of DCWorkflow.</li>
</ul>
<ul>
<li>Doesn&#8217;t use the transitions. This is an intentional feature for speeding up all this. As a consequence, no transition script or event is triggered. But this is perhaps</li>
</ul>
<p>Not recorded in workflow history. Honestly this is not an issue for my use case.<br />
As a counterpart, there&#8217;s no control on the validity of the state value in the context (global workflow or placeful workflow). Buggy user code may issue content on which no workflow transition is possible.</p>
<hr />(*) French speaking readers will understand. For others, &#8220;Gruik&#8221; is the sound of the pig.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=41&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2010/04/02/changing-workflow-state-quickly-on-cmfplone-content/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>
	</item>
		<item>
		<title>Back on iw.memberreplace</title>
		<link>http://glenfant.wordpress.com/2009/03/08/back-on-iwmemberreplace/</link>
		<comments>http://glenfant.wordpress.com/2009/03/08/back-on-iwmemberreplace/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 13:36:29 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Zope 2]]></category>
		<category><![CDATA[Zope 3]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=34</guid>
		<description><![CDATA[I blogged some months ago about iw.memberrreplace. In some words, iw.memberreplace provides a tool that clones the security features of an unser to another one (ownership, DC creator, sharings, group membership). No more hassle digging around huge Plone site and hundreds of clicks to do this. Last week, I read a conversation with John Stahl [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=34&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I blogged some months ago about <a title="iw.memberreplace home page" href="http://plone.org/products/iw-memberreplace/" target="_blank">iw.memberrreplace</a>. In some words, iw.memberreplace provides a tool that clones the security features of an unser to another one (ownership, DC creator, sharings, group membership). No more hassle digging around huge Plone site and hundreds of clicks to do this.</p>
<p>Last week, I read a conversation with <a title="View the conversation with nabble" href="http://n2.nabble.com/Re%3A-what%27s-up-with-plone.app.changeownership-%21-%21-tp2416270p2416270.html" target="_blank">John Stahl and Mustapha Benali</a> about the <a title="View the PLIP" href="http://plone.org/products/plone/roadmap/185/" target="_blank">PLIP 185</a>, and realized that this PLIP is almost iw.memberreplace (or the opposite).</p>
<p>So I spend a couple of hours on that component to add the last details on that component. Et voilà, the last release of iw.memberreplace (1.0.0-RC1) fulfills now that PLIP: the original member can now be removed &#8211; if defined in a mutable users source.</p>
<p>I swear that in the future, I will read the open PLIPs before creating a new component ;o)</p>
<p>Enjoy&#8230;</p>
<div id="attachment_36" class="wp-caption alignnone" style="width: 620px"><img class="size-full wp-image-36" title="cliche-2009-03-08-13-53-17" src="http://glenfant.files.wordpress.com/2009/03/cliche-2009-03-08-13-53-17.png?w=610&#038;h=636" alt="iw.memberreplace control panel" width="610" height="636" /><p class="wp-caption-text">iw.memberreplace control panel</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=34&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2009/03/08/back-on-iwmemberreplace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>

		<media:content url="http://glenfant.files.wordpress.com/2009/03/cliche-2009-03-08-13-53-17.png" medium="image">
			<media:title type="html">cliche-2009-03-08-13-53-17</media:title>
		</media:content>
	</item>
		<item>
		<title>OpenXml and openxmllib &#8211; looking for volunteers</title>
		<link>http://glenfant.wordpress.com/2008/11/21/openxml-and-openxmllib-looking-for-volunteers/</link>
		<comments>http://glenfant.wordpress.com/2008/11/21/openxml-and-openxmllib-looking-for-volunteers/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 13:50:56 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Plone]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=31</guid>
		<description><![CDATA[Abstract openxmllib is a pure Python package built on lxml that parses an ECMA373 office file (read *.docx, *.pptx, *.xlsx recorded from MS Office 2007). It can actually extract &#8211; very fast &#8211; the indexable words from an MS Office 2007 document. It may be used from any Python app, even from others (Java, PHP, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=31&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Abstract</strong></p>
<p><a href="http://code.google.com/p/openxmllib/" target="_blank">openxmllib</a> is a pure Python package built on lxml that parses an ECMA373 office file (read *.docx, *.pptx, *.xlsx recorded from MS Office 2007). It can actually extract &#8211; very fast &#8211; the indexable words from an MS Office 2007 document. It may be used from any Python app, even from others (Java, PHP, C++ &#8230;)</p>
<p><a href="http://plone.org/products/openxml" target="_blank">Products.OpenXml</a> is a component for Plone 2.5 -&gt; 3.2 that registers the MIME types and icons for the known extensions for these office files and provides transform rules to indexable text, such MS Office 2007 documents in ATFile or any content type with a searchable FileField are indexed.</p>
<p>Both are avalaible at the cheeseshop.</p>
<p><strong>Future directions</strong></p>
<p>Yeah, those babies make satisfying job at the moment, I have not enough room to copy the testimonies of satisfied users. But users want more&#8230;</p>
<p><strong>Have real plain text</strong></p>
<p>openxmllib actually provides all words from a document. This is very fast because some XPath expressions make the job. But when the result is appropriate for indexing, it is not human friendly. The words are returned in any order and there&#8217;s no way to understand what&#8217;s written.</p>
<p><strong>Have HTML preview</strong></p>
<p>Yes, previews of office documents in a Plone site are great. ARFilePreview shows some of what I want to do: having a nice HTML document, visually as close as possible from the printed document.</p>
<p><strong>Volunteers?</strong></p>
<p>Unfortunately, I have not much time to spend for this, and the ones who asked these features didn&#8217;t want to participate or fund my work. You are interrested for adding these features, please let me know. Skills in XSLT and in the ECMA373 standard are required for this.</p>
<p>Many thanks by avance.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=31&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2008/11/21/openxml-and-openxmllib-looking-for-volunteers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>
	</item>
		<item>
		<title>Safely replace a Plone member</title>
		<link>http://glenfant.wordpress.com/2008/10/17/safely-replace-a-plone-member/</link>
		<comments>http://glenfant.wordpress.com/2008/10/17/safely-replace-a-plone-member/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 14:47:43 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Plone]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=28</guid>
		<description><![CDATA[Hi, This component replies to a well known use cases and request from our customers, especially from intranet managers. How do we do on our Plone intranet when Mr Foo dismisses our company and Ms Bar is entitled to do his job? Ms Bruni just married and she&#8217;s now Mrs Sarkozy. Her login is now [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=28&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>This component replies to a well known use cases and request from our customers, especially from intranet managers.</p>
<p>How do we do on our Plone intranet when Mr Foo dismisses our company and Ms Bar is entitled to do his job?</p>
<p>Ms Bruni just married and she&#8217;s now Mrs Sarkozy. Her login is now c.sarkozy and she lost the permissions she had on some contents she used to work on. How shall I handle this? Should I browse in the site finding all her stuffs and change the sharings, property (&#8230;) accordingly?</p>
<p>Some weeks ago, this was in a bunch of code I included in private site products. Some days ago, I released it as a public component.</p>
<p>Just install <a title="iw.memberreplace Home page" href="http://pypi.python.org/pypi/iw.memberreplace">iw.memberreplace</a>, open its control panel, select the desired options and let it do all the job &#8211; that otherwise would require hours of digging &#8211; for you.</p>
<p>Enjoy, and as always, feedback and contributions are welcome.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=28&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2008/10/17/safely-replace-a-plone-member/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>
	</item>
		<item>
		<title>Safer GenericSetup upgrade steps</title>
		<link>http://glenfant.wordpress.com/2008/09/18/safer-genericsetup-upgrade-steps/</link>
		<comments>http://glenfant.wordpress.com/2008/09/18/safer-genericsetup-upgrade-steps/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 15:27:43 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Plone]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=23</guid>
		<description><![CDATA[Upgrading Plone extensions using GenericSetup upgrade steps. A great idea. Easy to develop, easy to use and document. A unified upgrade interface for every Plone extension. Anyway, there&#8217;s actually an annoying issue on upgrade steps: upgrade steps for component &#8220;foo&#8221; are exposed in sites where the &#8220;foo&#8221; component is not installed. Wow, managers on instances [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=23&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Upgrading Plone extensions using GenericSetup upgrade steps. A great idea. Easy to develop, easy to use and document. A unified upgrade interface for every Plone extension.</p>
<p>Anyway, there&#8217;s actually an annoying issue on upgrade steps: upgrade steps for component &#8220;foo&#8221; are exposed in sites where the &#8220;foo&#8221; component is <strong>not installed</strong>.</p>
<p>Wow, managers on instances where various different Plone sites are installed have to be careful on this. Running an upgrade step of a component that is not installed in a site may be harmful. Even if upgrade scripts are supposed to be defensively programmed.</p>
<p>Having several Plone extensions, I made a decorator based generic safety belt. Of course this does not prevent GS showing the upgrade steps but executing such upgrade steps raises an explicit error message and does not execute the upgrade step.</p>
<p>Just add these lines to your &#8220;utils.py&#8221;:</p>
<pre>from zope.component import getUtility
from Products.CMFCore.interfaces import ISiteRoot
from config import PROJECTNAME

class NotInstalledComponent(LookupError):
    def __init__(self, cpt_name):
        self.cpt_name = cpt_name
        return

    def __str__(self):
        msg = ("Component '%s' is not installed in this site."
               " You can't run its upgrade steps."
               % self.cpt_name)
        return msg

class IfInstalled(object):
    """The decorator"""
    def __init__(self, prod_name=PROJECTNAME):
        """@param prod_name: as shown in quick installer"""
        self.prod_name = prod_name

    def __call__(self, func):
        """@param func: the decorated function"""
        def wrapper(setuptool):
            portal = getUtility(ISiteRoot)
            qi = portal.portal_quickinstaller
            installed_ids = [p['id'] for p in qi.listInstalledProducts()]
            if self.prod_name not in installed_ids:
                raise NotInstalledComponent(self.prod_name)
            return func(setuptool)
        wrapper.__name__ = func.__name__
        wrapper.__dict__.update(func.__dict__)
        wrapper.__doc__ = func.__doc__
        wrapper.__module__ = func.__module__
        return wrapper</pre>
<p>Then your upgrade scripts should be decorated like this in your &#8220;upgrades.py&#8221;</p>
<pre>...
from utils import IfInstalled
@IfInstalled()
def someUpgradeFunction(setuptool):
 # Stuff as usual...</pre>
<p>You&#8217;re done&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=23&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2008/09/18/safer-genericsetup-upgrade-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>
	</item>
		<item>
		<title>Have your views rendered with DTML</title>
		<link>http://glenfant.wordpress.com/2008/08/16/have-your-views-rendered-with-dtml/</link>
		<comments>http://glenfant.wordpress.com/2008/08/16/have-your-views-rendered-with-dtml/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 18:23:33 +0000</pubDate>
		<dc:creator>Gilles Lenfant</dc:creator>
				<category><![CDATA[Plone]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://glenfant.wordpress.com/?p=13</guid>
		<description><![CDATA[Have your views rendered with DTML As we&#8217;re supposed to kill the CMF skins layer in the Plone components, when tailoring the old style products to components, we put all static data (images, javascripts, stylesheets) in resources directories, python scripts to views and adpters, controller page templates to plone.app.form or plone.app.z3cform schemes, and so on&#8230; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=13&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Have your views rendered with DTML</p>
<p>As we&#8217;re supposed to kill the CMF skins layer in the Plone components, when tailoring the old style products to components, we put all static data (images, javascripts, stylesheets) in resources directories, python scripts to views and adpters, controller page templates to plone.app.form or plone.app.z3cform schemes, and so on&#8230;</p>
<p>But the new style resource directory doesn&#8217;t take care about DTML as it does for page templates. And for some kinds of stuffs like dynamic CSS/Javascript, or making a CSV file, DTML is yet the better suited than ZPT.</p>
<p>Yes you can publish DTML based views/pages/viewlets. This is not obvious but not that much complicated. This small example shows how to add a stylesheet using the standard Plone &#8220;base_properties&#8221; CSS data.</p>
<p>First the ZCML bunch at &#8230;/browser/configure.zcml:</p>
<pre>&lt;browser:page
  name="mystytles.css"
  for="Products.CMFPlone.interfaces.IPloneSiteRoot"
  class=".stylesheet.MyStylesheet"
  permission="zope2.Public"
/&gt;</pre>
<p>So we&#8217;ll have that sthylesheet published at http://&lt;your-site&gt;/mystyles.css.</p>
<p>Now the &#8230;/browser/stylesheet.py module:</p>
<pre>...
import os
from Globals import DTMLFile</pre>
<pre>from Products.Five.browser import BrowserView
...
this_dir = os.path.dirname(os.path.abspath(__file__))</pre>
<pre>templates_dir = os.path.join(this_dir, 'templates')
# Don't add ".dtml" to the file name though the file is "mystyles.css.dtml"
mystylesheet_dtml = DTMLFile('mystyles.css', templates_dir)</pre>
<pre>...
class MyStylesheet(BrowserView):</pre>
<pre>    def __call__(self, *args, **kw):
        """This view is published"""</pre>
<pre>        # Wrap acquisition context to template</pre>
<pre>        template = mystylesheet_dtml.__of__(self.context)
        # Note that you can provide other named args below you might need in
        # your template
        return template(context=context)</pre>
<p>And finally our DTML template at &#8230;/browser/templates/mystyles.css.dtml</p>
<pre>/* &lt;dtml-with "context.base_properties"&gt; (do not remove this <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
&lt;dtml-let portal_url="context.absolute_url()"&gt; (do not remove this <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
*/</pre>
<pre>.silly {
  color: &amp;dtml-discreetColor;;
}
.foo {
  background: &amp;dtml-portal_url;/some-image.gif;
}</pre>
<pre>/* &lt;/dtml-let&gt;&lt;/dtml-with&gt; (do not remove this <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  */</pre>
<p>You just need to add &#8220;mystyles.css&#8221; to the Plone CSS registry but that&#8217;s another story. That&#8217;s all folks.</p>
<p>Note that you could prefer using <a title="z3c.zrtresource" href="http://pypi.python.org/pypi/z3c.zrtresource">z3c.zrtresource</a> if you&#8217;re bleeding-edge oriented developer.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/glenfant.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/glenfant.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/glenfant.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/glenfant.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/glenfant.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/glenfant.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/glenfant.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/glenfant.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/glenfant.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/glenfant.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/glenfant.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/glenfant.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/glenfant.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/glenfant.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/glenfant.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/glenfant.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=glenfant.wordpress.com&amp;blog=2790174&amp;post=13&amp;subd=glenfant&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://glenfant.wordpress.com/2008/08/16/have-your-views-rendered-with-dtml/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e2df9186d6b4ace31885f66e4b31a339?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">glenfant</media:title>
		</media:content>
	</item>
	</channel>
</rss>
