Changeset 1726 in products
- Timestamp:
- Feb 12, 2010 1:06:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/browser/utils.py
r1593 r1726 1 1 import re 2 from zope.component import queryAdapter 2 3 3 4 from DateTime import DateTime 5 from Missing import MV as Missing_Value 6 from Products.CMFCore.utils import getToolByName 4 7 5 from Products.CMFCore.utils import getToolByName8 from quintagroup.canonicalpath.interfaces import ICanonicalPath 6 9 import quintagroup.plonegooglesitemaps.config as config 7 10 … … 9 12 ADD_PLONE = re.compile('^[^http://|https://|\\\]') 10 13 OPERATIONS_PARSE = re.compile(r"(.?[^\\])/(.*[^\\]|)/(.*[^\\]|)/") 14 _marker = [] 11 15 12 16 def searchAndReplace(string, what, with): … … 21 25 result = {} 22 26 for ob in objects: 27 url = _marker 23 28 if ob.has_key('canonical_path'): 24 29 url = ob.canonical_path 25 else: 26 url = '/'+'/'.join(ob.getPath().split('/')[2:]) 30 if url in [Missing_Value, _marker]: 31 cpath = queryAdapter(ob.getObject(), ICanonicalPath) 32 url = cpath.canonical_path() 27 33 for operator, what, with in operations: 28 34 url = OPERATORS[operator](url, what, with.replace("\\", ""))
Note: See TracChangeset
for help on using the changeset viewer.