Last change
on this file since 2391 was
1728,
checked in by mylan, 14 years ago
|
Add flag for turn-on/off catalog updating. By default set to False. Update INSTALLATION file with cataog updating instructions
|
-
Property svn:eol-style set to
native
|
File size:
904 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 | from config import UPDATE_CATALOG |
---|
9 | |
---|
10 | logger = logging.getLogger('quintagroup.seoptimizer') |
---|
11 | |
---|
12 | def updateCatalog(context): |
---|
13 | """ Update Catalog to collect data for canonical_path metadata. |
---|
14 | """ |
---|
15 | if not (context.readDataFile('plonegooglesitemap_install.txt') is not None \ |
---|
16 | and UPDATE_CATALOG): |
---|
17 | return |
---|
18 | |
---|
19 | site = context.getSite() |
---|
20 | catalog = getToolByName(site, 'portal_catalog') |
---|
21 | |
---|
22 | elapse = time.time() |
---|
23 | c_elapse = time.clock() |
---|
24 | print "Start of catalog rebuilding : %s" % c_elapse |
---|
25 | catalog.refreshCatalog(clear=1) |
---|
26 | elapse = time.time() - elapse |
---|
27 | c_elapse = time.clock() - c_elapse |
---|
28 | print "Catalog Rebuild\nTotal time: %s\nTotal CPU time: %s" % (elapse, c_elapse) |
---|
29 | |
---|
30 | |
---|
31 | |
---|
Note: See
TracBrowser
for help on using the repository browser.