At plone conference I saw Andy McKay demonstrate his Clouseau product, but I have only just got round to trying it. Incredibly useful – I particularly like the way you can use it in context, i.e. when editing a plone page you can click the magnifying glass icon, type “context.” and instantly get a list of the attributes and methods available via the Schema. For people like me who find the zodb a dark and mysterious place, this is a nice environment to use to explore. Cheers Andy!
This is not so much a “how-to”, but more of a “is this how-to?”, I post it here mainly to invite comment and expose my ignorance about the much cleaner method that probably exists.
OK, first my use case – in a skin I am building the title of the current level 0 node is always displayed as a section heading e.g. If you are viewing the page “eggs”, a few levels down and the breadcrumb trail reads home -> foo -> bar -> eggs, “foo” is displayed as a banner heading, so wherever you are in the site you know what main section you are in.
so I have created a skin script called getLevelZeroTitle that has approximately this in it (with try/except statements, and a list of id’s to ignore to handle errors):-
current_level0_path = ‘/’.join(context.getPhysicalPath()[:3])
section_id = context.getPhysicalPath()[2]
current_level0_title = context.portal_catalog(path=current_level0_path)[0].Title
return current_level0_title
Is this the way forward or is there something “built in” to handle this?
If you can get it back into version 2.5 then the data belongs to plone, otherwise it never belonged to plone in the first place..
I’m still undecided and a bit lost about how i’m going to get www.dfrskatezine.com upgraded from 2.1 to plone 2.5
To recap:-
- I can’t really upgrade it in situ (although could be persuaded to try it if people think this is the best bet)
- portal zexp import didn’t work for me
- smaller zexp imports left me with broken stuff.
- it is on a shared instance so the data.fs file is too big to move realistically (once again, still an option if encouraged)
so…I’ve started creating some zpts that I can use to dump content as xml files (e.g. all_articles.xml, containing title, content, url and any other data I need to move – kind of RSS on acid). Not quite XMLforest, but I haven’t got my head round that yet as I live in the skin layer mostly. The masterplan is to then use some python foo magic to populate a fresh 2.5.most_recent_stable site from this XML.
Obviously I need to handle the images and other files seperately – so far I have used a skin script to generate a file containing wget statements for each visible/published image on the site and download the images with a mirrored folder structure, along with an accompanying xml file with the captions, descriptions and paths. I intend to rebuild my products from scratch (pop my zope 3 cherry even?) so I don’t necessarily need my existing products to be 2.5 compatible.
Think i’m going about this the wrong way? Please let me know! Please also bear in mind that while I am a keen student, I am mostly a GUI guy (+ basic archetypes development), and am easily confused by your crazy python talk, and have been made weak by your excellent installers, to the point that I haven’t got a clue how you would go about installing or upgrading zope if it requires me to do anything more than click buttons 😉
Six simple steps to make the plone 2.5 navigation portlet get it’s knickers in a twist:-
- create a folder in the root of a plone site
- in folder contents in the root, move your folder to the top so that it is the first item (after “home” if you have that enabled) in the navigation tree
- in the new folder create a new page and set that page as the default view
- in the ZMI enable “Folder” as a type that can be used for a default page (see this is where I should have known something bad was going to happen)
- go to the root of the site and set your new folder as the default view of the portal (i.e so that the homepage of the portal is in fact the default page in your new folder one level deep – believe it or not I had a reason to do this)
- Hey presto your new folder falls to the bottom of the navtree – no amount of reordering will persuade it otherwise! You can try swearing too if you like, that won’t work either 😉
An off-hand comment I heard about PloneFormGen while I was at plone conference has possibly just payed for most of the conference and travel expense to get to Seattle. I can’t remember where I heard it, but someone mentioned that it was a nice product. I stuck it on my mental to-do list to try it out…
I’m currently working on a site that is close to going live and I had an email waiting for me from the client on friday, saying something like “by the way, can you change that join button so that it sais join our mailing list?” The conversation that followed let me establish that in fact what they wanted was a custom contact form with a few extra options. Usually I would then proceed to hack the contact form and mail script around to achieve this – knowing that I would have to be careful not to lose my customisations if I upgraded or reskinned the site, but this time I decided to try PloneFormGen.
Now that really was painless, really easy to figure out (i’m one of those people who you have to threaten with physical violence before I will RTFM). Thumbs up to Steve McMahon for a very useful product 🙂
I intended to do a comprehensive wrap up of our trip to plone conference in seattle (and stopover in new york), but it is still a bit of a blur, and i’m still jetlagged (ok, i’m just a lightweight, i’m always sleepy). I need to have a look at all the presentation material and my notes, so I promise to write something up and provide some feedback to the presenters in the next week.
The major insight (plonewise) to come out of this week is that resistance to Zope 3 is futile, in fact i’m quite excited about the idea now 🙂
it’s the start of day three of plone conference 2006 and I am stuffed with both plone knowlege and lovely delicious fatty food. This hasn’t been as debauched as previous conferences (for the netsight contingent at least) as the jet lag has made us flake out in the evening before we manage to to do any serious damage to our livers.
Last night we took a cab up to a mall to try to procure some cheap consumer electronics – the cab ride there and back was an experience in itself – the first driver hadn’t got a clue where he was going and was asking for directions from us, while mysteriously changing lanes and indicating for no reason – the driver on the way back thought he was in Gran Turismo or something.
The final afternoon and I face the trickiest decision over which session to attend – all three tracks look useful. I wanted to go to Nate Aune’s multimedia and podcasting tutorial, but i’m fairly well up to speed on that already, but it was difficult to decide between the KSS/ Azax and the UI’s 2.0 tutorials. I plumped for KSS on the basis that I have no idea what it is..
i’m two days into plone conference 2006 and it has all been a bit of a whirlwind so far. I’m eight hours behind UK time and travelled 26 hours to get here after missing our connecting flight in houston, thanks to some helpful individual at passport control who wouldn’t let us jump the queue.
so far we haven’t ventured much further than three or four blocks away from the venue, but luckily there are ample bars and restaurants close by. The hotel has good wifi, the conference venue wifi has been intermittent but seems to be improving. I’ve been too busy to blog much, but I have uploaded one or two photos to flicker.
The conference itself has been interesting and the keynote this morning has given me a clearer understanding of where plone is at the moment and where it is going. I was also pleased to note that I am not alone in having trouble with migrations between version and at least it is a recognised issue and much thought and effort is going into a solution, and that solution involves being able to dump a sites content into an intermediate format that can be used to populate a new site, thus giving me a way to get my content where I can see it, rather than hidden in zodb/zexp voodoo.
At the moment, my pet plone project DFR skate zine is still live, but because netsight have some devious plans for the server it is on, I am trying to upgrade it to the latest version of plone. The site is current running plone 2.1.1 (tip: if you can’t remember what version of plone your site is running, go into the ZMI and click on portal_migration – you’ll find lots of useful info there, including the plone version).
Initial attempts didn’t go well, but I haven’t given up yet. I’m now trying a different approach – creating a blank plone 2.5 site and trying to bring the content over bit by bit. Some of it imported just fine and other objects are throwing various key and attribute errors.
This blog post by Andreas Jung looks like it could be quite useful – my version jump is nowhere near as big as the version described here, but the technique looks interesting – particularly the script for cloning a tree of objects.
I have some fairly radical plans for the development of the DFR site, I was actually thinking of recreating the skin and content type products from scratch, because a) I want a single skin for public and admin view now and b) because the archetypes content types were patched together in a bit of an ad-hoc way, and now they seem a bit.. well… unclean, and basically I think I can do better now..
so… the masterplan at the moment is to extract the content into some format that I can get to the data easily (as I still find it very confusing trying to get to data “lost” in zodb, when the site is broken), then write a script to populate the new site from the data. Obviously xml fits the bill (along with files and folders for media content).
Marshall and XMLForest have been whispered to me on a need to know basis! If I can crack this i’ll be much more confident about maintaining plone sites long term, in the same way that I am confident with CMS’s that use a SQL database for storage.
Funny, we had a very similar use-case recently.
We wrote a script that looked like this:
## Script (Python) “getSectionTitleForBanner”
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=Figure out the appropriate title for the display banner
##
# Get the physical path to the context & the site portal
curr_path = context.getPhysicalPath()
portal = portal_path = context.portal_url.getPortalObject()
portal_path = portal.getPhysicalPath()
len_portalpath = len(portal_path)
from_root_path = curr_path[len_portalpath:]
if len(from_root_path) > 1:
if curr_path != portal_path:
from_root_path = from_root_path[:1]
from_root_path = “/”.join(from_root_path)
display_section = portal.restrictedTraverse(from_root_path)
return display_section.Title()
——–
HTH. (I cut out a section that handled an exception where we wanted to not show level 0 folder sections).
Jon Stahl 2006-12-13 15:19:00
portal = context.portal_url.getPortalObject()
parent = context
if parent is portal: return portal.TItle()
while 1:
if parent.aq_parent is portal:
return parent.Title()
parent = parent.aq_parent
kapil 2006-12-15 00:26:01
I’m a newbie at python but was able to fathom your elegant script (once I saw the typo and realized where indenting was needed) and use it on the site I’m currently building.
Winn King 2006-12-25 02:46:05