コード例 #1
0
 def __call__(self):
     """Returns true if there's an exhibit in the acquisition chain
     of the context"""
     context = self.context
     parents = aq_chain(aq_inner(context))
     for item in parents:
         if IExhibit.providedBy(item):
             return True
     return False
コード例 #2
0
    def __init__(self, *args):
        base.Renderer.__init__(self, *args)

        context = aq_inner(self.context)
        exhibit = None
        while exhibit is None:
            if IExhibit.providedBy(context):
                exhibit = context
            context = aq_parent(context)
        self.exhibit = exhibit