示例#1
0
 def add(self, text, type=u"info"):
     """Add a status message.
     """
     context = self.context
     text = translate(text, context=context)
     annotations = IAnnotations(context)
     value = _encodeCookieValue(text, type, old="")
     context.response.setCookie(STATUSMESSAGEKEY, value, path="/")
     annotations[STATUSMESSAGEKEY] = value
示例#2
0
 def addHTML(self, text, type='info'):
     """ Add a HTML status message.
     """
     context = self.context
     annotations = IAnnotations(context)
     text = translate(text, context=context)
     old = annotations.get(HTMLMESSAGEKEY,
                           context.cookies.get(HTMLMESSAGEKEY))
     value = adapter._encodeCookieValue(text, type, old=old)
     context.response.setCookie(HTMLMESSAGEKEY, value, path='/')
     annotations[HTMLMESSAGEKEY] = value
示例#3
0
 def addHTML(self, text, type=u'info'):
     """ Add a HTML status message.
     """
     context = self.context
     annotations = IAnnotations(context)
     text = translate(text, context=context)
     old = annotations.get(
         HTMLMESSAGEKEY, context.cookies.get(HTMLMESSAGEKEY)
     )
     value = adapter._encodeCookieValue(text, type, old=old)
     context.response.setCookie(HTMLMESSAGEKEY, value, path='/')
     annotations[HTMLMESSAGEKEY] = value