Ignore:
Timestamp:
Feb 9, 2010 12:59:27 PM (14 years ago)
Author:
mylan
Message:

Added ICanonicalPath adapter and appropriate tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/views.py

    r1647 r1671  
    1111 
    1212from quintagroup.seoptimizer import SeoptimizerMessageFactory as _ 
     13from quintagroup.seoptimizer import interfaces 
    1314 
    1415SEPERATOR = '|' 
    15 HAS_CANONICAL_PATH = True 
    1616SEO_PREFIX = 'seo_' 
    1717PROP_PREFIX = 'qSEO_' 
    1818SUFFIX = '_override' 
    1919PROP_CUSTOM_PREFIX = 'qSEO_custom_' 
    20  
    21 try: 
    22     from quintagroup.canonicalpath.interfaces import ICanonicalPath 
    23 except ImportError: 
    24     HAS_CANONICAL_PATH = False 
    2520 
    2621class SEOContext( BrowserView ): 
     
    213208        """ Generate canonical URL from SEO properties. 
    214209        """ 
    215         canonical = self.getSEOProperty( 'qSEO_canonical' ) 
    216  
    217         if not canonical and HAS_CANONICAL_PATH: 
    218             canpath = queryAdapter(self.context, ICanonicalPath) 
    219             if canpath: 
    220                 purl = getToolByName(self.context, 'portal_url')() 
    221                 cpath = canpath.canonical_path() 
    222                 canonical = purl + cpath 
    223  
    224         return canonical and canonical or self.context.absolute_url() 
     210        purl = getToolByName(self.context, 'portal_url')() 
     211        canpath = queryAdapter(self.context, interfaces.ICanonicalPath, 
     212            name='qseo_canonical') 
     213        return purl + canpath.canonical_path() 
    225214 
    226215 
Note: See TracChangeset for help on using the changeset viewer.