So beginnt es

Hum. So here we are switching blogging platforms again. No matter, it’s something that comes to us all, I guess.
The story so far… Our hero faces the twin challenges of handling the questions and database for a PlayStation game whilst, simultaneously, trying to get a Zope-based website set up and running to support a consumer product launch. All whilst juggling pricess eggs in variable gravity (pace Larry Niven).
Any endeavour of this magnitude requires the proper journalling of the insights, discoveries and plain ole lessons-learned-from-screwing-up that are inevitably encountered. Hence the blog – let’s see if it dies the death of a thousand postponed entries that so many do, or thrives and prospers. Or somewhere in between.
Today’s discovery (well, yesterdays, as it happens) is that Zope has a nice little undocumented feature that damn well ought to be recorded somewhere. Consider – if you have a variable, let’s call it thingy that contains a path element, you can write a ZPT element like so:

<span tal:replace="myroot/?thingy/attribute"/>

and lo! you get the value of the variable substituted right into the path. So much nicer than doing

<span tal:replace="python:myroot[thingy]['attribute']"/>

or even

<span tal:replace="python:path('myroot/%s/attribute' % thingy)"/>

So why, you ask, is this little pearl not recorded anywhere that a novice in the ways of ZPT is ever likely to encounter it? Because Zope is one of those things that demonstrates both the extreme power and the essential weakness of open source (I know, I’m beginning to sound like the Architect in the Matrix now). The power, in that it’s a huge, powerfule and clever system that provides an extremely elegant and versatile way to build web applications. The weakness, in that the documentation, in the words that the Americans would use, “sucks like a Dyson on a three-phase supply”.
Well, okay, maybe it’s not that bad. There is The Zope Book, together with a whole bookmark-folder-full of hints and tips, but the documentation only generally comes in two flavours. These are:

  • Here’s A Walkthrough Example in which a guru shows a MoreOrLessContrived and DeliberatelySimple application and walks you, in tortuous detail, through creating it with Zope. The level of detail is such that any future version of Zope will probably look and behave differently enough that the screenshots and dialogs will require redoing. This is suitable for those in their first week or two of the infamous Zope learning curve.
  • Here’s A Deep And Obscure Point in which a guru speaks of complexities and mysteries buried so deep in the bowels of the source that one must be several months into the same learning curve.

    Don’t get me wrong here… I rather like Zope. In fact, I like it more the closer I get to it, but Sweet Mother Of Abraham Lincoln, getting to it is far harder than it ought to be.

  • Leave a Reply

    Fill in your details below or click an icon to log in: Logo

    You are commenting using your account. Log Out /  Change )

    Google photo

    You are commenting using your Google account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )

    Connecting to %s