diff --git a/browser/textwidgets.py b/browser/textwidgets.py index d615c0a..e4106d3 100644 --- a/browser/textwidgets.py +++ b/browser/textwidgets.py @@ -286,6 +286,48 @@ class TextAreaWidget(SimpleInputWidget): name="field.foo" rows="15" ><h1>&copy;</h1> + + There was a but which caused the content of + + >>> request = TestRequest(form={'field.description': u'

foo

'}) + >>> widget = TestTextAreaWidget(field, request) + >>> try: + ... widget.getInputValue() + ... except ConversionError, error: + ... print error.doc() + I don't like foo. + >>> print normalize( widget() ) + """ default = "" @@ -309,7 +351,6 @@ def _toFormValue(self, value): value = super(TextAreaWidget, self)._toFormValue(value) if value: value = value.replace("\n", "\r\n") - value = escape(value) else: value = u'' @@ -323,7 +364,7 @@ def __call__(self): rows=self.height, cols=self.width, style=self.style, - contents=self._getFormValue(), + contents=escape(self._getFormValue()), extra=self.extra) class BytesAreaWidget(Bytes, TextAreaWidget): diff --git a/browser/widget.py b/browser/widget.py index 2fde9c7..51ad17d 100644 --- a/browser/widget.py +++ b/browser/widget.py @@ -269,7 +269,7 @@ class SimpleInputWidget(BrowserWidget, InputWidget): >>> widget() u'' - >>> request = TestRequest(form={'field.price': u'foo'}) + >>> request = TestRequest(form={'field.price': u'

foo

'}) >>> widget = FloatWidget(field, request) >>> try: ... widget.getInputValue() @@ -277,7 +277,7 @@ class SimpleInputWidget(BrowserWidget, InputWidget): ... print error.doc() Invalid floating point data >>> widget() - u'' + u'' >>> tearDown() @@ -376,7 +376,7 @@ def _toFormValue(self, value): def _getCurrentValueHelper(self): """Helper to get the current input value. - + Raises InputErrors if the data could not be validated/converted. """ input_value = None