<?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/"
	>

<channel>
	<title>littled.net &#187; zope</title>
	<atom:link href="http://www.littled.net/new/category/zope/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.littled.net/new</link>
	<description>David Little&#039;s home on the Web</description>
	<lastBuildDate>Mon, 15 Mar 2010 16:34:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Greenwich Tweets</title>
		<link>http://www.littled.net/new/2009/05/10/greenwich-tweets/</link>
		<comments>http://www.littled.net/new/2009/05/10/greenwich-tweets/#comments</comments>
		<pubDate>Sun, 10 May 2009 12:24:04 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[blog-post]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/new/?p=207</guid>
		<description><![CDATA[I&#8217;m slowly getting the ball rolling with an idea I&#8217;ve had for a while called Greenwich Tweets. The idea behind this is to aggregrate information about Greenwich (London) from a number of Web resources, principally Twitter.
So far I haven&#8217;t done much more than register a Twitter account (@greenwichtweets) and domain name (greenwichtweets.co.uk) and browse some [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />I&#8217;m slowly getting the ball rolling with an idea I&#8217;ve had for a while called Greenwich Tweets. The idea behind this is to aggregrate information about Greenwich (London) from a number of Web resources, principally Twitter.</p>
<p>So far I haven&#8217;t done much more than register a Twitter account (<a href="http://twitter.com/greenwichtweets">@greenwichtweets</a>) and domain name (<a href="http://www.greenwichtweets.co.uk/">greenwichtweets.co.uk</a>) and browse some of the API documentation. Updates on progress will be available on the Greenwich Tweets site (which at the moment is just redirecting to a page on this site!). I&#8217;m hoping to start work in earnest around July.</p>
<p>At the moment I&#8217;m looking at Python and Zope (possibly Plone) to manage the back-end stuff, although I&#8217;m hoping to keep it all reasonably lightweight.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2009/05/10/greenwich-tweets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating from Zope 2.6.4 to Plone 2.5.3</title>
		<link>http://www.littled.net/new/2008/12/11/migrating-from-zope-264-to-plone-253/</link>
		<comments>http://www.littled.net/new/2008/12/11/migrating-from-zope-264-to-plone-253/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 17:21:24 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[blog-post]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/new/?p=100</guid>
		<description><![CDATA[I&#8217;m currently working on the roll-out of Plone 2.5.3 sites to replace our old Zope 2.6.4 / CMF 1.4.2 sites (Plone 3 to come for new sites in the new year hopefully). I can safely say that after doing this a few times, migrating from such an old version of plain Zope/CMF to a relatively [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />I&#8217;m currently working on the roll-out of Plone 2.5.3 sites to replace our old Zope 2.6.4 / CMF 1.4.2 sites (Plone 3 to come for new sites in the new year hopefully). I can safely say that after doing this a few times, migrating from such an old version of plain Zope/CMF to a relatively new version of Plone is a complete nightmare.</p>
<p>The number of steps I&#8217;ve had to go through to get this working seems to get larger every time I do it. I&#8217;ve now got to stage where I&#8217;m not 100% sure if a step is needed or not, but what the hell I&#8217;m going to do it anyway. To be honest, I&#8217;d probably recite incantations backwards over a boiling cauldron if I thought that was going to help.</p>
<p>Here&#8217;s a summary of what I&#8217;ve had to do:</p>
<ul>
<li>Export the content from the old Zope 2.6.4 site</li>
<li>Create a new CMF site on a Zope 2.9.7 instance</li>
<li>Run through a load of Zope upgrade routines,  including fixing the catalog and adding a load of new folder actions</li>
<li>Export the folder(s) containing the content you want to migrate</li>
<li>Create a new Plone site somewhere on a trashable Zope 2.9.7 instance</li>
<li>Set this up with a theme / policy product</li>
<li>Import the converted Zope/CMF folders</li>
<li>Clear and rebuild the Plone site&#8217;s portal catalog</li>
<li>Go to portal_atct / Type migration and click on &#8220;Fix&#8221; under &#8220;Fix portal names&#8221;</li>
<li>Click on &#8220;Migrate&#8221; under &#8220;Type migration&#8221;</li>
<li>This should fix all old CMF documents, links and files</li>
<li>Now, I&#8217;ve got the fix the old CMF Folders. Oh, this is a good one. The only way to get these into the catalog is to go to portal_catalog and go to &#8220;Find Objects&#8221;. I leave the search fields blank to get absolutely everything into the catalog, even stuff that doesn&#8217;t really belong there</li>
<li>I create a migration script that handles the transfer of old &#8220;Portal Folders&#8221; to Plone Folders (not at the ATFolders stage yet). It also does some other minor migrations I need to do (e.g. converting ATDocuments to a custom content type)</li>
<li>Here&#8217;s another great one: now make sure your folders don&#8217;t contain any objects with the IDs of &#8220;language&#8221; or &#8220;subject&#8221;. This causes the migration to fail (I found this out by trial and mainly error). There may be some more IDs that cause this problem, I don&#8217;t know.  Rename any <em>verboten</em> IDs.</li>
<li>Go back to portal_catalog and do a Clear and Rebuild</li>
<li>Go back to portal_atct and re-rerun Migrate Types. My Plone Folders now become ATFolders (woohoo!). Oh hang on, they don&#8217;t have any titles!</li>
<li>I write a script that gives the folders the same titles as their index_html documents. Luckily, by and large the titles of folders and their index pages are the same, so this usually works.</li>
</ul>
<p>That&#8217;s it. Simple and pain-free it&#8217;s not. But it is a good advert for not leaving it so long between upgrading your Zope/Plone versions, or being a better programmer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2008/12/11/migrating-from-zope-264-to-plone-253/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Plone and Flash Player 10</title>
		<link>http://www.littled.net/new/2008/10/17/plone-and-flash-player-10/</link>
		<comments>http://www.littled.net/new/2008/10/17/plone-and-flash-player-10/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 16:10:07 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[blog-post]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[non-plone]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/new/?p=94</guid>
		<description><![CDATA[Another pyrrhic victory maybe, but something that has made me exceptionally happy this afternoon. Basically, yesterday I upgraded my version of Flash Player to version 10 only to find that the Flash files on our Plone-powered site no longer worked.
The lovely folks at SWFObject helped to identify why this was happening &#8212; nothing to do [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />Another pyrrhic victory maybe, but something that has made me exceptionally happy this afternoon. Basically, yesterday I upgraded my version of Flash Player to version 10 only to find that the Flash files on our Plone-powered site no longer worked.</p>
<p>The lovely folks at <a href="http://code.google.com/p/swfobject/">SWFObject</a> helped to identify why this was happening &#8212; nothing to do with SWFObject at all but the fact that <a href="http://www.adobe.com/devnet/flashplayer/articles/fplayer10_security_changes.html">Flash Player 10 implements some new security &#8220;features&#8221;</a>. I managed to isolate it to the fact that Plone serves up ATFiles with the header, &#8220;Content-Disposition: attachment&#8221;. Flash Player 10 ignores files served up with this header, so you need to override this and set it to &#8220;Content-Disposition: inline;&#8221;.</p>
<p>I came up with this solution which may not be overly elegant but at least it works. I created a skin-level Python script that sets response headers before returning the file:</p>
<p>showflash.py</p>
<pre>request = container.REQUEST
RESPONSE =  request.RESPONSE
flashvid = request['flashvid']
cd = 'inline; filename=%s' %(context.id)
RESPONSE.setHeader('Content-Disposition', cd)
return context[flashvid]</pre>
<p>Then, when I embed the video with SWFObject I call it thus,</p>
<pre>&lt;script type="text/javascript"&gt;
   swfobject.embedSWF("&amp;dtml-portal_url;/path/to/flash/showflash?flashvid=myflash.swf", "my-dom-id", "435", "290", "9.0.115");
&lt;/script&gt;</pre>
<p>This may be better handled by a product like Plone4Artists Video but it certainly works as a fix for us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2008/10/17/plone-and-flash-player-10/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Setting the request object in Zope</title>
		<link>http://www.littled.net/new/2008/07/30/setting-the-request-object-in-zope/</link>
		<comments>http://www.littled.net/new/2008/07/30/setting-the-request-object-in-zope/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 15:46:28 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[blog-post]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/new/?p=64</guid>
		<description><![CDATA[One of those &#8220;note-to-self&#8221; type posts, but this is something I always have problems remembering for some reason.
It&#8217;s quite easy to set a property in the request object using request.set(&#8217;key&#8217;, &#8216;value&#8217;) in your Python script. However, if you then redirect to another page this property is lost. What you need to do is something along [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />One of those &#8220;note-to-self&#8221; type posts, but this is something I always have problems remembering for some reason.</p>
<p>It&#8217;s quite easy to set a property in the request object using request.set(&#8217;key&#8217;, &#8216;value&#8217;) in your Python script. However, if you then redirect to another page this property is lost. What you need to do is something along these lines:</p>
<p><code><br />
request = container.REQUEST<br />
RESPONSE = request.RESPONSE<br />
request.set("my_new_key", "my_new_value")<br />
response = context.id_of_page_to_call(request)<br />
return response<br />
</code></p>
<p>You can then use this new request object property in the page you &#8220;redirect&#8221; to. The URL won&#8217;t change, i.e. if the script you&#8217;re doing all this in is called something like &#8220;myscript&#8221;, &#8220;myscript&#8221; will remain in the URL after the new page &#8220;id_of_page_to_call&#8221; has been called.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2008/07/30/setting-the-request-object-in-zope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All themed up and ready to go</title>
		<link>http://www.littled.net/new/2008/04/12/all-themed-up-and-ready-to-go/</link>
		<comments>http://www.littled.net/new/2008/04/12/all-themed-up-and-ready-to-go/#comments</comments>
		<pubDate>Sat, 12 Apr 2008 14:26:12 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[blog-post]]></category>
		<category><![CDATA[non-plone]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[plone-themes]]></category>
		<category><![CDATA[plone3]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/blog/2008/04/12/all-themed-up-and-ready-to-go/</guid>
		<description><![CDATA[After a short period of inactivity, I had a concentrated burst of work on my theme which is very nearly finished. Doing the CSS work wasn&#8217;t too hard; after all I chose a simple theme to start on as I knew the majority of my time would be spent getting my head around Plone 3.
So, [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />After a short period of inactivity, I had a concentrated burst of work on my theme which is very nearly finished. Doing the CSS work wasn&#8217;t too hard; after all I chose a simple theme to start on as I knew the majority of my time would be spent getting my head around Plone 3.</p>
<p>So, <a href="https://svn.plone.org/svn/collective/plonetheme.simplicity/trunk/">plonetheme.simplicity</a> has now been checked into the Collective SVN repository and, barring a couple of fixes which I&#8217;ll hopefully make this weekend, is almost ready for testing. I&#8217;ve installed a example of it on my Plone 3.0.3 site at <a href="http://littlewebcreations.co.uk">littlewebcreations.co.uk.</a> This highlights one of the problems I&#8217;m currently experiencing: the calendar expands outside its container box as in Plone 3.0.3 (and presumably some other earlier versions), the days of the week render as three characters as opposed to two in Plone 3.0.6 (the version which I developed the site in). At the moment I&#8217;m not sure if there&#8217;s a configuration setting I can make to change this, or whether I&#8217;ll need to customise the calendar portlet or use a bit of Javascript to sort the problem out.</p>
<p>Installing my theme product into a different Plone instance threw me for a while. I managed to install it using &#8220;setup.py install&#8221; from the appropriate Python path but couldn&#8217;t see it listed in my available products within the ZMI. I then realised I had to create a plontheme.simplicity-configure.zcml in my Zope instance&#8217;s etc/package-includes directory.  Or, I could have copied the one that was generated for me in the root directory of my theme. Of course I could have read the generated install.txt file which explained all, but that would have been too easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2008/04/12/all-themed-up-and-ready-to-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presentations from Zope/Plone day</title>
		<link>http://www.littled.net/new/2008/02/19/presentations-from-zopeplone-day/</link>
		<comments>http://www.littled.net/new/2008/02/19/presentations-from-zopeplone-day/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 09:10:00 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/blog/?p=32</guid>
		<description><![CDATA[The presentations for the Zope/Plone day at Birkbeck are now available.
]]></description>
			<content:encoded><![CDATA[<p id="top" /><a href="http://www.bbk.ac.uk/its/plone/presentations/">The presentations for the Zope/Plone</a> day at Birkbeck are now available.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2008/02/19/presentations-from-zopeplone-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zope/Plone day at Birkbeck</title>
		<link>http://www.littled.net/new/2008/02/13/zopeplone-day-at-birkbeck/</link>
		<comments>http://www.littled.net/new/2008/02/13/zopeplone-day-at-birkbeck/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 12:39:16 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/blog/?p=30</guid>
		<description><![CDATA[We held a Zope/Plone users and developers day at Birkbeck yesterday (12 February 2008), the second in hopefully a long running series of events aimed at users of Zope and Plone in UK higher education.
As with the first one in Bristol in May 2007, it was very useful. We had a number of presentations on [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />We held a <a href="http://www.bbk.ac.uk/its/plone/">Zope/Plone users and developers day</a> at Birkbeck yesterday (12 February 2008), the second in hopefully a long running series of events aimed at users of Zope and Plone in UK higher education.</p>
<p>As with the first one in Bristol in May 2007, it was very useful. We had a number of presentations on various themes covering all aspects of Plone development and roll-out (customisation, performance, testing and end-user training). It was also great just to chat to other Plone developers and compare notes; not to mention reassuring that others were experiencing the same kind of issues as us.</p>
<p>I&#8217;ll put a summary of my presentation up on this blog, but we&#8217;re hoping the integrate the presentations and other notes into the<a href="http://www.plone4universities.org/"> Plone4Universities</a> site (we had the logo designer for this site as one of our delegates) which seems like the natural home for this kind of thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2008/02/13/zopeplone-day-at-birkbeck/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Variables in Python regular expressions: an example</title>
		<link>http://www.littled.net/new/2008/02/11/variables-in-python-regular-expressions/</link>
		<comments>http://www.littled.net/new/2008/02/11/variables-in-python-regular-expressions/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 21:02:58 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/blog/?p=29</guid>
		<description><![CDATA[This is something very useful which I picked up from a mailing list, so I&#8217;m certainly not claiming to have come up with it.
The problem: basically, you need to replace some text or code using a regular expression in Python, but you need that regular expression to contain a variable reference so it can be [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />This is something very useful which I picked up from a mailing list, so I&#8217;m certainly not claiming to have come up with it.</p>
<p>The problem: basically, you need to replace some text or code using a regular expression in Python, but you need that regular expression to contain a variable reference so it can be run within a loop etc. How do you do this?</p>
<p>The example below is the actual one I was working on &#8212; I needed to replace a &lt;div&gt; tag with a changing id with the actual contents of a file within Zope, in order to insert HTML snippets (YouTube video, Google code etc.) into a page. The page editing tool we use (EditonPro) sensibly strips out this kind of stuff, but this was a special case where the site editor really needed to do this. The inserted tags looked something like this:</p>
<pre>
 &lt;div id="snippet-123456"&gt;
   [snippet: YouTube video of something]
 &lt;/div&gt;</pre>
<p>Then I defined a method (getSnippet.py) with the following code:</p>
<pre>
import re

def getSnippet(self, content):

   content = content.replace('\n','')
   pattern = re.compile(r"""(&lt;div id="snippet

-)([^"]*)("&gt;[^&lt;]*)(&lt;/div&gt;)""", re.MULTILINE)

   reg = re.findall(pattern, content)

   if reg:

      count = len(reg)

      i=0

      while i &lt; count:

         snpid = str(reg[i][1])

         sr =  r"""&lt;div id="snippet-%s"[^&lt;]*&lt;/div&gt;"""

         src = re.compile(sr % snpid)

         srch = src.findall(content)

         srch = srch[0]

         try:

           repl = self.aq_parent[snpid].data

         except:

           repl = ''

      content = content.replace(srch, repl)

      i=i+1

   return content</pre>
<p>Briefly, this is how this works: in the document_view page template a call is made to getSnippet thus:</p>
<pre>&lt;div tal:define="content here/CookedBody"
     tal:replace="structure python: here.getSnippet(content)"/&gt;</pre>
<p>The page content is passed to the getSnippet External Method which first does a regex to find all the relevant bits of code.  If anything is returned in the variable &#8220;reg&#8221;, a while loop is initiated.</p>
<p>The div ids, which map to file names of the Zope files, are extracted from &#8220;reg&#8221; while this loop runs. We use them to construct a regular expression which will match the relevant  snippet code. The key lines are these:</p>
<pre>
sr =  r"""&lt;div id="snippet-%s"[^&lt;]*&lt;/div&gt;"""

src = re.compile(sr % snpid)</pre>
<p>We use the %s syntax when defining our regular expression and pass the variable to it when compiling it.</p>
<p>It works, great stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2008/02/11/variables-in-python-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mod proxy magic</title>
		<link>http://www.littled.net/new/2008/02/11/mod-proxy-magic/</link>
		<comments>http://www.littled.net/new/2008/02/11/mod-proxy-magic/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 17:34:21 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[systems administration]]></category>
		<category><![CDATA[zope]]></category>

		<guid isPermaLink="false">http://www.littled.net/blog/?p=28</guid>
		<description><![CDATA[One of the useful things about getting my Plone hosting sorted is that I&#8217;ve been forced to dabble in some of the dark arts of systems administration. I now know  a little more about such things as mod_rewrite and mod_proxy in Apache.  I was attempting to seemingly integrate my Plone site with my [...]]]></description>
			<content:encoded><![CDATA[<p id="top" />One of the useful things about getting my Plone hosting sorted is that I&#8217;ve been forced to dabble in some of the dark arts of systems administration. I now know  a little more about such things as mod_rewrite and mod_proxy in Apache.  I was attempting to seemingly integrate my Plone site with my existing PHP-based site, doing something like this:</p>
<p>RewriteEngine On<br />
RewriteBase /</p>
<p>RewriteRule ^/plone($|/.*)<br />
http://myplonesite:9080<wbr></wbr>/VirtualHostBase/http/www.littled.net:80/VirtualHostRoot/_vh_plone$1<br />
[L,P]</p>
<p>So littled.net/plone would lead you straight into the Plone site. When I finally got the .htaccess file syntax correct which took a few passes (like getting the RewriteBase set properly) it kind of worked, except my hosting company don&#8217;t have mod_proxy installed (I guess for security reasons which is reasonable).  When the flags were taken out, the redirect did work, rewriting the URLs on the Plone page, but leaving the hideous Virtual Host Monster URL in the browser location bar. So, what I learned is this:</p>
<p>Even if you are using Rewrite rules and not using mod_proxy directly, you still need mod_proxy enabled for it to work properly.</p>
<p>Never mind, my Plone site is now going to be separate site from this with its own URL.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.littled.net/new/2008/02/11/mod-proxy-magic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
