SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
Transmogrifier

       Lennart Regebro
Plone Conference 2009, Budapest
collective.transmogrifier

                 Created by
              Martijn Pieters, Jarn
                    in 2008
                  Released in
                   version 1.0
                  August 2009
collective.transmogrifier

                Import/migration
                   framework
               Both from Plone 2
                and from other
                websites or data
Super-simple architecture
                  You set up a
               pipeline of sections
                Each section send
                items to the next
                     section.
                   Sections do
               something with the
                 items (or not)
What are you talking about?
A simple example

1. A section that reads a CSV file with a list of
   events and creates items based on that data
2. A section that will generate some plone-specific
   data for each item, like path and type.
3. A section that creates the Plone event
4. A section that updates the Archetypes fields
5. A section that publishes the event
The CSV file



title,startDate,endDate
Plone Conference,2009-10-28 09:00,2009-10-30 18:00
Christmas,2009-12-24 00:00,2009-12-26:23:59
Setting it up


 1. Define a pipeline in a .cfg file

 2. Register it as a name in ZCML

3. Call Transmogrifier from Python
The configuration file
[transmogrifier]
pipeline =
    section1
    section2

[section1]
blueprint = name.of.the.blueprint
size = 5

[section2]
blueprint = another.blueprint
ZCML
<configure
   xmlns:transmogrifier=
     "http://namespaces.plone.org/transmogrifier">

 <transmogrifier:registerConfig
   name="Zap event import"
   title="Import of events"
   description=""
   configuration="transmogrifier.cfg"
   />

</configure>
setuphandlers.py

from collective.transmogrifier.transmogrifier import 
 Transmogrifier

def setupVarious(context):

   if context.readDataFile('zap_various.txt') is None:
       return

   transmogrifier = Transmogrifier(context.getSite())
   transmogrifier('Zap event import')
What is a generator

def my_generator():
    i=1
    while i < 1000:
        yield i
        i=i*2

for x in my_generator():
    print x
Never ending story

def my_generator():
    i=1
    while True:
        yield i
        i=i*2

for x in my_generator():
    print x
EventSource


class EventSource(object):

   def __iter__(self):
      for event is csv.DictReader(open(self.options['csvfile']))
         yield event

      for item in self.previous:
         yield item
EventSource


class EventSource(object):

   def __iter__(self):
      for event is csv.DictReader(open(self.options['csvfile']))
         yield event

      for item in self.previous:
         yield item
EventSource


class EventSource(object):

   def __iter__(self):
      for event is csv.DictReader(open(self.options['csvfile']))
         yield event

      for item in self.previous:
         yield item
The item


{
 'title': 'Plone Conference',
 'startDate': '2009-10-27 09:00',
 'endDate': '2009-10-30 18:00',
}
EventUpdater

class EventUpdater(object):

   def __iter__(self):
      for item in self.previous:
         id = item['title'].lower().replace(' ', '-')
         item['_path'] = '/events/'+id
         item['_type'] = 'Event'
         item['_transitions'] = ('publish',)
         yield item
The item

