Archive for the 'plone' Category

pdb and zdb - debuggers for python and zope

Thursday, May 29th, 2008

[updated  10/6/2008 - to reflect Dan’s corrections below]
pdb has long been on my radar, but I had kind of dismissed it as something for “proper” programmers, rather than a web monkey like myself. However, i’m pleased to say i’ve actually finally used it during some plone development! The trick (for me) involves running the plone site in foreground mode so you can see messages in a terminal, and then with pdb you can interact with it. In your python script you need to add:-

import pdb
pdb.set_trace()

when the script reaches this set_trace() statement, you get a pdb prompt in the terminal allowing you to interact with the script and it’s variables at that point. e.g. print myvar to get the value of a variable or myvar.__class__ to find out what type of variable it is. You can also use ‘n’ to step through the script or ‘c’ to continue to the end.

Up until this point I relied on adding print statements in the scripts to try to work out what was happening - a bit like i’ve done for all my web dev over the years - a common mistake for me is to leave these in, then get confused clients asking why the word “here” and “foo=[1]” keeps appearing on their website!

You can also use a similar tool to debug zope skin scripts. This uses a similar principle - run your site in foreground mode, and you can interact with the skin script from the set_trace statement.

from Products.zdb import set_trace
set_trace()

Plone hotfix - how to install it for those who might be nervous to do so

Thursday, November 15th, 2007

If you are anything like me, you might be nervous about installing the recent plone hotfix in case you either break something or are under the impression it involves some unix command line foo. Don’t worry, it is much simpler than that - the hotfix comes in the form of a product - download it, unzip it (well actually untar/ gunzip it) ,and drop it in your products directory and restart zope. Of course you will need access to your products directory, and the ability to restart zope to do this. If you haven’t then it is probably safe to assume that it isn’t your responsibility, so go and nudge whoever it is that deals with that stuff for you ;-)

Wessex Plone Users Group

Friday, November 2nd, 2007

Hot on the heels of the Bristol Drupal Users group I set up recently, comes the Wessex Plone Users group, aimed at Plone users in the Bristol, Bath and surrounding area.

Interesting debate about TTW support in plone

Saturday, October 20th, 2007

Even though I seem to have slipped off planet plone recently (design or accident? - must find out!), i’m fascinated by the current debate about Through The Web (TTW) support in Plone. I must admit I have noticed a general “TTW is bad” vibe from hardcore Plone developers - in fact i’ve heard it said outright on many occasions. As a Plone integrator/ general web developer I can see the pros and cons of TTW, but i’ve certainly seen it as a selling point of Plone - people commissioning a CMS, even for a large corporate site or intranet often get excited at the possibilities of being able to make customisations and additions themselves without having to get expensive developers in to make changes - and why shouldn’t they? I’ve also been a position where i’ve taken on a few customisations of Plone sites where the most of the site lives in the custom skin layer, edited TTW and it is a great way to make minor amends on the fly, and something that i’ve always liked about plone, even though I am fluent with file system development.

Bristol contingent at Plone conference 2007, Naples

Friday, October 12th, 2007

Sadly I couldn’t make it to Plone Conference this year, but I have just got off MSN from Matt at Netsight, and he said that there are no fewer than eight thirteen Plone people form Bristol, UK attending - representing Netsight, Team Rubber and IRLT. Can any other cities in the UK claim that many Plonistas?

OK maybe this Zope object database makes sense now..

Tuesday, October 2nd, 2007

I’ve just made a breakthrough in my perception of Zope and its object database. Despite the fact I have been working with Plone for over three years i’ve always struggled to shift my way of thinking away from relational databases and SQL queries, due to my previous experience of building sites and applications mainly with asp (classic) and php, hooked up to a relational database.
So what caused my Eureka moment? A combination of:-

a. Not developing with plone for a while

Since going it alone I have been doing an eclectic mix of work for different agencies and companies, who all have their own pet technologies and ways of working (so far I have slotted straight into them all with a minimum of fuss- Jack-of-all-trades at your service! Except Perl. I had to turn that one down).

b. Doing a bit of old school Zope

From the moment I started with plone, when I haven’t been skinning/ templating, I have worked almost entirely with Archetypes. Archetypes generates forms for you and all the other “magic” - some lovely helpful magic, some dark voodoo that shouldn’t be spoken aloud in front of non-programmers (like me). This means that with Zope I never learned how to do a typical build a form that posts to script, script writes to database, script pulls out of database and renders it back in the page/form routine, which is usually the first thing I would learn with any other web technology/scripting language.

c. Starting to think in objects

