Example #1
0
 def __call__(self, name, text, data, interface):
     transformers = grok.queryOrderedMultiSubscriptions(
         (self.context, self.request), interface)
     return Transformer(
         transformers,
         data,
         prepare=(name, text),
         xhtml=ISilvaXMLHandler.providedBy(self.request))
 def test_save_editor_filters(self):
     """Test that there are default input editor filters, and they
     implement the proper API.
     """
     version = self.root.document.get_editable()
     transformers = grok.queryOrderedMultiSubscriptions((version, TestRequest()), ISaveEditorFilter)
     self.assertNotEqual(len(transformers), 0)
     for transformer in transformers:
         self.assertTrue(verifyObject(ITransformationFilter, transformer))
Example #3
0
def get_menu_items(menu, content):
    security = getSecurityManager()

    def validate(menu):
        try:
            security.validate(content, content, None, menu)
            return True
        except Unauthorized:
            return False

    return filter(
        lambda m: validate(m) and m.available(), grok.queryOrderedMultiSubscriptions((menu, content), IMenuItem)
    )