Logo Search packages:      
Sourcecode: zine version File versions  Download package

def zine::application::Zine::get_page_metadata (   self  ) 

Return the metadata as HTML part for templates.  This is normally
called by the layout template to get the metadata for the head section.

Definition at line 1082 of file application.py.

01082                                :
        """Return the metadata as HTML part for templates.  This is normally
        called by the layout template to get the metadata for the head section.
        """
        from zine.utils import dump_json
        generators = {'script': htmlhelpers.script, 'meta': htmlhelpers.meta,
                      'link': htmlhelpers.link, 'snippet': lambda html: html}
        result = [
            htmlhelpers.meta(name='generator', content='Zine'),
            htmlhelpers.link('EditURI', url_for('blog/service_rsd'),
                             type='application/rsd+xml', title='RSD'),
            htmlhelpers.script(url_for('core/shared', filename='js/jQuery.js')),
            htmlhelpers.script(url_for('core/shared', filename='js/Zine.js')),
            htmlhelpers.script(url_for('blog/serve_translations'))
        ]

        # the url information.  Only expose the admin url for admin users
        # or calls to this method without a request.
        base_url = self.cfg['blog_url'].rstrip('/')
        request = get_request()
        javascript = [
            'Zine.ROOT_URL = %s' % dump_json(base_url),
            'Zine.BLOG_URL = %s' % dump_json(base_url + self.cfg['blog_url_prefix'])
        ]
        if request is None or request.user.is_manager:
            javascript.append('Zine.ADMIN_URL = %s' %
                              dump_json(base_url + self.cfg['admin_url_prefix']))
        result.append(u'<script type="text/javascript">%s;</script>' %
                      '; '.join(javascript))

        for type, attr in local.page_metadata:
            result.append(generators[type](**attr))

        #! this is called before the page metadata is assembled with
        #! the list of already collected metadata.  You can extend the
        #! list in place to add some more html snippets to the page header.
        emit_event('before-metadata-assembled', result)
        return u'\n'.join(result)

    def handle_not_found(self, request, exception):


Generated by  Doxygen 1.6.0   Back to index