Once again, this had more to do with not working with zope for a while. Before zope I only had a basic understanding of objects and only used them where I was forced to because I was working with someone elses code. I would encapsulate functionality by sticking a load of php/asp functions in an include file with a meaningful name, but I never took the step of wrapping them up in a class and treating the piece of functionality as an object. Something must have sunken in during my Zope years, because now I find it difficult to not think of something as an object.

So, i’m rambling - what exactly was my moment of clarity? It was simply adding a few extra fields (wait - properties) to portal_memberdata and personalize_form in Plone. I went off searching for the python script that would take the data out of the database and pump it into an object for me to use again in a page template - but of course, being stored in the ZODB, it already was an object. Z.O.D.B. Zope Object DataBase - geddit?

So in summary, I think anyone new to plone development could do with learning things the “old” way before they move onto developing with Archetypes - purely for the sake of demystifying the ZODB, especially if like me you come from a php/asp background and have trouble understanding why you would use an object database rather than a relational database.

Next stop Zope 3 - I’ve read several reports about the large amount of boiler plate code needed to create something fairly simple with Zope 3, and a few solutions to speed up the process, but I will definitely make sure to understand how it is done “manually” before attempting to move onto using any shortcuts this time.

i’m joining the circus

Monday, May 28th, 2007

I once remember reading somewhere that leaving a steady job to set up your own business is the adult equivalent of running off to join the circus. But that’s what i’ve decided to do - as of June the 1st I will be my own boss, as after a lot of deliberation and heel dragging I have decided to bite the bullet and leave my contented job at Netsight to go into business with a friend of mine. I have always wanted to start my own business, but for various reasons I haven’t, and a business opportunity was put in front of me, that if I didn’t take then maybe it would never happen. At this point I wanted to link to the website of my new web application development company, but embarassingly I haven’t built it yet, so I’ll post about that when I have done it, and talk more about the new company, and the products and services we will be providing.

A few people have asked me if I will be continuing to work with Plone and the answer is basically this: The core business of my new company will be packaged web applications  and these will not be built in plone, as the applications aren’t CMS-like, and plone wouldn’t be relevant. The applications will be built using some* scripting language/framework plus a RDMS. Zope 3 is a contender, but I don’t have the experience to hit the ground running with that, but i’ll certainly endeavour to get up to speed on it when time allows. However, the company will also be offering bespoke and ad-hoc development services and these will include Plone. For larger Plone projects and implementations I will refer enquiries to Netsight, as beyond the Plone skinning and customisation expertise that I have built up at Netsight over the last three years, the new company will not have the resources or expertise to support large plone projects. I will also still be contracting/freelancing for Netsight on Plone work - intially a couple of days a week, until they change the locks ;-)

Anyway, new company website to follow, and more details about exactly what we will be doing.

* probably unpopular amongst plonistas - check out my previous commercial experience and fill in the blanks yourself!

Bristol Skillswap - Rapid Prototyping with Plone

Wednesday, May 9th, 2007

Another Plone session for Bristol Skillswap - not me this time, Team Rubber are doing this one, but Netsight are providing the beer!

http://bristolskillswap.eventwax.com/rapid-prototyping

Are you seeking a Microsoft Exchange Server plan just right for your business? We can help you choose a Exchange 2007 plan that is just right for your needs. Find business email and web hosting that will make your small business seem like a giant.

Architen Landrell site launched

Wednesday, March 7th, 2007

arhciten landrell website screengrab

Netsight have been so busy recently that we haven’t updated our portfolio for a while, but I wanted to mention this site, as it gave us an excuse to experiment with some nice visual features such as scriptaculous effects, flash galleries etc. The site has a plone back end for Content Management, but the front end was built from the ground up, so is a nice example of a “non-ploney” plone-based site. It helps that Architen had some excellent photography to use on the site - all maintained by themselves via plone including image resizing and cropping for the portfolio pages.

For more details on the project see the write-up here

Recent windows update “monkeys” with Plone as service

Tuesday, February 20th, 2007

A bit of an exaggeration maybe, but I thought I would blog this just in case anyone encounters the same problem. A client phoned yesterday to say that his Plone (2.0.5 on W2K3 server) intranet wasn’t working and could see that the python/zope service was not starting. As it had been running fine for months previously (albeit a bit of memory leakage), my first question was if anything had changed on the server. Other than windows updates, nothing had changed. Not being a windows expert and having burnt through hours trying to resolve a previous plone issue on their old windows server, I threatened to go over there and install vmware and give him a virtual machine running linux or FreeBSD to run the Plone intranet on. At that moment, the unix-phobic client spotted that where he had previously set the IIS https/ssl service to manual startup, the recent updates had reset it to automatic. This was stopping Zope binding to one of the ports (or something like that), hence the service failing on startup.

This was a fairly obscure, but it just goes to show that sometimes the mere mention of unix can sometimes solve windows problems :-)