SlideShare a Scribd company logo
1 of 22
Download to read offline
Moving an old-style product to Plone 3
    Plone Conference 2008 - Washington D.C.


                      Ricardo Alves
                    rsa@eurotux.com


                      October 27, 2008




    Ricardo Alves rsa@eurotux.com   Moving an old-style product to Plone 3
Contents

Contents




  1   About the Example


  2   Get it to work


  3   Benefit from Plone 3




             Ricardo Alves rsa@eurotux.com    Moving an old-style product to Plone 3
About the Example

TuxLiveFM




  Product
      Add-on for Plone 2.5
      Archetypes-based content types
      Mixin classes
      New portlet
      Skin layers




            Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
About the Example

TuxLiveFM – Structure

  Products/
      TuxLiveFM/
          Extensions/
              Install.py
          __init__.py
          config.py
          content/
              show.py
              episode.py
              series.py
              __init__.py
          skins/
              tuxfmlive/
                   portlet_lastepisode.pt
                   radioshow_view.pt
                   radioepisode_view.pt
                   tuxlivefm.css.dtml
                   search_episodes.pt
          license.txt
          readme.txt
          version.txt


            Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
Get it to work

Get it to work




       Fix broken code due to API changes
       (CMFCorePermissions, ...)
       Use GenericSetup for product installation
       Migrate portlets




             Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Product Installation


  Define a profile using GenericSetup

  TuxLiveFM/configure.zcml

  <configure
    xmlns=quot;http://namespaces.zope.org/zopequot;
    xmlns:genericsetup=quot;http://namespaces.zope.org/genericsetupquot;
    i18n_domain=quot;TuxLiveFMquot;>

    <genericsetup:registerProfile
      name=quot;tuxlivefmquot;
      title=quot;TuxLiveFMquot;
      directory=quot;profiles/defaultquot;
      description=quot;TuxLiveFM product.quot;
      provides=quot;Products.GenericSetup.interfaces.EXTENSIONquot;
      />

  </configure>


            Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Product Installation - Types




  TuxLiveFM/Extensions/Install.py

  ...
        # install types
        classes = listTypes(PROJECT_NAME)
        installTypes(self, out, classes, PROJECT_NAME)
  ...




            Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Product Installation - Types




  profiles/default/types.xml

  <?xml version=quot;1.0quot;?>
  <object name=quot;portal_typesquot; meta_type=quot;Plone Types Toolquot;>
  <object name=quot;RadioShowquot;
      meta_type=quot;Factory-based Type Information with dynamic viewsquot;/>
  <object name=quot;RadioEpisodequot;
      meta_type=quot;Factory-based Type Information with dynamic viewsquot;/>
  </object>




            Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Product Installation - Types


  profiles/default/types/RadioShow.xml

  <?xml version=quot;1.0quot;?>
  <object name=quot;RadioShowquot;
     meta_type=quot;Factory-based Type Information with dynamic viewsquot;
     i18n:domain=quot;plonequot;
     xmlns:i18n=quot;http://xml.zope.org/namespaces/i18nquot;>
   <property name=quot;titlequot; i18n:translate=quot;quot;>Radio Show</property>
   <property name=quot;descriptionquot;
        i18n:translate=quot;quot;>Describes a Radio Show.</property>
   <property name=quot;content_iconquot;>document_icon.gif</property>
   <property name=quot;content_meta_typequot;>RadioShow</property>
   <property name=quot;productquot;>tuxfm</property>
   <property name=quot;factoryquot;>addRadioShow</property>
   <property name=quot;immediate_viewquot;>base_view</property>
   <property name=quot;global_allowquot;>True</property>
   <property name=quot;filter_content_typesquot;>True</property>
   <property name=quot;allowed_content_typesquot;>
   ...



            Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Product Installation - Skins




   TuxLiveFM/Extensions/Install.py

   ...
         # install skins
         install_subskin(self, out, GLOBALS)
   ...




             Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Product Installation - Skins



   profiles/default/skins.xml

   <?xml version=quot;1.0quot;?>
   <object name=quot;portal_skinsquot; allow_any=quot;Falsequot;
     cookie_persistence=quot;Falsequot; default_skin=quot;TuxLiveFMquot;>

    <object name=quot;tuxlivefm_templatesquot;
       meta_type=quot;Filesystem Directory Viewquot;
       directory=quot;Products.TuxLiveFm:skins/tuxlivefm_templatesquot;/>

    <skin-path name=quot;TuxLiveFMquot; based-on=quot;Plone Defaultquot;>
     <layer name=quot;tuxlivefm_templatesquot; insert-after=quot;customquot;/>
    </skin-path>

   </object>




               Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Product Installation - CSS


  TuxLiveFM/Extensions/Install.py

  ...
        # register stylesheets
        css_tool = getToolByName(self, ’portal_css’)
        stylesheets = css_tool.getResources()
        stylesheet_ids = [x.getId() for x in stylesheets]

        if ’tuxlivefm.css’ not in stylesheet_ids:
            css_tool.registerStylesheet(
                ’tuxlivefm.css’,
                expression=’’,
                media=’screen’,
                rel=’stylesheet’,
                rendering=’import’)
  ...



             Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Product Installation - CSS




  profiles/default/cssregistry.xml

  <?xml version=quot;1.0quot;?>
  <object name=quot;portal_cssquot;>

    <stylesheet title=quot;quot; cacheable=quot;Truequot; compression=quot;safequot;
      cookable=quot;Truequot; enabled=quot;1quot; expression=quot;quot;
      id=quot;tuxlivefm.cssquot; media=quot;screenquot; rel=quot;stylesheetquot;
      rendering=quot;importquot;/>

  </object>




              Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Get it to work

