~tribaal/txaws/xss-hardening

« back to all changes in this revision

Viewing changes to txaws/server/schema.py

  • Committer: Alberto Donato
  • Date: 2013-08-14 12:10:05 UTC
  • Revision ID: alberto.donato@canonical.com-20130814121005-baq7k58fp3762py4
Implement parse(), not coerce() [trivial] [r=free.ekanayaka].

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
class UnicodeLine(Unicode):
193
193
    """A parameter that must be a C{unicode} string without newlines."""
194
194
 
195
 
    def coerce(self, value):
196
 
        super(UnicodeLine, self).coerce(value)
 
195
    kind = "unicode line"
 
196
 
 
197
    def parse(self, value):
 
198
        value = super(UnicodeLine, self).parse(value)
197
199
        if "\n" in value:
198
 
            raise InvalidParameterValueError("Can't contain newlines.")
 
200
            raise ValueError()
 
201
        return value
199
202
 
200
203
 
201
204
class RawStr(Parameter):