Ticket #7876: trac-py26.patch
| File trac-py26.patch, 3.4 KB (added by jonas, 3 years ago) |
|---|
-
trac/core.py
33 33 error message. 34 34 """ 35 35 Exception.__init__(self, message) 36 self.m essage= message36 self.msg = message 37 37 if title: 38 38 self.title = title 39 39 self.show_traceback = show_traceback 40 40 41 41 def __unicode__(self): 42 return unicode(self.m essage)42 return unicode(self.msg) 43 43 44 44 class Interface(object): 45 45 """Marker base class for extension point interfaces.""" -
trac/web/api.py
467 467 if ctype not in ('application/x-www-form-urlencoded', 468 468 'multipart/form-data'): 469 469 fp = StringIO('') 470 470 # Python 2.6 introduced a backwards incompatible change for 471 # FieldStorage where QUERY_STRING is no longer ignored for POST 472 # requests. We'll keep the pre 2.6 behaviour for now... 473 if self.method == 'POST': 474 qs_on_post = self.environ.pop('QUERY_STRING') 471 475 fs = cgi.FieldStorage(fp, environ=self.environ, keep_blank_values=True) 476 if self.method == 'POST': 477 self.environ['QUERY_STRING'] = qs_on_post 472 478 if fs.list: 473 479 for name in fs.keys(): 474 480 values = fs[name] -
trac/web/tests/api.py
113 113 req = Request(environ, None) 114 114 self.assertEqual('test', req.read(size=4)) 115 115 116 def test_qs_on_post(self): 117 """Make sure req.args parsing is consistent even after the backwards 118 incompatible change introduced in Python 2.6. 119 """ 120 environ = self._make_environ(method='GET', 121 **{'QUERY_STRING': 'action=foo'}) 122 req = Request(environ, None) 123 self.assertEqual('foo', req.args['action']) 124 environ = self._make_environ(method='POST', 125 **{'wsgi.input': StringIO('action=bar'), 126 'CONTENT_LENGTH': '10', 127 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 128 'QUERY_STRING': 'action=foo'}) 129 req = Request(environ, None) 130 self.assertEqual('bar', req.args['action']) 116 131 132 117 133 def suite(): 118 134 suite = unittest.TestSuite() 119 135 suite.addTest(unittest.makeSuite(RequestTestCase, 'test')) -
trac/util/tests/text.py
36 36 except ValueError, e: 37 37 self.assertEquals(u, to_unicode(e)) 38 38 39 def test_from_exception_using_str(self):40 class PermissionError(StandardError):41 def __str__(self):42 return u'acc\xe8s interdit'43 try:44 raise PermissionError()45 except PermissionError, e:46 self.assertEquals(u'acc\xe8s interdit', to_unicode(e))47 39 48 40 class ExpandtabsTestCase(unittest.TestCase): 49 41 def test_empty(self):
