Last change
on this file since 1727 was
1727,
checked in by mylan, 14 years ago
|
Add catalog updating on product installation
|
-
Property svn:eol-style set to
native
|
File size:
826 bytes
|
Line | |
---|
1 | import logging |
---|
2 | import time |
---|
3 | from Products.CMFCore.utils import getToolByName |
---|
4 | from Products.CMFCore.Expression import Expression |
---|
5 | |
---|
6 | from Products.ZCatalog.ProgressHandler import ZLogHandler |
---|
7 | |
---|
8 | logger = logging.getLogger('quintagroup.seoptimizer') |
---|
9 | |
---|
10 | def updateCatalog(context): |
---|
11 | """ Update Catalog to collect data for canonical_path metadata. |
---|
12 | """ |
---|
13 | if context.readDataFile('plonegooglesitemap_install.txt') is None: |
---|
14 | return |
---|
15 | |
---|
16 | site = context.getSite() |
---|
17 | catalog = getToolByName(site, 'portal_catalog') |
---|
18 | |
---|
19 | elapse = time.time() |
---|
20 | c_elapse = time.clock() |
---|
21 | print "Start of catalog rebuilding : %s" % c_elapse |
---|
22 | catalog.refreshCatalog(clear=1) |
---|
23 | elapse = time.time() - elapse |
---|
24 | c_elapse = time.clock() - c_elapse |
---|
25 | print "Catalog Rebuild\nTotal time: %s\nTotal CPU time: %s" % (elapse, c_elapse) |
---|
26 | |
---|
27 | |
---|
28 | |
---|
Note: See
TracBrowser
for help on using the repository browser.