Exemple #1
0
def containerViews(_context, for_, contents=None, add=None, index=None,
                   layer=IDefaultBrowserLayer):
    """Set up container views for a given content type."""

    if for_ is None:
            raise ValueError("A for interface must be specified.")

    if contents is not None:
        from zope.app.menus import zmi_views
        page(_context, name='contents.html', permission=contents,
             for_=for_, layer=layer, class_=Contents, attribute='contents',
             menu=zmi_views, title=_('Contents'))

    if index is not None:
        page(_context, name='index.html', permission=index, for_=for_,
             layer=layer, class_=Contents, attribute='index')

    if add is not None:
        from zope.app.menus import zmi_actions
        viewObj = view(_context, name='+', layer=layer, menu=zmi_actions,
                       title=_('Add'), for_=for_, permission=add,
                       class_=Adding)
        viewObj.page(_context, name='index.html', attribute='index')
        viewObj.page(_context, name='action.html', attribute='action')
        viewObj()
def handle_soaplib_req(_context, name, for_, service_definitions,
                       app_namespace):
    """Not working just yet"""

    soap_app = consturct_soaplib_application(service_definitions,
                                             app_namespace)
    soap_handler = SoaplibHandler(soap_app)
    page(_context, name, for_, class_=soap_handler)
Exemple #3
0
 def setUpZCML( self, form_name, form_class, model_schema):
     if self.context.echo:
         self.context.logger.debug("%s: registered %s for %s, layer %s, permission %s"%( 
             self.context.domain_model.__name__,
             form_name,
             model_schema.__name__,
             "Default", 
             self.permission ) )
     page( self.context.zcml, self.name, self.permission, model_schema,
           class_=form_class )
 def setUpZCML(self, form_name, form_class, model_schema):
     if self.context.echo:
         self.context.logger.debug(
             "%s: registered %s for %s, layer %s, permission %s" %
             (self.context.domain_model.__name__, form_name,
              model_schema.__name__, "Default", self.permission))
     page(self.context.zcml,
          self.name,
          self.permission,
          model_schema,
          class_=form_class)
Exemple #5
0
def rml2pdf(_context, name, permission, for_, template,
            layer=IDefaultBrowserLayer, class_=RML2PDFView,
            allowed_interface=None, allowed_attributes=None,
            menu=None, title=None, encoding=u'iso-8859-1'):

    if class_ is not RML2PDFView and RML2PDFView not in class_.__bases__:
        bases = (class_, RML2PDFView)
    else:
        bases = (class_,)

    factory = type(
        'RML2PDFView from template=%s' %(str(template)),
        bases,
        {'template': ViewPageTemplateFile(template),
         'encoding': encoding}
        )

    page(_context, name, permission, for_, layer, None, factory,
         allowed_interface, allowed_attributes, '__call__', menu, title)
Exemple #6
0
def containerViews(_context, for_, contents=None, add=None, index=None, layer=IDefaultBrowserLayer):
    """Set up container views for a given content type."""

    if for_ is None:
        raise ValueError("A for interface must be specified.")

    if contents is not None:
        from zope.app.menus import zmi_views

        page(
            _context,
            name="contents.html",
            permission=contents,
            for_=for_,
            layer=layer,
            class_=Contents,
            attribute="contents",
            menu=zmi_views,
            title=_("Contents"),
        )

    if index is not None:
        page(_context, name="index.html", permission=index, for_=for_, layer=layer, class_=Contents, attribute="index")

    if add is not None:
        from zope.app.menus import zmi_actions

        viewObj = view(_context, name="+", layer=layer, for_=for_, permission=add, class_=Adding)
        menuItemDirective(
            _context,
            zmi_actions,
            for_,
            "+",
            _("Add"),
            permission=add,
            layer=layer,
            filter='python:modules["zope.app.container.browser.metaconfigure"].menuFilter(context, request)',
        )
        viewObj.page(_context, name="index.html", attribute="index")
        viewObj.page(_context, name="action.html", attribute="action")
        viewObj()
def handle_soaplib_req(_context, name, for_, service_definitions, app_namespace):
    """Not working just yet"""

    soap_app = consturct_soaplib_application(service_definitions, app_namespace)
    soap_handler = SoaplibHandler(soap_app)
    page(_context, name, for_, class_=soap_handler)