Jason R. Coombs avatar Jason R. Coombs committed 0f88aca

Always encode login_screen (no longer needs ntob). Fixes #1132.

Comments (0)

Files changed (1)


 import re
 import cherrypy
-from cherrypy._cpcompat import basestring, ntob, md5, set
+from cherrypy._cpcompat import basestring, md5, set
 from cherrypy.lib import httputil as _httputil
     def login_screen(self, from_page='..', username='', error_msg='', **kwargs):
-        return ntob("""<html><body>
+        return (u"""<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>""" % {'from_page': from_page, 'username': username,
-                     'error_msg': error_msg}, "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."""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.