Wednesday, February 27, 2008

Pycon 2008!

I'm going to Pycon 2008! Hooray! Chicago here I come!

More as things develop.

Working with ATTopics

Before Plone 3 these were called Smart Folders. Now we call them Collections. Since this project is Plone 2.5.4, I guess these are called Smart Folders.

So what I'm doing is extending it to include a few extra fields. Its for a last gasp requirement change. Making the content module was not much work. Making easily removable view changes across 10 odd views has been a bit more work. But I think I'm done.

Anyway, it was easy to do.

Tuesday, February 26, 2008

I want an Asus eee pc

I think the 4 GB version would be nice. I would probably replace Xandros Linux with Xubuntu because then I could work with more packages. My reasons:

  • I need a second machine for consulting work.
  • It sucks when I want to go somewhere and I have to lug nearly seven pounds of hardware in my backback, not to mention power supply and various other accessories. I bicycle and when people talk about speed increases when they dump just 1 pound it makes me wonder how much easier it would be with a nice light machine.
  • My production machines I touch now are Linux, so this means implementations are closer to the final development.
  • I want some hacker creds.

Its gonna be a while, I'm just being hopeful.

Sunday, February 24, 2008


I'm at Panera's in Friendship Heights, Maryland (near Chevy Chase I think) working in a Plone sprint with ZPUG-DC. And I'm working on the Plone Software Center with other nutty Plonistas.

Wednesday, February 20, 2008

I grok viewlets in Plone 3

Thanks to Martin Aspelli's handy book and some notes I found via Googling and my own Zope 3 experience, I started to find success with viewlets. I need to read Mikko's nasty jibe on the subject and see if I still am in his corner. My impression is powerful, but admittedly hard to tweak without tiny issues that take annoying time to fix.

Zope 3 Third Edition is in my hand!

Nice. Very nice. Its a softcover but that is fine with me. Read it on the metro to work and felt smug that I had the latest version.

Tuesday, February 19, 2008

My Zope 3 book is almost here!

I ordered the third edition of Philip von Weiterhausen months ago. Kept getting delayed. Then it shipped on Friday. It should arrive at the house today. Hooray!

Sunday, February 17, 2008

Plone 3 drives me to drink!

I've done lots with Plone 2.5.x. I've written captcha apps in both Zope 3 and Grok. Now its time to play with Plone 3 thanks to

The first task is mostly CSS, which reveals a couple weaknesses I have, the primary of which is that I simply suck at visual design. No, lets change that, I'm terrible. Really bad. I can recognize good designs but doing it myself is nearly impossible. It takes me forever and the end results look like monkey poo. In fact, being so bad at visual art is something I've really tried to fix my whole life to absolutely no avail. Today I spent lots more time I'm mostly not billing for because I just did things real slowly.

Maybe I should just spend my time mastering Generic Setup?

The second task is to do some work with portlets. We can get by with some static HTML in our portlets, but wouldn't it be nice to have a simple portlet tool that lets you upload an image, enter a link, and then you've got a pretty portlet linker! A great little handy tool for Plone 3, and something to wet my teeth on. So after the css misery, I jumped eagerly into this task. I already had a simple portlet package ready, and I cleaned it up to be able to have the right fields (the image item is actually a TextLine for now to make early testing simple), and to also be a valid Plone 3 package. I restarted Plone and presto - the package was there! Time elapsed: 30 minutes! Yay Plone 3!

While committing to SVN I got distracted and made a mistake. Then I reinstalled the project to make sure I hadn't broken anything else. All looked good. That ate up another 30 minutes but it was a good thing to check.

So then I decided to test it out. And you know what? I can't get the addForm or editForm to work - you know the bits powered by zope.formlib. Instead I get a 404 error when I try and add my portlet. I've banged my head a bit, since doing this in Zope 3 was a snap. Yet this Plone 3 portlet has been annoying. This looks to be so simple and I know I'll curse myself later for how obvious it must really, actually be.

Thursday, February 14, 2008

Ditching Funkload

After some thought, I've decided to ditch Funkload as a stress/load testing tool. Its fun to play with, but Funkload has a couple issues that makes it hard to justify:
  • The lack of charting. Yes, writing charting software is fun, but my current work deadline (end of month) doesn't give me the ability to do my other work and do that charting and still meake the deadlines.
  • I've noticed that funkload has some good properties like pointing out slowest objects, it doesn't well define what all of its metrics really mean. What is P90 anyway and why do I care? Why aren't metrics defined like the rest of the package.
So I'm looking into other tools including Zope/Plone specific ones like ZopeProfiler and the TAL checker..

Tuesday, February 12, 2008

Plone Confessional

Everyone in the Plone community has Professional Plone Development, right?

Until last night, everyone but me.

Since I'm just now working in Plone 3 I found simply using Google or wasn't enough. Sure, Plone 3 is wonderfully clear in ways but finding some good information on portlets is proving to be nearly impossible. Its just too new to have everything documented.

I purchased the pdf version and started to read. Martin Aspelli either writes good or has good editors. No matter, its good stuff. And once I get paid for my Plone 3 work I'll see some trees killed so I can have a paper version.

Monday, February 11, 2008

Plone 3 fun