Migrate portlets




      Convert legacy portlets, or
      Create classic portlet
   <assignment
       manager=quot;plone.rightcolumnquot;
       category=quot;content_typequot;
       key=quot;RadioShowquot;
       type=quot;portlets.Classicquot;>
    <property name=quot;templatequot;>portlet_lastepisode</property>
    <property name=quot;macroquot;>portlet</property>
   </assignment>




            Ricardo Alves rsa@eurotux.com      Moving an old-style product to Plone 3
Benefit from Plone 3

New Components for specialized behavior

      Define interfaces

      class IRadioSeries(Interface):

           def lastEpisodeURL(self):
               quot;quot;quot; Returns the URL of the last episode available.
               quot;quot;quot;

           def searchEpisodes(self, **kwargs):
               quot;quot;quot; Perform search in the available episodes.
               quot;quot;quot;

      Replace mixin class with an adapter
        <adapter factory=quot;.content.series.RadioSeriesquot;
           for=quot;.interfaces.IRadioShowquot;
           provides=quot;.interfaces.IRadioSeriesquot;
           />


             Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
Benefit from Plone 3

Use browser views




      Add browser view EpisodeSearchView
      Move related methods to the view class.

  class SearchEpisodesView(BrowserView):

      def searchEpisodes(self, **kwargs):
          series = IRadioSeries(self.context)
          return series.searchEpisodes(**kwargs)




           Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
Benefit from Plone 3

Deprecate old code




      Use zope.deprecation for modules to be removed
      Deprecation period of one or two feature releases
      import zope.deprecation
      zope.deprecation.deprecated(’ShowSeriesMixin’,
      quot;Products.TuxLiveFM.content.series.ShowSeriesMixin has quot;
      quot;been deprecated and will be removed in version 0.3.quot;)

      Move deprecated templates to another layer.




             Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
Benefit from Plone 3

Use Zope 3 Interfaces with Archetypes



      Define Zope 3 schema interface for content types
      from zope import schema
      ...
      class IRadioShow(Interface):
          body = schema.Text(title=_(u’Body’))
      ...

      Use ATFieldProperty as a bridge from fields to Python properties
      from Products.Archetypes import public as atapi
      ...
          body = atapi.ATFieldProperty(’body’)
      ...




            Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
Benefit from Plone 3

TuxLiveFM – Structure
  Products/
      TuxLiveFM/
          __init__.py
          config.py
          interfaces.py
          browser/
              search_episodes.py
              search_episodes.pt
          profiles/
              default/
                   types/
                   types.xml
                   skins.xml
                   cssregistry.xml
                   portlets.xml
                   actionicons.xml
          content/
              show.py
              episode.py
              series.py
          skins/
              tuxfmlive/
                   radioshow_view.pt
                   radioepisode_view.pt
                   tuxlivefm.css.dtml
                   portlet_lastepisode.pt
              tuxfmlive_deprecated/
                   search_episodes.pt
          license.txt
          readme.txt
          version.txt

                Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
Benefit from Plone 3

