Lipstick on a Pig - European Plone Symposium 2009
-
Upload
matt-hamilton -
Category
Technology
-
view
1.269 -
download
1
Transcript of Lipstick on a Pig - European Plone Symposium 2009
Lipstick on a Pig
Dynamically re-skinning a
legacy .NET portal with python
Matt Hamilton
[email protected]
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 NetsightWeb development firm in UK
10 years experience with Zope/Plone
More of an integrator than core developerI 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-feelNot very compelling
UsabilityChallenging in places
A poor content management systemCan't really edit general content, so use a separate FTP server and Dreamweaver
Vendor lock-inEven 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.0ExistingPortal
Module of functionality e.g. portfolioBrowser
Total Skin Graft!
Portal 1.5New skin via xpath and xslttransformation.
Web server needs to handle SSL.
Together they give us nice URLs.Skin 1.0
web servertransformation proxySkin 2.0
Browser
Deliverance
Several Different Projectsxdv
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#xdvtheme_uri = file://%(here)s/theme/theme.htmlrules = %(here)s/rules/content.xml
[filter:ploneinterceptor]use = egg:ns.ploneinterceptor#ploneinterceptor
[filter:xslt]use = egg:dv.xdvserver#xsltxslt_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#proxyaddress = http://www.theexistingsite.org.uk/
Link Rewriting
Old URL:http://www.theclient.org.uk/WebPortal.aspx?page=1&module=DB920A53-01EA-4886-8878-F2CDF5FA8CFD&mode=101&IsNonNewsDB920A53_01EA_4886_8878_F2CDF5FA8CFD=True&newsIdDB920A53_01EA_4886_8878_F2CDF5FA8CFD=11208#10
205 characters!
New URL:http://www.theclient.org.uk/news/11208#10
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
Old70kb of HTML
120 Validation errors, 61 warnings
New40Kb of HTML
27 Errors, 1 warning (mainly xhtml/html conflicts)
No significant performance impact
Putting all together
Composite:mainpipeline:portalpipeline:plonepipeline:moodletheme.contentnavmergerplonecontentsource.plonetheme.contentxsltlinkrewritehtmlcleanertheme.contentnavmergermoodlecontentsource.moodlesource.portal
End Result
New Style
Portal content
Complications
NavigationOne page, two content sources, how is the navigation built?
SearchSearch needs to go across multiple systems
Will soon be looking at Solr, Xapian, Google Mini
.NET viewstate postbackMassive hidden state variable, form wraps entire site!
Questions?
13th May 2009
European Plone Symposium 2009