コード例 #1
0
ファイル: hook.py プロジェクト: Natim/redbarrel
 def _failed(e):
     err = HTTPError()
     err.status_int = code
     body = StringIO()
     pprint(str(e), body)
     body.seek(0)
     err.body = body.read()
     raise err
 def _failed(e):
     err = HTTPError()
     err.status_int = code
     body = StringIO()
     pprint(str(e), body)
     body.seek(0)
     err.body = body.read()
     raise err
コード例 #3
0
ファイル: hook.py プロジェクト: Natim/redbarrel
 def _check_type(self, type_, value, code):
     # XXX we should keep the value converted, no ?
     if type_ in self.types:
         try:
             self.types[type_](value)
         except ValueError, e:
             err = HTTPError()
             err.status_int = code
             body = StringIO()
             pprint(str(e), body)
             body.seek(0)
             err.body = body.read()
             raise err
 def _check_type(self, type_, value, code):
     # XXX we should keep the value converted, no ?
     if type_ in self.types:
         try:
             self.types[type_](value)
         except ValueError, e:
             err = HTTPError()
             err.status_int = code
             body = StringIO()
             pprint(str(e), body)
             body.seek(0)
             err.body = body.read()
             raise err