Exemplo n.º 1
0
    def children_xmldoc(self):
        # If you need custom filter then reimplement this method.
        # Otherwise this implementation is generic and it is correct
        # for standard cases.
        try:
            rc = IReadContainer(self.context)
        except TypeError:
            return XMLDOC % u''
        except Unauthorized:
            return XMLDOC % u''

        specs = [queryMultiAdapter((value, self.request), IXML)
                for value in rc.values()]
        specs = filter(lambda x:x, specs)
        specs.sort(key = lambda x: x.sort_key())
        nodes = [x.to_xml() for x in specs]
        return XMLDOC % u'\n'.join(nodes)
Exemplo n.º 2
0
    def children_xmldoc(self):
        # If you need custom filter then reimplement this method.
        # Otherwise this implementation is generic and it is correct
        # for standard cases.
        try:
            rc = IReadContainer(self.context)
        except TypeError:
            return XMLDOC % u''
        except Unauthorized:
            return XMLDOC % u''

        specs = [
            queryMultiAdapter((value, self.request), IXML)
            for value in rc.values()
        ]
        specs = filter(lambda x: x, specs)
        specs.sort(key=lambda x: x.sort_key())
        nodes = [x.to_xml() for x in specs]
        return XMLDOC % u'\n'.join(nodes)
Exemplo n.º 3
0
    def children_xmldoc(self):
        try:
            rc = IReadContainer(self.context)
        except TypeError:
            return XMLDOC % u''
        except Unauthorized:
            return XMLDOC % u''

        specs = [queryMultiAdapter((value, self.request), IXML)
                for value in rc.values()]
        specs = filter(lambda x:x, specs)
        specs.sort(key = lambda x: x.sort_key())

        nodes = [x.to_xml() for x in specs]

        # add ++etc++site
        sm = self.context.getSiteManager()
        sm_spec = queryMultiAdapter((sm, self.request), IXML)
        nodes.append(sm_spec.to_xml())

        return XMLDOC % u'\n'.join(nodes)
Exemplo n.º 4
0
    def children_xmldoc(self):
        try:
            rc = IReadContainer(self.context)
        except TypeError:
            return XMLDOC % u''
        except Unauthorized:
            return XMLDOC % u''

        specs = [
            queryMultiAdapter((value, self.request), IXML)
            for value in rc.values()
        ]
        specs = filter(lambda x: x, specs)
        specs.sort(key=lambda x: x.sort_key())

        nodes = [x.to_xml() for x in specs]

        # add ++etc++site
        sm = self.context.getSiteManager()
        sm_spec = queryMultiAdapter((sm, self.request), IXML)
        nodes.append(sm_spec.to_xml())

        return XMLDOC % u'\n'.join(nodes)