1. Michiel Overtoom
  2. CherryPyFixTicketUrls2


Jason R. Coombs  committed 7d127f2 Merge

Merge with cherrypy-3.2.x

  • Participants
  • Parent commits dbaec4c, a376aec
  • Branches default

Comments (0)

Files changed (2)

File cherrypy/lib/cptools.py

View file
  • Ignore whitespace
 import re
 import cherrypy
-from cherrypy._cpcompat import basestring, md5, set
+from cherrypy._cpcompat import basestring, md5, set, unicodestr
 from cherrypy.lib import httputil as _httputil
     def login_screen(self, from_page='..', username='', error_msg='', **kwargs):
-        return (u"""<html><body>
+        return (unicodestr("""<html><body>
 Message: %(error_msg)s
 <form method="post" action="do_login">
     Login: <input type="text" name="username" value="%(username)s" size="10" /><br />
     <input type="hidden" name="from_page" value="%(from_page)s" /><br />
     <input type="submit" />
-</body></html>""" % vars()).encode("utf-8")
+</body></html>""") % vars()).encode("utf-8")
     def do_login(self, username, password, from_page='..', **kwargs):
         """Login. May raise redirect, or return True if request handled."""

File cherrypy/test/test_tools.py

View file
  • Ignore whitespace
 import unittest
 from cherrypy._cpcompat import BytesIO, copyitems, itervalues
 from cherrypy._cpcompat import IncompleteRead, ntob, ntou, py3k, xrange
-from cherrypy._cpcompat import bytestr
+from cherrypy._cpcompat import bytestr, unicodestr
 import time
 timeout = 0.2
 import types
         username and password were unicode.
         sa = cherrypy.lib.cptools.SessionAuth()
-        res = sa.login_screen(None, username=u'nobody', password=u'anypass')
+        res = sa.login_screen(None, username=unicodestr('nobody'),
+            password=unicodestr('anypass'))
         self.assertIsInstance(res, bytestr)