From 3e35c703607b5f135828fa5efe2beee669c7a4c2 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Tue, 9 Jan 2007 02:08:11 +0000 Subject: add StaticText source, which can be used as a simple way to forward values between web pages --- lib/python/Components/Sources/StaticText.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/python/Components/Sources/StaticText.py (limited to 'lib/python/Components/Sources/StaticText.py') diff --git a/lib/python/Components/Sources/StaticText.py b/lib/python/Components/Sources/StaticText.py new file mode 100644 index 00000000..2f8f0e18 --- /dev/null +++ b/lib/python/Components/Sources/StaticText.py @@ -0,0 +1,16 @@ +from Source import Source +from Components.Element import cached + +class StaticText(Source): + # filter is a function which filters external, untrusted strings + # this must be done to avoid XSS attacks! + + # (and is probably not done yet. For this reason, be careful when + # using this on HTML pages. *DO* provide your filter function.) + def __init__(self, text = "", filter = lambda x: x): + Source.__init__(self) + self.text = text + self.filter = filter + + def handleCommand(self, cmd): + self.text = self.filter(cmd) -- cgit v1.2.3