Пример #1
0
def has_view_name(names, REQUEST):
    """
    Checks that the accessed view name is in names and
           that the accessed object on the request is a naaya object

    This was implemented in order to check if the center portlets
    should be displayed through standard_template in the chm3 layout.
    """
    def get_view_name(REQUEST):
        try:
            return REQUEST.PUBLISHED.__name__
        except AttributeError:
            # we are probably in an error state
            # the request doesn't have the attribute 'PUBLISHED'
            return None

    def get_object_class(REQUEST):
        return type(REQUEST.PARENTS[0].aq_base)

    view_name = get_view_name(REQUEST)
    cls = get_object_class(REQUEST)
    return (view_name in names and INyContentObject.implementedBy(cls))
Пример #2
0
def has_view_name(names, REQUEST):
    """
    Checks that the accessed view name is in names and
           that the accessed object on the request is a naaya object

    This was implemented in order to check if the center portlets
    should be displayed through standard_template in the chm3 layout.
    """
    def get_view_name(REQUEST):
        try:
            return REQUEST.PUBLISHED.__name__
        except AttributeError:
            # we are probably in an error state
            # the request doesn't have the attribute 'PUBLISHED'
            return None

    def get_object_class(REQUEST):
        return type(REQUEST.PARENTS[0].aq_base)

    view_name = get_view_name(REQUEST)
    cls = get_object_class(REQUEST)
    return (view_name in names and
                INyContentObject.implementedBy(cls))