Changeset 1506 in products
- Timestamp:
- Jan 4, 2010 3:54:02 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.seoptimizer/trunk/quintagroup/seoptimizer/browser/views.py
r1480 r1506 25 25 26 26 class SEOContext( BrowserView ): 27 """ 27 """ This class contains methods that allows to edit html header meta tags. 28 28 """ 29 29 def getSEOProperty( self, property_name, accessor='' ): 30 """ 30 """ Get value from seo property by property name. 31 31 """ 32 32 context = aq_inner(self.context) … … 49 49 50 50 def seo_title( self ): 51 """ 51 """ Generate SEO Title from SEO properties. 52 52 """ 53 53 return self.getSEOProperty( 'qSEO_title', accessor='Title' ) 54 54 55 55 def seo_robots( self ): 56 """ 56 """ Generate SEO Robots from SEO properties. 57 57 """ 58 58 robots = self.getSEOProperty( 'qSEO_robots' ) … … 60 60 61 61 def seo_description( self ): 62 """ 63 Generate Description from SEO properties 62 """ Generate Description from SEO properties. 64 63 """ 65 64 … … 67 66 68 67 def seo_distribution( self ): 69 """ 70 Generate Description from SEO properties 68 """ Generate Distribution from SEO properties. 71 69 """ 72 70 dist = self.getSEOProperty( 'qSEO_distribution' ) … … 75 73 76 74 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). 78 77 """ 79 78 tags = self.seo_globalCustomMetaTags() … … 92 91 93 92 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). 95 95 """ 96 96 glob = self.seo_globalCustomMetaTags() … … 104 104 105 105 def seo_localCustomMetaTags( self ): 106 """ 106 """ Returned seo custom metatags from properties in context (local seo custom metatags). 107 107 """ 108 108 result = [] … … 116 116 117 117 def seo_globalCustomMetaTags( self ): 118 """ 118 """ Returned seo custom metatags from default_custom_metatags property in seo_properties. 119 119 """ 120 120 result = [] … … 136 136 137 137 def seo_html_comment( self ): 138 """ 138 """ Generate HTML Comments from SEO properties. 139 139 """ 140 140 html_comment = self.getSEOProperty( 'qSEO_html_comment' ) … … 142 142 143 143 def seo_keywords( self ): 144 """ 145 Generate Keywords from SEO properties 146 """ 147 144 """ Generate Keywords from SEO properties. 145 """ 148 146 prop_name = 'qSEO_keywords' 149 147 add_keywords = 'additional_keywords' … … 176 174 177 175 def seo_canonical( self ): 178 """ 179 Get canonical URL 176 """ Generate canonical URL from SEO properties. 180 177 """ 181 178 canonical = self.getSEOProperty( 'qSEO_canonical' ) … … 192 189 193 190 class SEOControlPanel( ControlPanelView ): 194 """ 191 """ The class with methods configuration Search Engine Optimizer in configlet. 195 192 """ 196 193 template = ViewPageTemplateFile('templates/seo_controlpanel.pt') … … 205 202 @property 206 203 def portal_types( self ): 207 """ 204 """ Returned a list of portal types. 208 205 """ 209 206 context = aq_inner(self.context) … … 221 218 222 219 def getExposeDCMetaTags( self ): 223 """ 220 """ Get value from exposeDCMetaTags property in seo_properties. 224 221 """ 225 222 sp = self.portal_properties.site_properties … … 227 224 228 225 def getDefaultCustomMetatags( self ): 229 """ 226 """ Get values from default_custom_metatags property in seo_properties. 230 227 """ 231 228 seo = self.portal_properties.seo_properties … … 233 230 234 231 def getMetaTagsOrder( self ): 235 """ 232 """ Get values from metatags_order property in seo_properties. 236 233 """ 237 234 seo = self.portal_properties.seo_properties … … 239 236 240 237 def getAdditionalKeywords( self ): 241 """ 238 """ Get values from additional_keywords property in seo_properties. 242 239 """ 243 240 seo = self.portal_properties.seo_properties … … 255 252 256 253 def __call__( self ): 257 """ 254 """ Perform the update and redirect if necessary, or render the page. 258 255 """ 259 256 context = aq_inner(self.context) … … 300 297 301 298 def typeInfo( self, type_name ): 302 """ 299 """ Get info type by type name. 303 300 """ 304 301 return self.portal_types.getTypeInfo( type_name ) … … 306 303 307 304 class SEOContextPropertiesView( BrowserView ): 308 """ 305 """ This class contains methods that allows to manage seo properties. 309 306 """ 310 307 template = ViewPageTemplateFile('templates/seo_context_properties.pt') … … 316 313 317 314 def getMainDomain(self, url): 315 """ Get a main domain. 316 """ 318 317 url = url.split('//')[-1] 319 318 dompath = url.split(':')[0] … … 322 321 323 322 def validateSEOProperty(self, property, value): 323 """ Validate a seo property. 324 """ 324 325 purl = getToolByName(self.context, 'portal_url')() 325 326 state = '' 326 327 if property == PROP_PREFIX+'canonical': 328 # validate seo canonical url property 327 329 pdomain = self.getMainDomain(purl) 328 330 if not pdomain == self.getMainDomain(value): … … 331 333 332 334 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 """ 333 339 context = aq_inner(self.context) 334 340 state = self.validateSEOProperty(property, value) … … 341 347 342 348 def manageSEOProps(self, **kw): 349 """ Manage seo properties. 350 """ 343 351 context = aq_inner(self.context) 344 352 state = '' … … 368 376 369 377 def setSEOCustomMetaTags(self, custommetatags): 378 """ Set seo custom metatags properties. 379 """ 370 380 context = aq_inner(self.context) 371 381 for tag in custommetatags: … … 373 383 374 384 def delAllSEOCustomMetaTagsProperties(self): 385 """ Delete all seo custom metatags properties. 386 """ 375 387 context = aq_inner(self.context) 376 388 delete_list = [] … … 382 394 383 395 def updateSEOCustomMetaTagsProperties(self, custommetatags): 396 """ Update seo custom metatags properties. 397 """ 384 398 context = aq_inner(self.context) 385 399 site_properties = getToolByName(context, 'portal_properties') … … 399 413 400 414 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 """ 401 420 context = aq_inner(self.context) 402 421 self.delAllSEOCustomMetaTagsProperties() … … 406 425 407 426 def __call__( self ): 408 """ 427 """ Perform the update seo properties and redirect if necessary, or render the page Call method. 409 428 """ 410 429 context = aq_inner(self.context)
Note: See TracChangeset
for help on using the changeset viewer.