Changeset 979

Show
Ignore:
Timestamp:
09/22/07 01:43:09
Author:
deo
Message:

Set additional keywords: use both the keywords from the content and all matching keywords.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qSEOptimizer/branches/additional-keywords/__init__.py

    r954 r979  
    55from util import SortedDict 
    66from os import path 
    7 import config 
    87 
     8from Products.qSEOptimizer import config 
     9from Products.qSEOptimizer.interfaces import IKeywords 
    910 
    1011allow_module('Products.qSEOptimizer.util') 
    1112qSEO_globals = globals() 
    1213registerDirectory('skins', qSEO_globals) 
    13  
    1414 
    1515try: 
     
    3737        if exposeDCMetaTags: 
    3838            metadataList.append(('qSEO_Distribution', 'DC.distribution')) 
     39 
    3940        for accessor, key in metadataList: 
    4041            method = getattr(context, accessor, None) 
     
    4950 
    5051            if not value: 
    51                 # no data 
    5252                continue 
    53             if ( type(value) == tuple ) or ( type(value) == list ): 
    54                 # convert a list to a string 
     53            if isinstance(value, (tuple, list)): 
    5554                value = ', '.join(value) 
     55 
    5656            metaTags[key] = value 
     57 
     58        # Set the additional matching keywords, if any 
     59        adapter = IKeywords(context, None) 
     60        if adapter is not None: 
     61            keywords = adapter.listKeywords() 
     62            if keywords: 
     63                metaTags['keywords'] = keywords 
    5764 
    5865        return metaTags