def match(uri):
    """ Return the filter domain that match the uri. None means not filtered. """

    if g_exdm == None:
        load()

    scheme, userinfo, host, path, query, frag = httputil.urlsplit(uri)
    for ex in g_exdm:
        if ex[0] == '.':
            if host.endswith(ex):
                return ex
        else:
            if host == ex:
                return ex
    return None
    def renderMatchItem(self, node, match):
        uri = match.uri
        title = match.title and match.title or 'No title'
        scheme, userinfo, host, path, query, frag = httputil.urlsplit(uri)


        #import sys
        #print >>sys.stderr, type(title), title

        node.address.atts['href'] = uri
        node.address.content = title[:100]

        if match.description:
            node.description.raw = match.description
        else:
            node.description.omit()
        node.host.content = host

        # todo: hack
        node.archive_link.atts['href'] = '/archive_view?docid=%s' % str(match.docid)
        node.archive_link.content = match.date[:10]