{
 '_type': 'Event',
 '_path': '/events/plone-conference',
 '_transitions': ('publish,),
 'title': 'Plone Conference',
 'startDate': '2009-10-27 09:00',
 'endDate': '2009-10-30 18:00',
}
Registering the section

<utility
  component=".eventsource.EventSource"
  name="zap.eventsource"
  />

<utility
  component=".eventsource.EventUpdater"
  name="zap.eventupdater"
  />
The configuration file
[transmogrifier]
pipeline =
    eventsource
    eventupdater

[eventsource]
blueprint = zap.eventsource
csvfile = /path/to/events.csv

[eventupdater]
blueprint = zap.eventupdater
The configuration file cont.

[constructor]
blueprint = collective.transmogrifier.sections.constructor

[schemaupdater]
blueprint = plone.app.transmogrifier.atschemaupdater

[workflow]
blueprint = plone.app.transmogrifier.workflowupdater
The configuration file cont.

[transmogrifier]
pipeline =
    eventsource
    eventupdater
    constructor
    schemaupdater
    workflow
Sections
           Create items
           Modify items
            Drop items
     Split the pipeline in
              two
      Construct content
       Modify content
Migrating from another CMS




  Similar to the simple example
  but using SQL instead of CSV
Migration from Plone 2




  1. Write an export script
 2. Write an import section
Migrate from Plone 2

     importsource
      constructor
    criterionadder
    schemaupdater
    browserdefault
       workflow
       savepoint
Migrating from HTML


           1. Get HTML from web

2. Extract fields like title, publish date, etc.

3. Make all urls either relative or into UID's
From small to huge



   Largest migration:
       28 sections
527 lines of configuration
   16 custom sections
Caveat Emptor




Don't migrate from HTML on disk
Caveat Emptor




Newly created objects are not indexed.
Caveat Emptor




Debugging is backwards
Lennart Regebro

regebro@gmail.com

 IRC nick: regebro

Mais conteúdo relacionado

Mais procurados

Boom! Promises/A+ Was Born
Boom! Promises/A+ Was BornBoom! Promises/A+ Was Born
Boom! Promises/A+ Was BornDomenic Denicola
 
Introduction to kotlin coroutines
Introduction to kotlin coroutinesIntroduction to kotlin coroutines
Introduction to kotlin coroutinesNAVER Engineering
 
Concurrency in go
Concurrency in goConcurrency in go
Concurrency in goborderj
 
7 Common Mistakes in Go (2015)
7 Common Mistakes in Go (2015)7 Common Mistakes in Go (2015)
7 Common Mistakes in Go (2015)Steven Francia
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersAlessandro Sanino
 
7 Common mistakes in Go and when to avoid them
7 Common mistakes in Go and when to avoid them7 Common mistakes in Go and when to avoid them
7 Common mistakes in Go and when to avoid themSteven Francia
 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applicationsrohitnayak
 
Something about Golang
Something about GolangSomething about Golang
Something about GolangAnton Arhipov
 
RDSDataSource: Мастер-класс по Dip
RDSDataSource: Мастер-класс по DipRDSDataSource: Мастер-класс по Dip
RDSDataSource: Мастер-класс по DipRAMBLER&Co
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrencyjgrahamc
 
Reactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaReactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaHermann Hueck
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in GolangBo-Yi Wu
 
ConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with GroovyConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with GroovyIván López Martín
 
A deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleA deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleSaúl Ibarra Corretgé
 
Mastering Kotlin Standard Library
Mastering Kotlin Standard LibraryMastering Kotlin Standard Library
Mastering Kotlin Standard LibraryNelson Glauber Leal
 

Mais procurados (20)

Boom! Promises/A+ Was Born
Boom! Promises/A+ Was BornBoom! Promises/A+ Was Born
Boom! Promises/A+ Was Born
 
Introduction to kotlin coroutines
Introduction to kotlin coroutinesIntroduction to kotlin coroutines
Introduction to kotlin coroutines
 
Concurrency in go
Concurrency in goConcurrency in go
Concurrency in go
 
7 Common Mistakes in Go (2015)
7 Common Mistakes in Go (2015)7 Common Mistakes in Go (2015)
7 Common Mistakes in Go (2015)
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
 
Concurrency with Go
Concurrency with GoConcurrency with Go
Concurrency with Go
 
The GO Language : From Beginners to Gophers
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
 
7 Common mistakes in Go and when to avoid them
7 Common mistakes in Go and when to avoid them7 Common mistakes in Go and when to avoid them
7 Common mistakes in Go and when to avoid them
 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applications
 
Something about Golang
Something about GolangSomething about Golang
Something about Golang
 
Async Frontiers
Async FrontiersAsync Frontiers
Async Frontiers
 
RDSDataSource: Мастер-класс по Dip
RDSDataSource: Мастер-класс по DipRDSDataSource: Мастер-класс по Dip
RDSDataSource: Мастер-класс по Dip
 
Go Concurrency
Go ConcurrencyGo Concurrency
Go Concurrency
 
Reactive Access to MongoDB from Scala
Reactive Access to MongoDB from ScalaReactive Access to MongoDB from Scala
Reactive Access to MongoDB from Scala
 
IoT Best practices
 IoT Best practices IoT Best practices
IoT Best practices
 
Testing con spock
Testing con spockTesting con spock
Testing con spock
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
 
ConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with GroovyConFess Vienna 2015 - Metaprogramming with Groovy
ConFess Vienna 2015 - Metaprogramming with Groovy
 
A deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio moduleA deep dive into PEP-3156 and the new asyncio module
A deep dive into PEP-3156 and the new asyncio module
 
Mastering Kotlin Standard Library
Mastering Kotlin Standard LibraryMastering Kotlin Standard Library
Mastering Kotlin Standard Library
 

Semelhante a Transmogrifier: Migrating to Plone with less pain

Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...Ville Mattila
 
An a z index of windows power shell commandss
An a z index of windows power shell commandssAn a z index of windows power shell commandss
An a z index of windows power shell commandssBen Pope
 
The Ring programming language version 1.3 book - Part 7 of 88
The Ring programming language version 1.3 book - Part 7 of 88The Ring programming language version 1.3 book - Part 7 of 88
The Ring programming language version 1.3 book - Part 7 of 88Mahmoud Samir Fayed
 
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEWINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEHitesh Mohapatra
 
Context Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basicsContext Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basicsFernando Lopez Aguilar
 
Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Alessandro Molina
 
Angular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupAngular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupDavid Barreto
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Hugo Hamon
 
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on OpenstackLinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on OpenstackOpenShift Origin
 
Glomosim adding routing protocol
Glomosim   adding routing protocolGlomosim   adding routing protocol
Glomosim adding routing protocolKathirvel Ayyaswamy
 
Vtk Image procesing
Vtk Image procesingVtk Image procesing
Vtk Image procesingSonu Mangal
 
12. session 12 java script objects
12. session 12   java script objects12. session 12   java script objects
12. session 12 java script objectsPhúc Đỗ
 
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterHaehnchen
 
Qtp not just for gui anymore
Qtp   not just for gui anymoreQtp   not just for gui anymore
Qtp not just for gui anymorePragya Rastogi
 
The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.2 book - Part 51 of 84The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.2 book - Part 51 of 84Mahmoud Samir Fayed
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slidesDavid Barreto
 

Semelhante a Transmogrifier: Migrating to Plone with less pain (20)

Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
Running a Scalable And Reliable Symfony2 Application in Cloud (Symfony Sweden...
 
An a z index of windows power shell commandss
An a z index of windows power shell commandssAn a z index of windows power shell commandss
An a z index of windows power shell commandss
 
The Ring programming language version 1.3 book - Part 7 of 88
The Ring programming language version 1.3 book - Part 7 of 88The Ring programming language version 1.3 book - Part 7 of 88
The Ring programming language version 1.3 book - Part 7 of 88
 
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISEWINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
WINDOWS ADMINISTRATION AND WORKING WITH OBJECTS : PowerShell ISE
 
Context Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basicsContext Information Management in IoT enabled smart systems - the basics
Context Information Management in IoT enabled smart systems - the basics
 
Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2
 
Angular Optimization Web Performance Meetup
Angular Optimization Web Performance MeetupAngular Optimization Web Performance Meetup
Angular Optimization Web Performance Meetup
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
 
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on OpenstackLinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
 
Glomosim adding routing protocol
Glomosim   adding routing protocolGlomosim   adding routing protocol
Glomosim adding routing protocol
 
Vtk Image procesing
Vtk Image procesingVtk Image procesing
Vtk Image procesing
 
Vtk file
Vtk   fileVtk   file
Vtk file
 
12. session 12 java script objects
12. session 12   java script objects12. session 12   java script objects
12. session 12 java script objects
 
Meteor
MeteorMeteor
Meteor
 
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
 
Ondemand scaling-aws
Ondemand scaling-awsOndemand scaling-aws
Ondemand scaling-aws
 
Qtp not just for gui anymore
Qtp   not just for gui anymoreQtp   not just for gui anymore
Qtp not just for gui anymore
 
The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.2 book - Part 51 of 84The Ring programming language version 1.2 book - Part 51 of 84
The Ring programming language version 1.2 book - Part 51 of 84
 
Angular performance slides
Angular performance slidesAngular performance slides
Angular performance slides
 

Mais de Lennart Regebro

Zope is dead - Long live Zope
Zope is dead - Long live ZopeZope is dead - Long live Zope
Zope is dead - Long live ZopeLennart Regebro
 
How not to develop with Plone
How not to develop with PloneHow not to develop with Plone
How not to develop with PloneLennart Regebro
 
Python 3 Compatibility (PyCon 2009)
Python 3 Compatibility (PyCon 2009)Python 3 Compatibility (PyCon 2009)
Python 3 Compatibility (PyCon 2009)Lennart Regebro
 
What Zope Did Wrong (PyCon 2008)
What Zope Did Wrong (PyCon 2008)What Zope Did Wrong (PyCon 2008)
What Zope Did Wrong (PyCon 2008)Lennart Regebro
 

Mais de Lennart Regebro (6)

Zope is dead - Long live Zope
Zope is dead - Long live ZopeZope is dead - Long live Zope
Zope is dead - Long live Zope
 
Porting to Python 3
Porting to Python 3Porting to Python 3
Porting to Python 3
 
How not to develop with Plone
How not to develop with PloneHow not to develop with Plone
How not to develop with Plone
 
Porting to Python 3
Porting to Python 3Porting to Python 3
Porting to Python 3
 
Python 3 Compatibility (PyCon 2009)
Python 3 Compatibility (PyCon 2009)Python 3 Compatibility (PyCon 2009)
Python 3 Compatibility (PyCon 2009)
 
What Zope Did Wrong (PyCon 2008)
What Zope Did Wrong (PyCon 2008)What Zope Did Wrong (PyCon 2008)
What Zope Did Wrong (PyCon 2008)
 

Último

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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...Miguel Araújo
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Transmogrifier: Migrating to Plone with less pain

  • 1. Transmogrifier Lennart Regebro Plone Conference 2009, Budapest
  • 2. collective.transmogrifier Created by Martijn Pieters, Jarn in 2008 Released in version 1.0 August 2009
  • 3. collective.transmogrifier Import/migration framework Both from Plone 2 and from other websites or data
  • 4. Super-simple architecture You set up a pipeline of sections Each section send items to the next section. Sections do something with the items (or not)
  • 5. What are you talking about?
  • 6. A simple example 1. A section that reads a CSV file with a list of events and creates items based on that data 2. A section that will generate some plone-specific data for each item, like path and type. 3. A section that creates the Plone event 4. A section that updates the Archetypes fields 5. A section that publishes the event
  • 7. The CSV file title,startDate,endDate Plone Conference,2009-10-28 09:00,2009-10-30 18:00 Christmas,2009-12-24 00:00,2009-12-26:23:59
  • 8. Setting it up 1. Define a pipeline in a .cfg file 2. Register it as a name in ZCML 3. Call Transmogrifier from Python
  • 9. The configuration file [transmogrifier] pipeline = section1 section2 [section1] blueprint = name.of.the.blueprint size = 5 [section2] blueprint = another.blueprint
  • 10. ZCML <configure xmlns:transmogrifier= "http://namespaces.plone.org/transmogrifier"> <transmogrifier:registerConfig name="Zap event import" title="Import of events" description="" configuration="transmogrifier.cfg" /> </configure>
  • 11. setuphandlers.py from collective.transmogrifier.transmogrifier import Transmogrifier def setupVarious(context): if context.readDataFile('zap_various.txt') is None: return transmogrifier = Transmogrifier(context.getSite()) transmogrifier('Zap event import')
  • 12. What is a generator def my_generator(): i=1 while i < 1000: yield i i=i*2 for x in my_generator(): print x
  • 13. Never ending story def my_generator(): i=1 while True: yield i i=i*2 for x in my_generator(): print x
  • 14. EventSource class EventSource(object): def __iter__(self): for event is csv.DictReader(open(self.options['csvfile'])) yield event for item in self.previous: yield item
  • 15. EventSource class EventSource(object): def __iter__(self): for event is csv.DictReader(open(self.options['csvfile'])) yield event for item in self.previous: yield item
  • 16. EventSource class EventSource(object): def __iter__(self): for event is csv.DictReader(open(self.options['csvfile'])) yield event for item in self.previous: yield item
  • 17. The item { 'title': 'Plone Conference', 'startDate': '2009-10-27 09:00', 'endDate': '2009-10-30 18:00', }
  • 18. EventUpdater class EventUpdater(object): def __iter__(self): for item in self.previous: id = item['title'].lower().replace(' ', '-') item['_path'] = '/events/'+id item['_type'] = 'Event' item['_transitions'] = ('publish',) yield item
  • 19. The item { '_type': 'Event', '_path': '/events/plone-conference', '_transitions': ('publish,), 'title': 'Plone Conference', 'startDate': '2009-10-27 09:00', 'endDate': '2009-10-30 18:00', }
  • 20. Registering the section <utility component=".eventsource.EventSource" name="zap.eventsource" /> <utility component=".eventsource.EventUpdater" name="zap.eventupdater" />
  • 21. The configuration file [transmogrifier] pipeline = eventsource eventupdater [eventsource] blueprint = zap.eventsource csvfile = /path/to/events.csv [eventupdater] blueprint = zap.eventupdater
  • 22. The configuration file cont. [constructor] blueprint = collective.transmogrifier.sections.constructor [schemaupdater] blueprint = plone.app.transmogrifier.atschemaupdater [workflow] blueprint = plone.app.transmogrifier.workflowupdater
  • 23. The configuration file cont. [transmogrifier] pipeline = eventsource eventupdater constructor schemaupdater workflow
  • 24. Sections Create items Modify items Drop items Split the pipeline in two Construct content Modify content
  • 25. Migrating from another CMS Similar to the simple example but using SQL instead of CSV
  • 26. Migration from Plone 2 1. Write an export script 2. Write an import section
  • 27. Migrate from Plone 2 importsource constructor criterionadder schemaupdater browserdefault workflow savepoint
  • 28. Migrating from HTML 1. Get HTML from web 2. Extract fields like title, publish date, etc. 3. Make all urls either relative or into UID's
  • 29. From small to huge Largest migration: 28 sections 527 lines of configuration 16 custom sections
  • 30. Caveat Emptor Don't migrate from HTML on disk
  • 31. Caveat Emptor Newly created objects are not indexed.