Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import transaction
- class IndexProgressHandler( object ):
- def __init__( self, batch_size=1000 ):
- self.batch_size = batch_size
- self.total_size = 0
- self.start_time = 0
- def init( self, msg, num_objects ):
- self.total_size = num_objects
- self.start_time = time.time()
- log.info("Starting Catalog Reindex")
- def report( self, i ):
- if i%self.batch_size: return
- log.info(" Records %s Completed %0.2f%%"%(i, (float(i)/self.total_size)*100) )
- transaction.commit()
- def info( self, i ):
- log.info(" %s"%i)
- def finish( self ):
- log.info("Indexing Complete in %s"%(ptime( time.time()-self.start_time )))
- transaction.commit()
- app.plone.portal_catalog.refreshCatalog( clear=1, pghandler=IndexProgressHandler() )
Add Comment
Please, Sign In to add comment