Eggify the Product




  Use paster to create the package structure:
  paster create -t plone

  Products.TuxLiveFM/
      Products/
           TuxLiveFM/
           ...
      docs
      Products.TuxLiveFM.egg-info/
      setup.cfg
      README.txt
      setup.py




            Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
Benefit from Plone 3

References




     Plone Upgrade Guide –
     http://plone.org/documentation/manual/
     upgrade-guide/version/2.5-3.0/products
     TuxLiveFM in the collective (soon)




             Ricardo Alves rsa@eurotux.com     Moving an old-style product to Plone 3
Questions

Questions




                      Questions?




            Ricardo Alves rsa@eurotux.com    Moving an old-style product to Plone 3

More Related Content

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Moving an old-style product to Plone 3

  • 1. Moving an old-style product to Plone 3 Plone Conference 2008 - Washington D.C. Ricardo Alves rsa@eurotux.com October 27, 2008 Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 2. Contents Contents 1 About the Example 2 Get it to work 3 Benefit from Plone 3 Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 3. About the Example TuxLiveFM Product Add-on for Plone 2.5 Archetypes-based content types Mixin classes New portlet Skin layers Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 4. About the Example TuxLiveFM – Structure Products/ TuxLiveFM/ Extensions/ Install.py __init__.py config.py content/ show.py episode.py series.py __init__.py skins/ tuxfmlive/ portlet_lastepisode.pt radioshow_view.pt radioepisode_view.pt tuxlivefm.css.dtml search_episodes.pt license.txt readme.txt version.txt Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 5. Get it to work Get it to work Fix broken code due to API changes (CMFCorePermissions, ...) Use GenericSetup for product installation Migrate portlets Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 6. Get it to work Product Installation Define a profile using GenericSetup TuxLiveFM/configure.zcml <configure xmlns=quot;http://namespaces.zope.org/zopequot; xmlns:genericsetup=quot;http://namespaces.zope.org/genericsetupquot; i18n_domain=quot;TuxLiveFMquot;> <genericsetup:registerProfile name=quot;tuxlivefmquot; title=quot;TuxLiveFMquot; directory=quot;profiles/defaultquot; description=quot;TuxLiveFM product.quot; provides=quot;Products.GenericSetup.interfaces.EXTENSIONquot; /> </configure> Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 7. Get it to work Product Installation - Types TuxLiveFM/Extensions/Install.py ... # install types classes = listTypes(PROJECT_NAME) installTypes(self, out, classes, PROJECT_NAME) ... Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 8. Get it to work Product Installation - Types profiles/default/types.xml <?xml version=quot;1.0quot;?> <object name=quot;portal_typesquot; meta_type=quot;Plone Types Toolquot;> <object name=quot;RadioShowquot; meta_type=quot;Factory-based Type Information with dynamic viewsquot;/> <object name=quot;RadioEpisodequot; meta_type=quot;Factory-based Type Information with dynamic viewsquot;/> </object> Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 9. Get it to work Product Installation - Types profiles/default/types/RadioShow.xml <?xml version=quot;1.0quot;?> <object name=quot;RadioShowquot; meta_type=quot;Factory-based Type Information with dynamic viewsquot; i18n:domain=quot;plonequot; xmlns:i18n=quot;http://xml.zope.org/namespaces/i18nquot;> <property name=quot;titlequot; i18n:translate=quot;quot;>Radio Show</property> <property name=quot;descriptionquot; i18n:translate=quot;quot;>Describes a Radio Show.</property> <property name=quot;content_iconquot;>document_icon.gif</property> <property name=quot;content_meta_typequot;>RadioShow</property> <property name=quot;productquot;>tuxfm</property> <property name=quot;factoryquot;>addRadioShow</property> <property name=quot;immediate_viewquot;>base_view</property> <property name=quot;global_allowquot;>True</property> <property name=quot;filter_content_typesquot;>True</property> <property name=quot;allowed_content_typesquot;> ... Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 10. Get it to work Product Installation - Skins TuxLiveFM/Extensions/Install.py ... # install skins install_subskin(self, out, GLOBALS) ... Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 11. Get it to work Product Installation - Skins profiles/default/skins.xml <?xml version=quot;1.0quot;?> <object name=quot;portal_skinsquot; allow_any=quot;Falsequot; cookie_persistence=quot;Falsequot; default_skin=quot;TuxLiveFMquot;> <object name=quot;tuxlivefm_templatesquot; meta_type=quot;Filesystem Directory Viewquot; directory=quot;Products.TuxLiveFm:skins/tuxlivefm_templatesquot;/> <skin-path name=quot;TuxLiveFMquot; based-on=quot;Plone Defaultquot;> <layer name=quot;tuxlivefm_templatesquot; insert-after=quot;customquot;/> </skin-path> </object> Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 12. Get it to work Product Installation - CSS TuxLiveFM/Extensions/Install.py ... # register stylesheets css_tool = getToolByName(self, ’portal_css’) stylesheets = css_tool.getResources() stylesheet_ids = [x.getId() for x in stylesheets] if ’tuxlivefm.css’ not in stylesheet_ids: css_tool.registerStylesheet( ’tuxlivefm.css’, expression=’’, media=’screen’, rel=’stylesheet’, rendering=’import’) ... Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 13. Get it to work Product Installation - CSS profiles/default/cssregistry.xml <?xml version=quot;1.0quot;?> <object name=quot;portal_cssquot;> <stylesheet title=quot;quot; cacheable=quot;Truequot; compression=quot;safequot; cookable=quot;Truequot; enabled=quot;1quot; expression=quot;quot; id=quot;tuxlivefm.cssquot; media=quot;screenquot; rel=quot;stylesheetquot; rendering=quot;importquot;/> </object> Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 14. Get it to work Migrate portlets Convert legacy portlets, or Create classic portlet <assignment manager=quot;plone.rightcolumnquot; category=quot;content_typequot; key=quot;RadioShowquot; type=quot;portlets.Classicquot;> <property name=quot;templatequot;>portlet_lastepisode</property> <property name=quot;macroquot;>portlet</property> </assignment> Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 15. Benefit from Plone 3 New Components for specialized behavior Define interfaces class IRadioSeries(Interface): def lastEpisodeURL(self): quot;quot;quot; Returns the URL of the last episode available. quot;quot;quot; def searchEpisodes(self, **kwargs): quot;quot;quot; Perform search in the available episodes. quot;quot;quot; Replace mixin class with an adapter <adapter factory=quot;.content.series.RadioSeriesquot; for=quot;.interfaces.IRadioShowquot; provides=quot;.interfaces.IRadioSeriesquot; /> Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 16. Benefit from Plone 3 Use browser views Add browser view EpisodeSearchView Move related methods to the view class. class SearchEpisodesView(BrowserView): def searchEpisodes(self, **kwargs): series = IRadioSeries(self.context) return series.searchEpisodes(**kwargs) Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 17. Benefit from Plone 3 Deprecate old code Use zope.deprecation for modules to be removed Deprecation period of one or two feature releases import zope.deprecation zope.deprecation.deprecated(’ShowSeriesMixin’, quot;Products.TuxLiveFM.content.series.ShowSeriesMixin has quot; quot;been deprecated and will be removed in version 0.3.quot;) Move deprecated templates to another layer. Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 18. Benefit from Plone 3 Use Zope 3 Interfaces with Archetypes Define Zope 3 schema interface for content types from zope import schema ... class IRadioShow(Interface): body = schema.Text(title=_(u’Body’)) ... Use ATFieldProperty as a bridge from fields to Python properties from Products.Archetypes import public as atapi ... body = atapi.ATFieldProperty(’body’) ... Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 19. Benefit from Plone 3 TuxLiveFM – Structure Products/ TuxLiveFM/ __init__.py config.py interfaces.py browser/ search_episodes.py search_episodes.pt profiles/ default/ types/ types.xml skins.xml cssregistry.xml portlets.xml actionicons.xml content/ show.py episode.py series.py skins/ tuxfmlive/ radioshow_view.pt radioepisode_view.pt tuxlivefm.css.dtml portlet_lastepisode.pt tuxfmlive_deprecated/ search_episodes.pt license.txt readme.txt version.txt Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 20. Benefit from Plone 3 Eggify the Product Use paster to create the package structure: paster create -t plone Products.TuxLiveFM/ Products/ TuxLiveFM/ ... docs Products.TuxLiveFM.egg-info/ setup.cfg README.txt setup.py Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 21. Benefit from Plone 3 References Plone Upgrade Guide – http://plone.org/documentation/manual/ upgrade-guide/version/2.5-3.0/products TuxLiveFM in the collective (soon) Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3
  • 22. Questions Questions Questions? Ricardo Alves rsa@eurotux.com Moving an old-style product to Plone 3