Feed the Masses


Published on

This talk will introduce the audience to Vice http://www.openplans.org/projects/vice/project-home a cutting-edge solution to all outbound syndication needs for Plone 3.1+, providing RSS 1.0, RSS 2.0, and Atom feed formats for all built in content types.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Feed the Masses

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