Ejemplo n.º 1
0
 def factory(self, menu, title=None, order=0, icon=None, group=''):
     martian.validateInterfaceOrClass(self, menu)
     if not (issubclass(menu, IMenu) or IMenu.implementedBy(menu)):
         raise martian.error.GrokImportError(
             "You can only pass a class implementing "
             "megrok.navigation.interfaces.IMenu "
             "to the '%s' directive." % self.name)
     return menu, (title, order, icon, group)
Ejemplo n.º 2
0
 def factory(self, submenu, group=''):
     if IMenu.implementedBy(submenu):
         submenu = grokcore.component.name.bind().get(submenu)
     if martian.util.not_unicode_or_ascii(submenu):
         raise martian.error.GrokImportError(
             "You can only pass a class "
             "implementing megrok.navigation.interfaces.IMenu "
             "to the '%s' directive." % self.name)
     return submenu, group