src/pyams_skin/metas.py
changeset 368 e1c1c57c2d4c
parent 367 a211d8c17334
child 446 6a8890f9c810
equal deleted inserted replaced
367:a211d8c17334 368:e1c1c57c2d4c
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
    10 # FOR A PARTICULAR PURPOSE.
    10 # FOR A PARTICULAR PURPOSE.
    11 #
    11 #
    12 from pyams_i18n.interfaces import II18n
    12 from pyams_i18n.interfaces import II18n
       
    13 from pyams_skin.interfaces.configuration import IConfiguration
       
    14 from pyams_utils.interfaces.site import ISiteRoot
    13 
    15 
    14 __docformat__ = 'restructuredtext'
    16 __docformat__ = 'restructuredtext'
    15 
    17 
    16 
    18 
    17 # import standard library
    19 # import standard library
   159     def get_metas(self):
   161     def get_metas(self):
   160         title = II18n(self.context).query_attribute('title', request=self.request)
   162         title = II18n(self.context).query_attribute('title', request=self.request)
   161         yield HTMLTagMeta('title', title)
   163         yield HTMLTagMeta('title', title)
   162 
   164 
   163 
   165 
       
   166 @adapter_config(name='title', context=(ISiteRoot, Interface, Interface), provides=IHTMLContentMetas)
       
   167 class SiteRootTitleMetasAdapter(ContextRequestViewAdapter):
       
   168     """Site root title metas adapter"""
       
   169 
       
   170     order = 1
       
   171 
       
   172     def get_metas(self):
       
   173         config = IConfiguration(self.context)
       
   174         yield HTMLTagMeta('title', config.title)
       
   175 
       
   176 
   164 @adapter_config(name='content-type', context=(Interface, Interface, Interface), provides=IHTMLContentMetas)
   177 @adapter_config(name='content-type', context=(Interface, Interface, Interface), provides=IHTMLContentMetas)
   165 class ContentTypeMetasAdapter(ContextRequestViewAdapter):
   178 class ContentTypeMetasAdapter(ContextRequestViewAdapter):
   166     """Content-type metas adapter"""
   179     """Content-type metas adapter"""
   167 
   180 
   168     order = 10
   181     order = 10