~tribaal/txaws/xss-hardening

« back to all changes in this revision

Viewing changes to txaws/server/schema.py

  • Committer: Christopher Glass
  • Date: 2013-08-20 07:46:01 UTC
  • Revision ID: christopher.glass@canonical.com-20130820074601-sot1v11nkzwmp1th
UseĀ asserIn/assertNotIn

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