Changeset 1506 in products


Ignore:
Timestamp:
Jan 4, 2010 3:54:02 PM (14 years ago)
Author:
liebster
Message:

Added doc strings for methods

File:
1 edited

Legend:

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

    r1480 r1506  
    2525 
    2626class SEOContext( BrowserView ): 
    27     """ 
     27    """ This class contains methods that allows to edit html header meta tags. 
    2828    """ 
    2929    def getSEOProperty( self, property_name, accessor='' ): 
    30         """ 
     30        """ Get value from seo property by property name. 
    3131        """ 
    3232        context = aq_inner(self.context) 
     
    4949 
    5050    def seo_title( self ): 
    51         """ 
     51        """ Generate SEO Title from SEO properties. 
    5252        """ 
    5353        return self.getSEOProperty( 'qSEO_title', accessor='Title' ) 
    5454 
    5555    def seo_robots( self ): 
    56         """ 
     56        """ Generate SEO Robots from SEO properties. 
    5757        """ 
    5858        robots = self.getSEOProperty( 'qSEO_robots' ) 
     
    6060 
    6161    def seo_description( self ): 
    62         """ 
    63             Generate Description from SEO properties  
     62        """ Generate Description from SEO properties. 
    6463        """ 
    6564 
     
    6766 
    6867    def seo_distribution( self ): 
    69         """ 
    70            Generate Description from SEO properties 
     68        """ Generate Distribution from SEO properties. 
    7169        """ 
    7270        dist = self.getSEOProperty( 'qSEO_distribution' ) 
     
    7573 
    7674    def seo_customMetaTags( self ): 
    77         """ 
     75        """        Returned seo custom metatags from default_custom_metatags property in seo_properties 
     76        (global seo custom metatags) with update from seo custom metatags properties in context (local seo custom metatags). 
    7877        """ 
    7978        tags = self.seo_globalCustomMetaTags() 
     
    9291 
    9392    def seo_globalWithoutLocalCustomMetaTags( self ): 
    94         """ 
     93        """        Returned seo custom metatags from default_custom_metatags property in seo_properties 
     94        (global seo custom metatags) without seo custom metatags from properties in context (local seo custom metatags). 
    9595        """ 
    9696        glob = self.seo_globalCustomMetaTags() 
     
    104104 
    105105    def seo_localCustomMetaTags( self ): 
    106         """ 
     106        """ Returned seo custom metatags from properties in context (local seo custom metatags). 
    107107        """ 
    108108        result = [] 
     
    116116 
    117117    def seo_globalCustomMetaTags( self ): 
    118         """ 
     118        """ Returned seo custom metatags from default_custom_metatags property in seo_properties. 
    119119        """ 
    120120        result = [] 
     
    136136 
    137137    def seo_html_comment( self ): 
    138         """ 
     138        """ Generate HTML Comments from SEO properties. 
    139139        """ 
    140140        html_comment = self.getSEOProperty( 'qSEO_html_comment' ) 
     
    142142 
    143143    def seo_keywords( self ): 
    144         """ 
    145            Generate Keywords from SEO properties 
    146         """ 
    147  
     144        """ Generate Keywords from SEO properties. 
     145        """ 
    148146        prop_name = 'qSEO_keywords' 
    149147        add_keywords = 'additional_keywords' 
     
    176174 
    177175    def seo_canonical( self ): 
    178         """ 
    179            Get canonical URL 
     176        """ Generate canonical URL from SEO properties. 
    180177        """ 
    181178        canonical = self.getSEOProperty( 'qSEO_canonical' ) 
     
    192189 
    193190class SEOControlPanel( ControlPanelView ): 
    194     """ 
     191    """ The class with methods configuration Search Engine Optimizer in configlet. 
    195192    """ 
    196193    template = ViewPageTemplateFile('templates/seo_controlpanel.pt') 
     
    205202    @property 
    206203    def portal_types( self ): 
    207         """ 
     204        """ Returned a list of portal types. 
    208205        """ 
    209206        context = aq_inner(self.context) 
     
    221218 
    222219    def getExposeDCMetaTags( self ): 
    223         """ 
     220        """ Get value from exposeDCMetaTags property in seo_properties. 
    224221        """ 
    225222        sp = self.portal_properties.site_properties 
     
    227224 
    228225    def getDefaultCustomMetatags( self ): 
    229         """ 
     226        """ Get values from default_custom_metatags property in seo_properties. 
    230227        """ 
    231228        seo = self.portal_properties.seo_properties 
     
    233230 
    234231    def getMetaTagsOrder( self ): 
    235         """ 
     232        """ Get values from metatags_order property in seo_properties. 
    236233        """ 
    237234        seo = self.portal_properties.seo_properties 
     
    239236 
    240237    def getAdditionalKeywords( self ): 
    241         """ 
     238        """ Get values from additional_keywords property in seo_properties. 
    242239        """ 
    243240        seo = self.portal_properties.seo_properties 
     
    255252 
    256253    def __call__( self ): 
    257         """ 
     254        """ Perform the update and redirect if necessary, or render the page. 
    258255        """ 
    259256        context = aq_inner(self.context) 
     
    300297 
    301298    def typeInfo( self, type_name ): 
    302         """ 
     299        """ Get info type by type name. 
    303300        """ 
    304301        return self.portal_types.getTypeInfo( type_name ) 
     
    306303 
    307304class SEOContextPropertiesView( BrowserView ): 
    308     """ 
     305    """ This class contains methods that allows to manage seo properties. 
    309306    """ 
    310307    template = ViewPageTemplateFile('templates/seo_context_properties.pt') 
     
    316313 
    317314    def getMainDomain(self, url): 
     315        """ Get a main domain. 
     316        """ 
    318317        url = url.split('//')[-1] 
    319318        dompath = url.split(':')[0] 
     
    322321 
    323322    def validateSEOProperty(self, property, value): 
     323        """ Validate a seo property. 
     324        """ 
    324325        purl = getToolByName(self.context, 'portal_url')() 
    325326        state = '' 
    326327        if property == PROP_PREFIX+'canonical': 
     328            # validate seo canonical url property 
    327329            pdomain = self.getMainDomain(purl) 
    328330            if not pdomain == self.getMainDomain(value): 
     
    331333 
    332334    def setProperty(self, property, value, type='string'): 
     335        """ Add a new property. 
     336 
     337        Sets a new property with the given id, value and type or changes it. 
     338        """ 
    333339        context = aq_inner(self.context) 
    334340        state = self.validateSEOProperty(property, value) 
     
    341347 
    342348    def manageSEOProps(self, **kw): 
     349        """ Manage seo properties. 
     350        """ 
    343351        context = aq_inner(self.context) 
    344352        state = '' 
     
    368376 
    369377    def setSEOCustomMetaTags(self, custommetatags): 
     378        """ Set seo custom metatags properties. 
     379        """ 
    370380        context = aq_inner(self.context) 
    371381        for tag in custommetatags: 
     
    373383 
    374384    def delAllSEOCustomMetaTagsProperties(self): 
     385        """ Delete all seo custom metatags properties. 
     386        """ 
    375387        context = aq_inner(self.context) 
    376388        delete_list = [] 
     
    382394 
    383395    def updateSEOCustomMetaTagsProperties(self, custommetatags): 
     396        """ Update seo custom metatags properties. 
     397        """ 
    384398        context = aq_inner(self.context) 
    385399        site_properties = getToolByName(context, 'portal_properties') 
     
    399413 
    400414    def manageSEOCustomMetaTagsProperties(self, **kw): 
     415        """ Update seo custom metatags properties, if enabled checkbox override or delete properties. 
     416 
     417        Change object properties by passing either a mapping object 
     418        of name:value pairs {'foo':6} or passing name=value parameters. 
     419        """ 
    401420        context = aq_inner(self.context) 
    402421        self.delAllSEOCustomMetaTagsProperties() 
     
    406425 
    407426    def __call__( self ): 
    408         """ 
     427        """ Perform the update seo properties and redirect if necessary, or render the page Call method. 
    409428        """ 
    410429        context = aq_inner(self.context) 
Note: See TracChangeset for help on using the changeset viewer.