Changeset 1462 in products for quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/views.py
- Timestamp:
- Dec 18, 2009 2:06:24 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/views.py
r1461 r1462 310 310 """ 311 311 return condition and first or second 312 313 def setProperty(self, property, value, type='string'): 314 context = aq_inner(self.context) 315 if context.hasProperty(property): 316 context.manage_changeProperties({property: value}) 317 else: 318 context.manage_addProperty(property, value, type) 312 319 313 320 def manageSEOProps(self, **kw): … … 328 335 if delete_list: context.manage_delProperties(delete_list) 329 336 330 def delSEOCustomMetaTags(self): 337 def setSEOCustomMetaTags(self, custommetatags): 338 context = aq_inner(self.context) 339 for k, v in custommetatags.items(): 340 self.setProperty('%s%s' % (PROP_CUSTOM_PREFIX, meta_name), meta_content) 341 342 def delAllSEOCustomMetaTagsByNames(self): 331 343 context = self.context 332 344 delete_list = [] … … 336 348 if delete_list: context.manage_delProperties(delete_list) 337 349 338 def delSEOCustomMetaTag (self, custommetatag):350 def delSEOCustomMetaTagByName(self, custommetatagname): 339 351 context = self.context 340 if context.hasProperty(custommetatag): 341 context.manage_delProperties(custommetatag) 342 343 def manageSEOCustomMetaTags(self, **kw): 344 context = aq_inner(self.context) 345 if kw.has_key('seo_custommetatags_override'): 346 if kw.get('seo_custommetatags_override'): 347 custommetatags = kw.get('seo_custommetatags', {}) 348 self.updateSEOCustomMetaTags(custommetatags) 349 else: 350 self.delSEOCustomMetaTags() 351 elif kw.get('seo_custommetatags'): 352 self.delSEOCustomMetaTags() 352 seo_custom_prop = PROP_CUSTOM_PREFIX + custommetatagname 353 if context.hasProperty(seo_custom_prop): 354 context.manage_delProperties([seo_custom__prop]) 353 355 354 356 def updateSEOCustomMetaTags(self, custommetatags): … … 366 368 367 369 for tag in custommetatags: 370 metalist = [] 368 371 meta_name, meta_content = tag['meta_name'], tag['meta_content'] 369 372 if meta_name: 370 373 if not [gmt for gmt in globalCustomMetaTags if (gmt['meta_name']==meta_name and gmt['meta_content']==meta_content)]: 371 self.setProperty('%s%s' % (PROP_CUSTOM_PREFIX, meta_name), meta_content) 372 373 def setSEOCustomMetaTags(self, custommetatags=None): 374 context = aq_inner(self.context) 375 if custommetatags is not None: 376 if len(custommetatags): 377 self.delSEOCustomMetaTags() 374 metalist.append(tag) 375 self.setSEOCustomMetaTags(metalist) 376 377 def manageSEOCustomMetaTags(self, **kw): 378 context = aq_inner(self.context) 379 if kw.has_key('seo_custommetatags_override'): 380 if kw.get('seo_custommetatags_override'): 381 custommetatags = kw.get('seo_custommetatags', {}) 382 self.updateSEOCustomMetaTags(custommetatags) 378 383 else: 379 for k, v in custommetatags.items(): 380 self.setProperty('%s%s' % (PROP_CUSTOM_PREFIX, meta_name), meta_content) 381 382 def setProperty(self, property, value, type='string'): 383 context = aq_inner(self.context) 384 if context.hasProperty(property): 385 context.manage_changeProperties({property: value}) 386 else: 387 context.manage_addProperty(property, value, type) 384 self.delAllSEOCustomMetaTagsByNames() 385 elif kw.get('seo_custommetatags'): 386 self.delAllSEOCustomMetaTagsByNames() 388 387 389 388 def __call__( self ):
Note: See TracChangeset
for help on using the changeset viewer.