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
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
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