Ignore:
Timestamp:
Sep 11, 2012 7:30:25 AM (12 years ago)
Author:
ktarasz
Message:

fix pep8

Location:
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser
Files:
4 edited

Legend:

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

    r3141 r3547  
    3434        if text.lower().strip(): 
    3535            keywords = filter(None, map(lambda x: safe_unicode(x.strip(), enc), 
    36                                          text.lower().strip().split('\n'))) 
     36                              text.lower().strip().split('\n'))) 
    3737        else: 
    3838            return ts.utranslate(domain='quintagroup.seoptimizer', 
     
    8282                             msgid=_(u'number_keywords', 
    8383                                     default=u'Number of keywords at page:\n' 
    84                                               '${result}', 
     84                                     '${result}', 
    8585                                     mapping={'result': '\n'.join(result)}), 
    8686                             context=self.context) 
  • quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/seo_configlet.py

    r3542 r3547  
    3131    exposeDCMetaTags = Bool( 
    3232        title=_("label_exposeDCMetaTags", 
    33                 default='Expose <abbr title="Dublin Core">DC</abbr> ' \ 
     33                default='Expose <abbr title="Dublin Core">DC</abbr> ' 
    3434                'meta tags'), 
    3535        description=_("description_seo_dc_metatags", 
     
    5353        title=_("label_content_type_title", default='Content Types'), 
    5454        description=_("description_seo_content_types", 
    55             default='Select content types that will have SEO properties ' 
    56                 'enabled.'), 
     55                      default='Select content types that will have SEO ' 
     56                      'properties enabled.'), 
    5757        required=False, 
    5858        missing_value=tuple(), 
     
    6464                default='Default custom metatags.'), 
    6565        description=_("help_default_custom_metatags", 
    66                       default='Fill in custom metatag names (one per line) ' \ 
    67                       'which will appear on qseo_properties edit tab. ' \ 
     66                      default='Fill in custom metatag names (one per line) ' 
     67                      'which will appear on qseo_properties edit tab. ' 
    6868                      'Example: "metaname|metacontent" or "metaname".'), 
    6969        required=False) 
     
    7474        title=_("label_custom_script", default=u'Header JavaScript'), 
    7575        description=_("help_custom_script", 
    76                 default=u"This JavaScript code will be included in " 
    77                          "the rendered HTML as entered in the page header."), 
     76                      default=u"This JavaScript code will be included in " 
     77                      "the rendered HTML as entered in the page header."), 
    7878        default=u'', 
    7979        required=False) 
     
    9898                default='External keywords check'), 
    9999        description=_("description_external_keywords_test", 
    100                 default='Make keywords test by opening context url as ' 
    101                     'external resource with urllib2.openurl(). This is ' 
    102                     'useful when xdv/Deliverance transformation is used ' 
    103                     'on the site.'), 
     100                      default='Make keywords test by opening context url as ' 
     101                      'external resource with urllib2.openurl(). This is ' 
     102                      'useful when xdv/Deliverance transformation is used ' 
     103                      'on the site.'), 
    104104        default=False, 
    105105        required=False) 
     
    174174    def _toFormValue(self, value): 
    175175        if value == self.context.missing_value or \ 
    176            value == self.context._type(): 
     176                value == self.context._type(): 
    177177            return self._missing 
    178178        else: 
  • quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/viewlets.py

    r3471 r3547  
    3232        enc = getSiteEncoding(self.context) 
    3333        sfuncd = lambda x, enc=enc: safe_unicode(x, enc) 
    34         return u'\n'.join([TEMPLATE % tuple(map(sfuncd, (k, v))) \ 
     34        return u'\n'.join([TEMPLATE % tuple(map(sfuncd, (k, v))) 
    3535                           for k, v in self.listMetaTags().items()]) 
    3636 
     
    4848        adapter = IMappingMetaTags(self.context, None) 
    4949        mapping_metadata = adapter and adapter.getMappingMetaTags() \ 
    50                            or SortedDict() 
     50            or SortedDict() 
    5151 
    5252        if not use_all: 
     
    9898            # Special cases 
    9999            if accessor == 'Description' and \ 
    100                not 'description' in metadata_names: 
     100                    not 'description' in metadata_names: 
    101101                result['description'] = escape(value) 
    102102            elif accessor == 'Subject' and \ 
    103                  not 'keywords' in metadata_names: 
     103                    not 'keywords' in metadata_names: 
    104104                result['keywords'] = escape(value) 
    105105 
     
    130130            # Filter out DWIMish artifacts on effective / expiration dates 
    131131            if effective is not None and \ 
    132                effective > FLOOR_DATE and \ 
    133                effective != created: 
     132                    effective > FLOOR_DATE and \ 
     133                    effective != created: 
    134134                eff_str = effective.Date() 
    135135            else: 
     
    147147        # for given context and default from configlet 
    148148        custom_meta_tags = seo_context and \ 
    149                            seo_context['seo_customMetaTags'] or [] 
     149            seo_context['seo_customMetaTags'] or [] 
    150150        for tag in custom_meta_tags: 
    151151            if tag['meta_content']: 
     
    165165                                             name=u'plone_context_state') 
    166166        self.seo_context = getMultiAdapter((self.context, self.request), 
    167                                              name=u'seo_context') 
     167                                           name=u'seo_context') 
    168168 
    169169        self.override_title = self.seo_context['has_seo_title'] 
  • quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/views.py

    r3471 r3547  
    1414from quintagroup.canonicalpath.interfaces import ICanonicalLink 
    1515from quintagroup.canonicalpath.adapters import PROPERTY_LINK \ 
    16                                                as CANONICAL_PROPERTY 
     16    as CANONICAL_PROPERTY 
    1717 
    1818from quintagroup.seoptimizer.browser.seo_configlet import ISEOConfigletSchema 
     
    6363                                                    default=''), 
    6464            "seo_noframes": self.getSEOProperty('qSEO_noframes', 
    65                                                     default=''), 
     65                                                default=''), 
    6666            "meta_keywords": self.getSEOProperty('qSEO_keywords', 
    6767                                                 'Subject', ()), 
     
    7171            "has_seo_title": self.context.hasProperty('qSEO_title'), 
    7272            "has_seo_robots": self.context.hasProperty('qSEO_robots'), 
    73             "has_seo_description": \ 
    74                      self.context.hasProperty('qSEO_description'), 
    75             "has_seo_distribution": \ 
    76                      self.context.hasProperty('qSEO_distribution'), 
     73            "has_seo_description": 
     74            self.context.hasProperty('qSEO_description'), 
     75            "has_seo_distribution": 
     76            self.context.hasProperty('qSEO_distribution'), 
    7777            "has_html_comment": self.context.hasProperty('qSEO_html_comment'), 
    7878            "has_noframes": self.context.hasProperty('qSEO_noframes'), 
    7979            "has_seo_keywords": self.context.hasProperty('qSEO_keywords'), 
    8080            "has_seo_canonical": self.context.hasProperty(CANONICAL_PROPERTY), 
    81             } 
     81        } 
    8282        #seotags["seo_nonEmptylocalMetaTags"] = \ 
    8383        #    bool(seotags["seo_localCustomMetaTags"]) 
     
    117117        # Get untouch global, override global in custom 
    118118        # and new custom meta tags 
    119         untouchglob = [t for t in glob \ 
    120                          if t['meta_name'] in list(gnames - lnames)] 
     119        untouchglob = [t for t in glob 
     120                       if t['meta_name'] in list(gnames - lnames)] 
    121121        return untouchglob + loc 
    122122 
     
    141141        for property, value in context.propertyItems(): 
    142142            if property.startswith(property_prefix) and \ 
    143                property[len(property_prefix):]: 
     143                    property[len(property_prefix):]: 
    144144                result.append({'meta_name': property[len(property_prefix):], 
    145145                               'meta_content': value}) 
     
    157157                if name_value[0]: 
    158158                    result.append({'meta_name': name_value[0], 
    159                                    'meta_content': len(name_value) == 2 and \ 
    160                                                     name_value[1] or ''}) 
     159                                   'meta_content': len(name_value) == 2 and 
     160                                   name_value[1] or ''}) 
    161161        return result 
    162162 
     
    212212        state = '' 
    213213        delete_list, seo_overrides_keys, seo_keys = [], [], [] 
    214         seo_items = dict([(k[len(SEO_PREFIX):], v) \ 
    215                          for k, v in kw.items() if k.startswith(SEO_PREFIX)]) 
     214        seo_items = dict([(k[len(SEO_PREFIX):], v) 
     215                          for k, v in kw.items() if k.startswith(SEO_PREFIX)]) 
    216216        for key in seo_items.keys(): 
    217217            if key.endswith(SUFFIX): 
     
    224224            else: 
    225225                if seo_key in seo_overrides_keys and \ 
    226                               seo_items.get(seo_key + SUFFIX): 
     226                        seo_items.get(seo_key + SUFFIX): 
    227227                    seo_value = seo_items[seo_key] 
    228228                    if seo_key == 'canonical': 
     
    234234                    else: 
    235235                        t_value = 'string' 
    236                         if type(seo_value) == type([]) or \ 
    237                            type(seo_value) == type(()): 
     236                        if isinstance(seo_value, list) or \ 
     237                                isinstance(seo_value, tuple): 
    238238                            t_value = 'lines' 
    239239                        state = self.setProperty(PROP_PREFIX + seo_key, 
     
    264264        for property, value in context.propertyItems(): 
    265265            if property.startswith(PROP_CUSTOM_PREFIX) and \ 
    266                                    not property == PROP_CUSTOM_PREFIX: 
     266                    not property == PROP_CUSTOM_PREFIX: 
    267267                delete_list.append(property) 
    268268        if delete_list: 
     
    280280                    globalCustomMetaTags.append( 
    281281                        {'meta_name': name_value[0], 
    282                          'meta_content': len(name_value) > 1 and \ 
    283                                          name_value[1] or ''}) 
     282                         'meta_content': len(name_value) > 1 and 
     283                         name_value[1] or ''}) 
    284284        for tag in custommetatags: 
    285285            meta_name, meta_content = tag['meta_name'], tag['meta_content'] 
    286286            if meta_name: 
    287                 if not [gmt for gmt in globalCustomMetaTags \ 
    288                         if (gmt['meta_name'] == meta_name and \ 
     287                if not [gmt for gmt in globalCustomMetaTags 
     288                        if (gmt['meta_name'] == meta_name and 
    289289                            gmt['meta_content'] == meta_content)]: 
    290290                    self.setProperty('%s%s' % (PROP_CUSTOM_PREFIX, meta_name), 
     
    344344            else: 
    345345                # Cancel 
    346                 msg = _('seoproperties_canceled', default=u'No content SEO ' \ 
     346                msg = _('seoproperties_canceled', default=u'No content SEO ' 
    347347                        'properties have been changed.') 
    348348 
Note: See TracChangeset for help on using the changeset viewer.