13
13
14
14
from quintagroup .canonicalpath .interfaces import ICanonicalLink
15
15
from quintagroup .canonicalpath .adapters import PROPERTY_LINK \
16
- as CANONICAL_PROPERTY
16
+ as CANONICAL_PROPERTY
17
17
18
18
from quintagroup .seoptimizer .browser .seo_configlet import ISEOConfigletSchema
19
19
from quintagroup .seoptimizer import SeoptimizerMessageFactory as _
@@ -62,23 +62,23 @@ def _getSEOTags(self):
62
62
"seo_html_comment" : self .getSEOProperty ('qSEO_html_comment' ,
63
63
default = '' ),
64
64
"seo_noframes" : self .getSEOProperty ('qSEO_noframes' ,
65
- default = '' ),
65
+ default = '' ),
66
66
"meta_keywords" : self .getSEOProperty ('qSEO_keywords' ,
67
67
'Subject' , ()),
68
68
"seo_keywords" : self .getSEOProperty ('qSEO_keywords' , default = ()),
69
69
"seo_canonical" : self .getSEOProperty (CANONICAL_PROPERTY ),
70
70
# Add test properties
71
71
"has_seo_title" : self .context .hasProperty ('qSEO_title' ),
72
72
"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' ),
77
77
"has_html_comment" : self .context .hasProperty ('qSEO_html_comment' ),
78
78
"has_noframes" : self .context .hasProperty ('qSEO_noframes' ),
79
79
"has_seo_keywords" : self .context .hasProperty ('qSEO_keywords' ),
80
80
"has_seo_canonical" : self .context .hasProperty (CANONICAL_PROPERTY ),
81
- }
81
+ }
82
82
#seotags["seo_nonEmptylocalMetaTags"] = \
83
83
# bool(seotags["seo_localCustomMetaTags"])
84
84
return seotags
@@ -116,8 +116,8 @@ def seo_customMetaTags(self):
116
116
lnames = set (map (lambda x : x ['meta_name' ], loc ))
117
117
# Get untouch global, override global in custom
118
118
# 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 )]
121
121
return untouchglob + loc
122
122
123
123
def seo_globalWithoutLocalCustomMetaTags (self ):
@@ -140,7 +140,7 @@ def seo_localCustomMetaTags(self):
140
140
context = aq_inner (self .context )
141
141
for property , value in context .propertyItems ():
142
142
if property .startswith (property_prefix ) and \
143
- property [len (property_prefix ):]:
143
+ property [len (property_prefix ):]:
144
144
result .append ({'meta_name' : property [len (property_prefix ):],
145
145
'meta_content' : value })
146
146
return result
@@ -156,8 +156,8 @@ def seo_globalCustomMetaTags(self):
156
156
name_value = tag .split (SEPERATOR )
157
157
if name_value [0 ]:
158
158
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 '' })
161
161
return result
162
162
163
163
# Not used
@@ -211,8 +211,8 @@ def manageSEOProps(self, **kw):
211
211
context = aq_inner (self .context )
212
212
state = ''
213
213
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 )])
216
216
for key in seo_items .keys ():
217
217
if key .endswith (SUFFIX ):
218
218
seo_overrides_keys .append (key [:- len (SUFFIX )])
@@ -223,7 +223,7 @@ def manageSEOProps(self, **kw):
223
223
self .manageSEOCustomMetaTagsProperties (** kw )
224
224
else :
225
225
if seo_key in seo_overrides_keys and \
226
- seo_items .get (seo_key + SUFFIX ):
226
+ seo_items .get (seo_key + SUFFIX ):
227
227
seo_value = seo_items [seo_key ]
228
228
if seo_key == 'canonical' :
229
229
try :
@@ -233,8 +233,8 @@ def manageSEOProps(self, **kw):
233
233
state = "'%s' - wrong canonical url" % str (e )
234
234
else :
235
235
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 ):
238
238
t_value = 'lines'
239
239
state = self .setProperty (PROP_PREFIX + seo_key ,
240
240
seo_value , type = t_value )
@@ -263,7 +263,7 @@ def delAllSEOCustomMetaTagsProperties(self):
263
263
delete_list = []
264
264
for property , value in context .propertyItems ():
265
265
if property .startswith (PROP_CUSTOM_PREFIX ) and \
266
- not property == PROP_CUSTOM_PREFIX :
266
+ not property == PROP_CUSTOM_PREFIX :
267
267
delete_list .append (property )
268
268
if delete_list :
269
269
context .manage_delProperties (delete_list )
@@ -279,13 +279,13 @@ def updateSEOCustomMetaTagsProperties(self, custommetatags):
279
279
if name_value [0 ]:
280
280
globalCustomMetaTags .append (
281
281
{'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 '' })
284
284
for tag in custommetatags :
285
285
meta_name , meta_content = tag ['meta_name' ], tag ['meta_content' ]
286
286
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
289
289
gmt ['meta_content' ] == meta_content )]:
290
290
self .setProperty ('%s%s' % (PROP_CUSTOM_PREFIX , meta_name ),
291
291
meta_content )
@@ -343,7 +343,7 @@ def __call__(self):
343
343
msgtype = "error"
344
344
else :
345
345
# Cancel
346
- msg = _ ('seoproperties_canceled' , default = u'No content SEO ' \
346
+ msg = _ ('seoproperties_canceled' , default = u'No content SEO '
347
347
'properties have been changed.' )
348
348
349
349
context .plone_utils .addPortalMessage (msg , msgtype )
0 commit comments