Changeset 1855 in products


Ignore:
Timestamp:
Mar 5, 2010 4:15:24 PM (14 years ago)
Author:
mylan
Message:

#156: Refuse from stright depending from IPropertyManager interface and leave only ITraversable one, update adapter registration

Location:
quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/adapters.py

    r1816 r1855  
    66 
    77from Acquisition import aq_inner 
     8from OFS.interfaces import IPropertyManager 
    89from Products.CMFCore.utils import getToolByName 
    910 
     
    7576 
    7677    def __init__(self, context): 
    77         self.context = context 
     78        self.context = aq_inner(context) 
    7879 
    7980    def canonical_path(self): 
     
    8182 
    8283        # Calculate canonical path from qSEO_canonical property 
    83         prop = aq_inner(self.context).getProperty('qSEO_canonical', None) 
    84         if prop is not None: 
    85             return prop[len(purl()):] 
    86          
     84        if IPropertyManager.providedBy(self.context): 
     85            prop = self.context.getProperty('qSEO_canonical', None) 
     86            if prop is not None: 
     87                return prop[len(purl()):] 
     88 
    8789        # Fallback for canonical path calculation 
    8890        return '/'+'/'.join(purl.getRelativeContentPath(self.context)) 
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/adapters.zcml

    r1853 r1855  
    1515      /> 
    1616 
    17   <!-- really adapter depends on both interfaces 
    18        *IPropertyManager* AND *ITreversable* 
    19        Actually only IFolder directly implements 
    20        both, but IItem not. 
    21   --> 
    22   <adapter 
    23       for="OFS.interfaces.IFolder" 
    24       provides=".interfaces.ISEOCanonicalPath" 
    25       factory=".adapters.canonicalPathAdapter" 
    26       /> 
    2717 
    2818  <adapter 
    29       for="OFS.interfaces.IItem" 
     19      for="OFS.interfaces.ITraversable" 
    3020      provides=".interfaces.ISEOCanonicalPath" 
    3121      factory=".adapters.canonicalPathAdapter" 
Note: See TracChangeset for help on using the changeset viewer.