Since October I've barely touched Plone 3. All my work has been in Plone 2.5.x. Well, yesterday I got to play in the arena of Plone 3 again on a side project provided by an associate. And here are some thoughts:
  • The new portlet system is really nice. Even just using it with classic portlets its easier and cleaner. On the other hand, I don't really grok portlet inheritance yet but I suppose I could have spent more than 20 seconds reading documentation. ;)
  • I appreciate how package architecture works. While I wish you didn't have to dive so far deep into directories to get to stuff, thats a pretty small quibble.
  • The AJAX is nice. Speeds up content editing quite a bit and otherwise keeps out of the @#$%ing way. So nice to have good AJAX!
  • While I had my own issues with modifying the Generic Setup, the profiles/default let me figure out how things were working quickly and with absolute accuracy. There was no 'magic', I just knew how things worked.
In the end, it made me want to leave the world of Plone 2.5.x and join the world of Plone 3 again.

Sunday, February 10, 2008

Funkload + Matplotlib = charts!

First I tried to use the Funkload bench xml data. Alas, the xml had values that assuredly went into reports, but figuring out what went where was a royal pain. So then I switched to the HTML report. That turned out to be easier, but it was still a pain. The HTML was vaid XHTML, but the lack of labeling meant it was like old time screen scraping. On a whim I looked at the RST, and realized that it would be very easy to pull data from it.

So I wrote a simple script to grab table data from the RST file. Then I started to make a few charts. Presto! Lots of fun. Its not done yet, but it will be soon. I'll put it on my Google code site and share once I've got it working nicely.

Friday, February 8, 2008

Funkload Charting woes

So for our big Plone project I started to look at some tools to do some load testing. I wanted a Python tool, and stumbled across Funkload by the folks at Nuxeo. It was easy to install, write tests, and generate reports. You could even stick a monitor on the hosting server and it would combine reports into one big handy report. However, not everything was perfect, and the big gotcha was the charting library.

Funkload uses python-gdchart (version 1.6 - 1.8) to generate images of chart data. Its an optional install but I think that visual charts allow u to easily spot major issues and deal with them. There was no easy_installing python-gdchart, so I followed the Funkload install script and went to Francois Meehan's page on the issue. That directed me to's software page. From there I delved and found my way to the now obsolete pygdchart 2.0 and no sign of the earlier versions.

Not good. 1.8 to 2.0 often means API changes, which means funkload probably wouldn't work. And neither would Francois Meehan's installation instructions. In fact, I can't get pygdchart 2.0 working at all.

I spent about 30 minutes dickering around with pygdchart 2.0. That also included time spent googling and seeing if anyone had a solution. No one seems to in my albeit brief investigation.

Now the question is this, do I

I stopped at that point. Even if I got pygdchart 2.0 working, I had no guarantee Funkload would be able to use it. So unless I find a copy of pygdchart 1.8 or so, its not worth the time.

Another thought is this: Funkload generates pretty easily understood XML. I could use Mathplotlib to generate the charts pretty easily. It would be a bit of work, but not a murderous amount.

So I guess I have three tasks:
  • Look for a copy of pygdchart 1.8
  • Write a script using Mathplotlib to turn Funkload report XML into pretty charts.
  • Consider using another tool like Jmeter.

Thursday, February 7, 2008

Sorting by dates in Plone tables

This is a little harder than it seems, and thats because of the 'magic' of JavaScript and how it handles alphanumeric sorts. Lets your dates are rendered thus in a table (along with some other columns):

January 30, 1991
April 01, 2007
March 15, 2000
July 30, 2000

Now a user clicks on the dates column and you've got problems:

April 01, 2007
January 30, 1991
July 30, 2000
March 15, 2000

We are still sorting alphanumerically, and not by dates! Now I could jump into the Plone JavaScript and hack a fix, but that would be lots of work and would mean I would have to be able to handle any variations on localization. Not a good thing! So instead I do this:

19910130 January 30, 1991
20070401 April 01, 2007
20000315 March 15, 2000
20000730 July 30, 2000

As you can see, sorts will be accurate (albeit ugly). The way to fix the ugliness is to put a span around the ugly part and give it a style of 'display:none;'.

But why not just use the unformatted date like 2000/01/01 instead of a format without slashes?

Good question. The reason is that the Plone JavaScript has problems with forward slashes. You'll start seeing funny errors in your sorts, such as dates set in July 2000 showing up before items in June 2000. I think the JavaScript is evaluating (numbers with slashes and then sorting them as shown in this case:

2000/03/15 March 15, 2000 = 44 March 15, 2000
2000/07/30 July 30, 2000 = 7 July 30, 2000

Hence you see the mad purpose of my fix and also what happens with loosely typed languages if you are not careful.

Wednesday, February 6, 2008

Supplementary views in Plone

I want to provide several views for certain content types for content loaders to choose from in our project. The suppl_views attribute in the archetype is the place to define these alternate views. So in your content type you have this:

suppl_views = ('my_alternate_view',)

When the content loader goes to modify that particular content via the Plone front end, they could choose 'my_alternate_view' as one of the items under the display tab.

If you want to get fancy you can get this information in code as well:

MyType.suppl_views # returns the supplement views.
fti = MyType.getTypeInfo() # gets Factory Type Info on the portal type
fti.getAvailableViewMethods(MyType) # Lists all the views for a type with the default one first.

Very handy and works in both Plone 2.5x and Plone 3.0x.

Litigating reality


Monday, February 4, 2008

SVN Versionator is dead

Before I got a chance to finish this project, a sys admin needed this thing in a pinch and needed the features I hadn't finished. No one else was around so he dissected my code and rewrote it as a shell script. Later I helped him tweak it and now we use it to do our builds.

Oh well. It was fun and got me up to speed on Python's subprocess module.