08086ac5cae628d04ee3abc28c5af6545dd73148
1 from argparse
import ArgumentParser
3 from Acquisition
import aq_base
4 from zope
.site
.hooks
import setSite
5 from Products
.CMFCore
.CMFCatalogAware
import CMFCatalogAware
10 def checkContents(ob
) :
13 print ob
.absolute_url()
15 print >> errorLog
, '%s/%s' % (ob
.aq_parent
.absolute_url(), ob
.aq_base
.id)
16 print >> errorLog
, getattr(ob
, 'portal_type', getattr(ob
, 'meta_type', ''))
20 if isinstance(aq_base(ob
), CMFCatalogAware
) :
21 assert ob
._getCatalogTool
()
25 if count
% 1000 == 0 :
27 print count
, 'commit.'
29 print >> errorLog
, '%s/%s' % (ob
.aq_parent
.absolute_url(), ob
.aq_base
.id)
32 if hasattr(aq_base(ob
), 'objectItems') :
33 obs
= ob
.objectItems()
38 parser
= ArgumentParser(description
="Deflate blobs backup set.")
39 parser
.add_argument('portal_path')
40 parser
.add_argument('--error-log', help='Error log file. Default: ~/catalog-rebuild-error.log',
41 default
='~/catalog-rebuild-error.log', required
=False, dest
='errorLogPath')
43 args
= parser
.parse_args()
44 portal
= app
.unrestrictedTraverse(args
.portal_path
)
46 ctool
= portal
.portal_catalog
47 errorLogPath
= os
.path
.expanduser(args
.errorLogPath
)
48 errorLog
= open(errorLogPath
, 'w')