示例#1
0
def menuFilter(context, request):
    '''This is a function that filters the "Add" menu item'''
    adding = queryMultiAdapter((context, request), name="+")
    if adding is None:
        adding = Adding(context, request)
    adding.__parent__ = context
    adding.__name__ = '+'
    info = adding.addingInfo()
    return bool(info)
示例#2
0
def menuFilter(context, request):
    """This is a function that filters the "Add" menu item"""
    adding = queryMultiAdapter((context, request), name="+")
    if adding is None:
        adding = Adding(context, request)
    adding.__parent__ = context
    adding.__name__ = "+"
    info = adding.addingInfo()
    return bool(info)
示例#3
0
    def addObject(self):
        request = self.request
        if IContainerNamesContainer.providedBy(self.context):
            new = ""
        else:
            new = request["new_value"]

        adding = zapi.queryMultiAdapter((self.context, self.request), name="+")
        if adding is None:
            adding = Adding(self.context, request)
        else:
            # Set up context so that the adding can build a url
            # if the type name names a view.
            # Note that we can't so this for the "adding is None" case
            # above, because there is no "+" view.
            adding.__parent__ = self.context
            adding.__name__ = '+'

        adding.action(request['type_name'], new)
示例#4
0
    def addObject(self):
        request = self.request
        if IContainerNamesContainer.providedBy(self.context):
            new = ""
        else:
            new = request["new_value"]

        adding = queryMultiAdapter((self.context, self.request), name="+")
        if adding is None:
            adding = Adding(self.context, request)
        else:
            # Set up context so that the adding can build a url
            # if the type name names a view.
            # Note that we can't so this for the "adding is None" case
            # above, because there is no "+" view.
            adding.__parent__ = self.context
            adding.__name__ = '+'

        adding.action(request['type_name'], new)