Changeset 988 in products for qSEOptimizer/trunk/adapters.py
- Timestamp:
- Oct 1, 2007 2:52:49 PM (17 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
qSEOptimizer/trunk/adapters.py
r987 r988 1 import re, commands 1 2 from zope.interface import implements 2 3 from Products.CMFCore.utils import getToolByName … … 13 14 portal_props = getToolByName(self.context, 'portal_properties') 14 15 seo_props = getToolByName(portal_props, 'seo_properties') 15 original = set(self.context.qSEO_Keywords()) 16 additional = set(seo_props.additional_keywords) 17 text = set(self.context.SearchableText().split()) 18 keywords = list(additional.intersection(text).union(original)) 16 17 # now set type is not using because of it unordered behaviour 18 #original = set(self.context.qSEO_Keywords()) 19 #additional = set(seo_props.additional_keywords) 20 #text = set(self.context.SearchableText().split()) 21 #keywords = list(additional.intersection(text).union(original)) 22 23 keywords = list(self.context.qSEO_Keywords()) 24 lower_keywords = map(lambda x: x.lower(), keywords) 25 additional = seo_props.additional_keywords 26 27 is_test = self.context.REQUEST.get('qseo_without_additional_keywords', None) 28 29 if additional and is_test is None: 30 # extract words from url page using lynx browser 31 text = commands.getoutput('lynx --dump --nolist %s?qseo_without_additional_keywords=1' % self.context.absolute_url()).lower() 32 if text and text != 'sh: lynx: command not found': 33 for keyword in additional: 34 if keyword.lower() not in lower_keywords and re.compile(r'\b%s\b' % keyword, re.I).search(text): 35 keywords.append(keyword) 36 19 37 return ', '.join(keywords)
Note: See TracChangeset
for help on using the changeset viewer.