Feed the Masses
-
Upload
pbugni -
Category
Technology
-
view
1.690 -
download
1
description
Transcript of Feed the Masses
![Page 1: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/1.jpg)
Paul BugniCenter for Public Health Informatics
Feed the Masses
T: 206.221.7444F: 206.616.5249
1100 NE 45th Street, Ste 405Seattle, WA 98105
www.cphi.washington.edu
Introducing Vice - Outbound Syndication in Plonevia the Zope Component Architecture
![Page 2: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/2.jpg)
Agenda
• Syndication
• Vice History and Demonstration
• Zope Component Architecture
• Vice Integration
• Customizing Syndication
![Page 3: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/3.jpg)
What is syndication?
![Page 4: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/4.jpg)
To publish or broadcast
• Alternative to browser only audience for publishing content
![Page 5: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/5.jpg)
“Web Feed” or “News Feed”
![Page 6: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/6.jpg)
Data format for frequently updated content
![Page 7: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/7.jpg)
Content distributors syndicate a web feed
![Page 8: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/8.jpg)
Users can easily subscribe to the feed
![Page 9: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/9.jpg)
Simplifies keeping up with changes
![Page 10: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/10.jpg)
Using Aggregators
![Page 11: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/11.jpg)
![Page 12: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/12.jpg)
![Page 13: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/13.jpg)
Prevailing syndication formats
• That’s the beauty of standards, there are so many to pick from!
![Page 14: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/14.jpg)
Two prevailing formats (as of mid-2005)
• RSS 2.0
• Atom 1.0
![Page 15: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/15.jpg)
Exposing the myth of RSS compatibility
• “I would like to publicly apologize for my previous misstatements. There are not 7 different and incompatible versions of RSS; there are 9” - Mark Pilgrim[1]
[1] http://diveintomark.org/archives/2004/02/04/incompatible-rss
![Page 16: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/16.jpg)
RSS Stands For?
• RDF (Resource Description Framework) Site Summary (RSS 1.0 and RSS 0.90)
• Rich Site Summary (RSS 0.91)
• Really Simple Syndication (RSS 2.0)
![Page 17: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/17.jpg)
First, there was the mark up language RDF
• Resource Description Framework
• Used to store metadata (author, language, copyright…) about the content
![Page 18: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/18.jpg)
RSS 0.90
• In 1999 Netscape created the standard named RSS version 0.90
• The beginning of RSS as we know it today
![Page 19: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/19.jpg)
RSS 0.91 (part 1)
• Dan Libby (Netscape) improved 0.90 and released RSS version 0.91
![Page 20: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/20.jpg)
RSS 0.91 (part 2)
• Dave Winer (Userland) also created an improvement of RSS 0.90 and called his version 0.91
![Page 21: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/21.jpg)
Confusion ensued
• Two versions named RSS 0.91 with different specifications
![Page 22: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/22.jpg)
RSS 1.0
• Rael Dornfest (O’Reily) released RSS version 1.0
• Based on the RDF standard rather than RSS
• RSS 1.0 was therefore incompatible with previous RSS versions
![Page 23: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/23.jpg)
So to clear things up
• Userland named their next release version 2.0
• Harvard Law accepted responsibility for the RSS 2.0 specification
• RSS 2.0 is very similar to 0.9 series (generally compatible)
• RSS 1.0 remains very different
![Page 24: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/24.jpg)
RSS 2.0
• The specification is copyrighted by Harvard University and is frozen.
• The intent is that future work will be done under a different name.
![Page 25: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/25.jpg)
Atom 1.0
• In part, motivated by the desire to be free of the RSS confusion
![Page 26: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/26.jpg)
Atompub Working Group
![Page 27: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/27.jpg)
IETF (Internet Engineering Task Force)
![Page 28: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/28.jpg)
The Atom syndication format has been adopted as IETF
Proposed Standard RFC 4287
![Page 29: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/29.jpg)
RSS 2.0 versus Atom 1.0
• A number of ambiguities exist in RSS 2.0 including:– No required fields (Atom requires title unique id and last updated)– No way to indicate if payload is encoded or plain text (Atom
requires explicit declaration and includes options such as another XML vocabulary)
– Autodiscover is not standardized and relies on an unregistered MIME type
– Only Atom 1.0 is in an XML namespace and has specific guidelines for interpreting extension elements. (RSS 2.0 does not permit well formed XML markup)
• http://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared
![Page 30: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/30.jpg)
Need For Better Syndication in Plone
• 2006-Feb-01 PLIP #128 was born– PLIP: Plone Improvement Proposal,
analogous to python’s PEPs: Python Enhancement Proposal
• #128: Pluggable Plone Syndication (PPS)
![Page 31: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/31.jpg)
PLIP #128 Motivation
• The current portal_syndication tool [only supports RSS 1.0 format and therefore] doesn’t have support for enclosures
![Page 32: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/32.jpg)
PLIP #128 Motivation (continued)
• [No current support to] extend syndication beyond common object attributes (i.e.Title, description, body etc.)
![Page 33: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/33.jpg)
PLIP #128 Motivation (continued)
• [No current support for] different types of feed entries for different content types (i.e. enclosures for media content a.k.a. podcasting)
![Page 34: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/34.jpg)
PLIP #128
• Enable advanced (RSS 2.0, Atom) site-wide syndication on all ATCT content “out-of-the-box” using Zope 3-based adaptors (via Five) which are extendable beyond ATCT to any content type.
• (ATCT : ATContent Types)
![Page 35: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/35.jpg)
Vice to the Rescue!
![Page 36: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/36.jpg)
And the name ?
• Before vice, there was “CMFSin”, “basesyndication”, “fatsyndication”, “synz”…
• “Vice was the cleanest name we could come up with.”
![Page 37: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/37.jpg)
Vice was Born at the (now infamous) BBQ Sprint
• Participants– Derek Richardson– Liz Dahlstrom– Mikel Larreategi– Jørgen Gårdsted
Jørgensen– Paul Bugni
![Page 38: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/38.jpg)
Then Vice Picked up a Sponsor
• Derek Richardson (student)
• Florian Schulze (mentor)
• Report: http://www.openplans.org/projects/vice/google-summer-of-code-report
![Page 39: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/39.jpg)
Vice also benefited from additional sprints
• Plone4Artist Multimedia Sprint
• 2007 Plone Conference Sprint
![Page 40: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/40.jpg)
Installing Vice
![Page 41: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/41.jpg)
Add Vice to the Buildout Eggs
• Using buildout, edit buildout.cfg and add vice.plone.outbound to the [eggs] section:
eggs =
elementtree
vice.plone.outbound
![Page 42: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/42.jpg)
Include the Vice Configuration Files (a la zcml slug)
• Edit buildout.cfg and add vice.plone.outbound to the [instance] zcml
[instance]
zcml = vice.plone.outbound
![Page 43: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/43.jpg)
That’s It?
• Well, it should be, but Zope2 is not yet “eggified” and vice has dependencies related to Zope3 eggs
![Page 44: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/44.jpg)
Workaround:
• Add “fake_zope_eggs = true” to the [zope2] section of your buildout
![Page 45: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/45.jpg)
Re-run ./bin/buildout
![Page 46: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/46.jpg)
Install Product in Portal
• Install “Outbound Syndication (Vice)”
![Page 47: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/47.jpg)
Configure for Use
• From the plone_control_panel (site setup)…
• Find the syndication “configlet” listed in the add on product configuration
• Enable syndication
![Page 48: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/48.jpg)
Out of the box demo
< break to vice demo >
![Page 49: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/49.jpg)
Design Goals
• So which format do we architect around?
![Page 50: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/50.jpg)
Ideally, none of them!
![Page 51: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/51.jpg)
Separation of Concerns
• Goal: separate the action of syndication from any particular format
![Page 52: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/52.jpg)
Goal: Make it easy to add additional feed types
![Page 53: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/53.jpg)
Goal: Make it easy to extend beyond common object
attributes
![Page 54: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/54.jpg)
How to Manage the Complexity?
• Idea: isolate behavior in “objects” dedicated to a single purpose.
![Page 55: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/55.jpg)
The Previous Approach:
• Use multiple inheritance to mix and match objects (create mix-ins)
• Subclass the mix-ins for further customizations
![Page 56: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/56.jpg)
The Downsides
• Complexity: objects built from a large number of base classes
• Lack of cohesion: lots of unrelated attributes and methods
![Page 57: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/57.jpg)
A Better Way
• Introducing the Zope Component Architecture
![Page 58: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/58.jpg)
Three Core Concepts
• Interfaces
• Components
• Adapters
![Page 59: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/59.jpg)
Interfaces
• A formal description of how to interact with an object
• Can be as simple as a label, or “marker”
![Page 60: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/60.jpg)
Components
• An “object” with introspective interfaces
![Page 61: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/61.jpg)
Adapters
• Inexpensive mechanism to add behavior (defined in interfaces) to existing components
• Extends a components functionality without modifications to the component
![Page 62: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/62.jpg)
Types of Components
• Content Components
• View Components
• Adapter Components
• Utility Components
![Page 63: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/63.jpg)
Zope Component Architecture
• Web Component Development with Zope 3, 3rd ed.
• Philipp von Weitershausen
![Page 64: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/64.jpg)
Core Vice Concepts
• Containers (such as Folders) are “Feedable” (marked with the IFeedable interface, adaptable to the IFeed interface)
• Content Objects (such as Documents) are “Feed Items” (adaptable to the IFeedItem interface)
![Page 65: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/65.jpg)
IFeedable
• Mark all folders as being “feedable”:
<class class="zope.app.folder.Folder">
<implements interface=".interfaces.IFeedable" />
</class>
![Page 66: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/66.jpg)
IFeed
• Represents a “Feed”
• Use to adapt objects that can provide items to feed
![Page 67: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/67.jpg)
IFeed
class IFeed(Interface):
"""A syndication feed e.g. RSS, atom, etc. To syndicate a container,
adapt it to IFeed.
"””
![Page 68: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/68.jpg)
IFeed Adapters
• Adapted to the Plone Site Root
• All Folders (IATFolder)
![Page 69: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/69.jpg)
IFeedItem
• Represents a single item, or entry in a feed
![Page 70: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/70.jpg)
IFeedItem
class IFeedItem(Interface):
"""A single syndication feed item.
""”
![Page 71: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/71.jpg)
IFeedItem Adapters
• Adapted to the respective AT Content Types:– IATDocument– IATEvent– IATLink– IATImage– IATFile– IATNewsItem
![Page 72: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/72.jpg)
Thus Vice Handles all AT Content Types “out of the box”• This includes any customized ATCT
subclasses
![Page 73: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/73.jpg)
How to Syndicate a New Type
![Page 74: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/74.jpg)
New Type Must Be Adaptable to IFeedItem
![Page 75: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/75.jpg)
Register the Adapter Factory
<!-- Vice demo, adapt example.dexterity.page.IPage to IFeedItem
so the example dexterity pages can be syndicated -->
<adapter
factory=".syndication.ExampleDexterityPageFeedItem"
name="vice-default"
trusted="true" />
<class class=".syndication.ExampleDexterityPageFeedItem">
<require
permission="vice.ViewFeeds"
interface="vice.outbound.interfaces.IFeedItem" />
</class>
![Page 76: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/76.jpg)
Define the IFeedItem Adapter Class
class ExampleDexterityPageFeedItem(ExampleDexterityFeedItemBase):
""”Makes example.dexterity.page.IPage IFeedItem adaptable.
"""
implements(IFeedItem)
adapts(IPage, IFeed)
@property
def body(self):
"""See IFeedItem
"""
v = getMultiAdapter((self.context, self.context.REQUEST), Interface, name=u'syndicate_page')
return v().encode('utf-8')
![Page 77: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/77.jpg)
Page Template for Body of Feed Item
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
i18n:domain="plone">
<body>
<p tal:content="context/Description" />
<div tal:content="structure context/body" />
</body>
</html>
![Page 78: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/78.jpg)
That’s It
• < break to demo using example.dexterity >
![Page 79: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/79.jpg)
Adding a new Feed Format
• This trivial act is left as an exercise for the reader
![Page 80: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/80.jpg)
But there’s a vice sprint going on this weekend!
• http://www.openplans.org/projects/plone-conference-2008-dc/vice
![Page 81: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/81.jpg)
Inbound Story?
• Ajax approach: plone.syndication.inbound
• Persistent approach: feedfeeder– http://plone.org/products/feedfeeder
![Page 82: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/82.jpg)
How to get involved
• Did I mention the sprint?
• Join the mailing lists:
• http://www.openplans.org/projects/vice/lists– Developer list: [email protected]– Discussion list: vice-
![Page 83: Feed the Masses](https://reader037.fdocuments.net/reader037/viewer/2022102716/54c2082b4a7959b5138b4575/html5/thumbnails/83.jpg)
Questions?