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

#160: clarify code, some clean-up

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

Legend:

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

    r1900 r1910  
    4141        """ See interface. 
    4242        """ 
    43         request = self.context.REQUEST 
    4443        meta_keywords = [] 
    45         filtered_keywords = [] 
    46         seo_context = queryMultiAdapter((self.context, request), name='seo_context') 
     44        seo_context = queryMultiAdapter((self.context, self.context.REQUEST), 
     45                                        name='seo_context') 
    4746        if seo_context: 
    4847            meta_keywords = list(seo_context['meta_keywords']) 
     
    7978 
    8079    def canonical_path(self): 
    81         purl = getToolByName(self.context,'portal_url') 
     80        purl = getToolByName(self.context, 'portal_url') 
    8281 
    8382        # Calculate canonical path from qSEO_canonical property 
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/browser/interfaces.py

    r955 r1910  
    1111 
    1212    def validateKeywords(text): 
    13         """ Parse text and validate each keyword (extracted from text) for appearing on the context page """ 
     13        """ Parse text and validate each keyword (extracted from text) 
     14        for appearing on the context page """ 
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/browser/keywords.py

    r1885 r1910  
    3030        url = '%s?without_metatag_keywords=1' % self.context.absolute_url() 
    3131 
    32         # extract words from url page using lynx browser (test page by 'url' randered without metatag keywords) 
     32        # extract words from url page using lynx browser (test page by 'url' 
     33        # randered without metatag keywords) 
    3334        page_text = commands.getoutput('lynx --dump --nolist %s' % url).lower() 
    3435        if page_text and page_text != 'sh: lynx: command not found': 
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/config.py

    r1818 r1910  
    77SHEET_TITLE = 'SEO Properties' 
    88 
    9 STOP_WORDS = ['a', 'an', 'amp', 'and', 'are', 'arial', 'as', 'at', 'be', 'but', 'by', 'can', 'com', 'do', 'font', 
    10               'for', 'from', 'gif', 'had', 'has', 'have', 'he', 'helvetica', 'her', 'his', 'how', 'href', 'i', 
    11               'if', 'in', 'is', 'it', 'javascript', 'jpg', 'made', 'net', 'of', 'on', 'or', 'org', 'our', 'sans', 
    12               'see', 'serif', 'she', 'that', 'the', 'this', 'to', 'us', 'we', 'with', 'you', 'your'] 
     9STOP_WORDS = ['a', 'an', 'amp', 'and', 'are', 'arial', 'as', 'at', 'be', 'but', 
     10    'by', 'can', 'com', 'do', 'font', 'for', 'from', 'gif', 'had', 'has', 
     11    'have', 'he', 'helvetica', 'her', 'his', 'how', 'href', 'i', 'if', 'in', 
     12    'is', 'it', 'javascript', 'jpg', 'made', 'net', 'of', 'on', 'or', 'org', 
     13    'our', 'sans', 'see', 'serif', 'she', 'that', 'the', 'this', 'to', 'us', 
     14    'we', 'with', 'you', 'your'] 
    1315 
    1416DEFAULT_CUSTOM_METATAGS = [] 
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/setuphandlers.py

    r1898 r1910  
    2424    types_tool = getToolByName(site, 'portal_types') 
    2525    for ptype in types_tool.objectValues(): 
    26         idxs = [idx_act[0] for idx_act in enumerate(ptype.listActions()) if idx_act[1].id == 'seo_properties'] 
     26        idxs = [idx_act[0] for idx_act in enumerate(ptype.listActions()) \ 
     27                           if idx_act[1].id == 'seo_properties'] 
    2728        if idxs: 
    2829            ptype.deleteActions(idxs) 
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/upgrades.py

    r1850 r1910  
    1010 
    1111def changeDomain(plone_tools): 
    12     """ Fix i18n_domain bug for some portal_types, which present in earlier versions of the package. 
     12    """ Fix i18n_domain bug for some portal_types, 
     13    which present in earlier versions of the package. 
    1314    """ 
    1415    types_tool = plone_tools.types() 
    15     for ptype in [ptypes for ptypes in types_tool.objectValues() if ptypes.id in FIX_PTYPES_DOMAIN]: 
     16    for ptype in [ptypes for ptypes in types_tool.objectValues() 
     17                         if ptypes.id in FIX_PTYPES_DOMAIN]: 
    1618        if ptype.i18n_domain == 'quintagroup.seoptimizer': 
    1719            ptype.i18n_domain = 'plone' 
    18             logger.log(logging.INFO, "I18n Domain of the type \'%s\' changed to \'plone\'." % ptype.id) 
     20            logger.log(logging.INFO, "I18n Domain of the type \'%s\' " 
     21                       "changed to \'plone\'." % ptype.id) 
    1922 
    2023def changeMetatagsOrderList(plone_tools): 
     
    2831        mto_new = [line.split(' ')[0].strip() for line in mto] 
    2932        if not list(mto) == mto_new: 
    30             logger.log(logging.INFO, "Changed format metatags order list in configlet from \"metaname accessor\" to \"metaname\".") 
     33            logger.log(logging.INFO, "Changed format metatags order list in " 
     34                       "configlet from \"metaname accessor\" to \"metaname\".") 
    3135            seoprops_tool.manage_changeProperties(metatags_order=mto_new) 
    3236    else: 
    33         setup_tool.runImportStepFromProfile('profile-quintagroup.seoptimizer:default', 'propertiestool') 
     37        setup_tool.runImportStepFromProfile('profile-quintagroup.seoptimizer:default', 
     38                                            'propertiestool') 
    3439 
    3540 
    3641def migrationActions(plone_tools): 
    37     """ Migration actions from portal_types action to seoproperties tool (for seoaction in portal_actions). 
     42    """ Migration actions from portal_types action to seoproperties tool 
     43    (for seoaction in portal_actions). 
    3844    """ 
    3945    types_tool = plone_tools.types() 
     
    4248    flag = False 
    4349    for ptype in types_tool.objectValues(): 
    44         idxs = [idx_act[0] for idx_act in enumerate(ptype.listActions()) if idx_act[1].id == 'seo_properties'] 
     50        idxs = [idx_act[0] for idx_act in enumerate(ptype.listActions()) 
     51                           if idx_act[1].id == 'seo_properties'] 
    4552        if idxs: 
    4653            if ptype.id not in ctws: 
     
    4855                flag = True 
    4956            ptype.deleteActions(idxs) 
    50             logger.log(logging.INFO, "Moved \"SEO Properties\" action from %s type in portal actions." % ptype.id) 
     57            logger.log(logging.INFO, "Moved \"SEO Properties\" action from %s " 
     58                       "type in portal actions." % ptype.id) 
    5159    if flag: 
    5260        seoprops_tool.manage_changeProperties(content_types_with_seoproperties=ctws) 
  • quintagroup.seoptimizer/branches/refactoring2.3.0/quintagroup/seoptimizer/util.py

    r1673 r1910  
    66    from Globals import InitializeClass 
    77 
    8 def createMultiColumnList(self,slist, numCols, sort_on='title_or_id'): 
    9     try: 
    10         mcl = self.createMultiColumnList(slist, numCols, sort_on=sort_on) 
    11         return mcl 
    12     except AttributeError: 
    13         return [slist] 
    148 
    159class SortedDict(dict): 
Note: See TracChangeset for help on using the changeset viewer.