Lipstick on a Pig - European Plone Symposium 2009
Upcoming SlideShare
Loading in...5

Lipstick on a Pig - European Plone Symposium 2009



A talk I gave at the European Plone Symposium 2009 in Sorrento...

A talk I gave at the European Plone Symposium 2009 in Sorrento

So you have a big legacy portal application which you want to change the look of, but are contractually not allowed to touch? Here is a case study on how we used the power and flexibility of python and wsgi and the wonder of lxml to dynamically re-skin a proprietary .NET portal without even touching it. We take a giant lump of messy invalid HTML markup and dynamically strip it back, add semantic markup and CSS and present the user with a nice svelte valid site.



Total Views
Views on SlideShare
Embed Views



4 Embeds 6 2 2 1 1



Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Lipstick on a Pig - European Plone Symposium 2009 Lipstick on a Pig - European Plone Symposium 2009 Presentation Transcript

  • Lipstick on a Pig Dynamically re-skinning a legacy .NET portal with python Matt Hamilton [email_address]
  • Introduction
    • Dynamically re-skinning a .NET portal site
    • Can't name the client
    • Portal for teachers in the UK
    • Aggregating content across legacy portal, Plone and Moodle
  • Who Am I
    • Technical Director of Netsight
      • Web development firm in UK
    • 10 years experience with Zope/Plone
    • More of an integrator than core developer
      • I get involved in all those sticky projects of merging Plone in with other systems in an enterprise
  • Where Were We?
  • Existing Portal (1.0)
    • Five years old by November 2009
    • User registrations: 46,681
    • Course enrolments: 33,664
    • Resource Bank views: 247,911
  • Existing Portal (1.0)
  • Problems with Current Portal
    • Look-and-feel
      • Not very compelling
    • Usability
      • Challenging in places
    • A poor content management system
      • Can't really edit general content, so use a separate FTP server and Dreamweaver
    • Vendor lock-in
      • Even small changes, very expensive
  • The Future - Portal 2.0
    • Usability, Design and Content Review April 2008
    • Strategic Review August 2008
    • Feasibility Studies Jan 2009
    • Pilot Demonstrator (“Portal V1.5”) March 2009
  • Design Review
  • Architecture Review
    • Portal 1.0 - Monolithic, tightly coupled, poor separation of skin
  • Architecture Review
    • Portal 2.0 - Extensible, loosely coupled, good separation of skin
  • How Do We Get There? Remember: We Can't Touch the Existing System!
  • The Cunning Plan Skin 1.0 Portal 1.0 Existing Portal Module of functionality e.g. portfolio Browser
  • Total Skin Graft! Portal 1.5 New skin via xpath and xslt transformation. Web server needs to handle SSL. Together they give us nice URLs. web server transformation proxy Skin 2.0 Browser Skin 1.0
  • Deliverance
    • Several Different Projects
      • xdv
      • Deliverance 0.3
    Nate just talked about Deliverence, so I won't go on about it
  • WSGI
    • WSGI allows you to write small modules chained together in a 'pipeline'
    • Many small filters combined together as you need
    • Lots of existing components out there
    • Very easy to write new ones
  • WSGI Power - The Pipeline [pipeline:portal] pipeline = theme.portal ploneinterceptor xslt linkrewrite htmlcleaner source.portal [filter:theme.portal] use = egg:dv.xdvserver#xdv theme_uri = file://%(here)s/theme/theme.html rules = %(here)s/rules/content.xml [filter:ploneinterceptor] use = egg:ns.ploneinterceptor#ploneinterceptor [filter:xslt] use = egg:dv.xdvserver#xslt xslt_file = %(here)s/rules/transform.xsl [filter:linkrewrite] use = egg:ns.linkrewrite#linkrewrite [filter:htmlcleaner] use = egg:ns.htmlcleaner#htmlcleaner [app:source.portal] use = egg:Paste#proxy address =
  • Link Rewriting
    • Old URL:
      • 205 characters!
    • New URL:
      • 41 characters!
  • HTML Cleanup
    • LXML rules!
      • from lxml.html.clean import Cleaner cleaner = Cleaner(...) # Pretty print the HTML dom = document_fromstring(body) body = etree.tostring(dom, pretty_print=True) # Clean the HTML body = cleaner.clean_html(body)
  • Result
    • Old
      • 70kb of HTML
      • 120 Validation errors, 61 warnings
    • New
      • 40Kb of HTML
      • 27 Errors, 1 warning (mainly xhtml/html conflicts)
      • No significant performance impact
  • Putting all together
  • End Result New Style Portal content
  • Complications
    • Navigation
      • One page, two content sources, how is the navigation built?
    • Search
      • Search needs to go across multiple systems
      • Will soon be looking at Solr, Xapian, Google Mini
    • .NET viewstate postback
      • Massive hidden state variable, form wraps entire site!
  • Questions? [email_address]