コード例 #1
0
 def render(self):
     """ Render the portlet if expression is evaluated succesfully.
     
     """
     
     #context = aq_inner(self.context)
     context = self.context
     expression_context = getExprContext(context)
     
     condition_value = True
     
     # Determine expression value in backwards compatible
     # manner    
     expression = self.data._expression_object
     
     if expression:
         
         try:        
             condition_value = expression(expression_context)
             
             if type(condition_value) in types.StringTypes:
                 if condition_value.strip() == u"":
                     # Emptry value evaluates to true
                     condition_value = True
             
         except Exception, e:
             # Log and output exception in user friendly
             # manner without interrupting the page rendering
             foobar, messages = Message.wrapCurrentException()
             outputTemplateErrors(messages, request=self.request, logger=logger, context=context)
             condition_value = False
コード例 #2
0
    def render(self):
        """ Render the portlet if expression is evaluated succesfully.

        """

        #context = aq_inner(self.context)
        context = self.context
        expression_context = getExprContext(context)

        condition_value = True

        # Determine expression value in backwards compatible
        # manner
        expression = self.data._expression_object

        if expression:

            try:
                condition_value = expression(expression_context)

                if type(condition_value) in types.StringTypes:
                    if condition_value.strip() == u"":
                        # Emptry value evaluates to true
                        condition_value = True

            except Exception, e:
                # Log and output exception in user friendly
                # manner without interrupting the page rendering
                foobar, messages = Message.wrapCurrentException()
                outputTemplateErrors(messages, request=self.request, logger=logger, context=context)
                condition_value = False
コード例 #3
0
 def outputTemplateErrors(self, instance, messages):
     """ Write template errors to the user and the log output. """            
     outputTemplateErrors(messages, request=instance.REQUEST, logger=logger, context=instance)        
コード例 #4
0
 def outputTemplateErrors(self, instance, messages):
     """ Write template errors to the user and the log output. """
     outputTemplateErrors(messages,
                          request=instance.REQUEST,
                          logger=logger,
                          context=instance)
コード例 #5
0
 def outputTemplateErrors(self, messages):
     """ Write template errors to the user and the log output. """
     outputTemplateErrors(messages, request=self.request, logger=logger, context=self.context)
コード例 #6
0
 def outputTemplateErrors(self, messages):
     """ Write template errors to the user and the log output. """    
     # XXX: we cannot rely request being present
     outputTemplateErrors(messages, request=getattr(self, "REQUEST", None), logger=logger, context=self)