Exemple #1
0
    def __call__(self):
        portal_state = getMultiAdapter((self.context, self.request),
                                       name=u'plone_portal_state')
        self.root_url = portal_state.navigation_root_url()

        result = self.get_canonical_url()
        alsoProvides(self, IViewView)
        for name, manager_name in head_viewlets.items():
            manager = queryMultiAdapter((self.context, self.request, self),
                                        IViewletManager,
                                        name=manager_name)
            viewlet = queryMultiAdapter(
                (self.context, self.request, self, manager),
                IViewlet,
                name=name)
            if viewlet is not None:
                try:
                    viewlet.update()
                    result += viewlet.render()
                except Exception:
                    logger.warn('Error rendering head viewlet %s' % name,
                                exc_info=True)
        result += unidecode(self.get_basic_tags())
        result += unidecode(self.get_navigation_links())
        result += unidecode(self.get_ld_data())
        result += unidecode(self.get_icons())
        result += unidecode(self.get_search_link())
        result += unidecode(self.get_printcss_link())
        return u'<html><head>%s</head></html>' % result
Exemple #2
0
def requestEnd(event):
    req = event.request
    try:
        period = time.time() - req.environ['__started__']
    except Exception:
        period = 0

    if period > 5.0:
        logger.warn('SLOW REQUEST(%i): %s' % (int(period), req.ACTUAL_URL))

    log_request(req)
Exemple #3
0
 def on_data(self, raw_data):
     try:
         parse_line(self.site, self.public_url, raw_data)
     except:
         logger.warn('error parsing tweet', exc_info=True)