Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Fast content import in Plone


Published on

Published in: Technology
  • Be the first to comment

Fast content import in Plone

  1. 1. fast content import in Plone how to import 120k documents in 8.43 minutes?
  2. 2. The problem ✓ we have 36.000 documents to migrate (which gives 120.000 with all their children) ✓ we don’t want to wait few hours to do that ✓ users shouldn’t be aware of the migration process
  3. 3. The Idea ✓ Why not just create brains and let users decide which document fully migrate?
  4. 4. It’s quite simple
  5. 5. First: Metadata ✓ dummy_object is a simple python object with minimal metadata >>> pp dummy_object.__dict__ {'title': u'dummy title', 'id': u'simple_id', 'review_state': 'private', 'path': '/plone/importfolder/ToBeMigrated_simple_id'}
  6. 6. Second: import script ✓ import script which creates brains in portal_catalog from our dummy object pc = getToolByName(self.context, 'portal_catalog') pc.catalog_object(dummy_object, dummy_object.path)
  7. 7. Third: Traverser ✓ Now we need to allow users to see them. ✓ So we created traverser in our import folder def __bobo_traverse__(self, REQUEST, name): if name.startswith('ToBeMigrated'): view = getMultiAdapter( (self, self.REQUEST), name='to_be_migrated') view.setBrainId(name) return view
  8. 8. At the End ✓ The view informs end- user that this document need to be migrated ✓ When user decides to import it - we will start the import process for selected brain.uid
  9. 9. At the End ✓ The rest is pure Plone folder_contents will lists 'to_be_migrated' brains in import folder for you ✓ Simple and much faster
  10. 10. Thanks! Andrew Mleczko Plone archaeologist