Changeset 54
- Timestamp:
- 11/22/05 07:33:20
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneGoogleSitemaps/trunk/skins/qPloneGoogleSitemaps/searchForGoogleSitemapObjects.py
r53 r54 15 15 16 16 catalog = getToolByName(context, 'portal_catalog') 17 props = getToolByName(context, 'portal_properties').googlesitemap_properties 18 res = catalog(path = path, 19 portal_type = props.portalTypes, 20 review_state = props.states, 21 ) 17 try: 18 props = getToolByName(context, 'portal_properties').googlesitemap_properties 19 objects = catalog(path = path, 20 portal_type = props.portalTypes, 21 review_state = props.states, 22 ) 23 except AttributeError: 24 # We are run without being properly installed, do default processing 25 return applyOperations(catalog(path = path, 26 review_state = ['published'], 27 ),[]) 22 28 23 bl = props.blackout_list 24 result = list(res) 25 for cat in res: 26 for patt in bl: 27 match = str(cat.getId).find(patt) 28 if match <> -1: 29 try: 30 result.remove(cat) 31 except: pass 32 33 34 pattern = props.getProperty('reg_exp') 35 r = applyOperations(result,pattern) 36 37 return r 29 blackout_list = props.blackout_list 30 return applyOperations([ob for ob in objects if not(ob.getId in blackout_list)], 31 props.getProperty('reg_exp')) qPloneGoogleSitemaps/trunk/utils.py
r53 r54 4 4 import re 5 5 import Products.qPloneGoogleSitemaps.config as config 6 from OFS.ObjectManager import BadRequestException 6 from OFS.ObjectManager import BadRequestException# , AttributeError 7 7 def ping_google(url): 8 8 """Ping sitemap to Google""" … … 25 25 def applyOperations(objects, operations): 26 26 """Parse Operations """ 27 parse = re.compile('(.*?)/(.* ?[^\\\])/(.*|.*?[^\\\])/(.*)')27 parse = re.compile('(.*?)/(.*|.*?[^\\\])/(.*|.*?[^\\\])/(.*)') 28 28 operations=[parse.match(op).groups() for op in operations] 29 29 result={} … … 50 50 51 51 props = getToolByName(self,'portal_properties') 52 URLs = props.googlesitemap_properties.urls 52 try: 53 URLs = props.googlesitemap_properties.urls 54 except AttributeError: 55 URLs = [] 53 56 54 57 add_zope = re.compile('^/')
