Mercurial > p > roundup > code
diff roundup/cgi/client.py @ 5673:6b6bc8d31caf
Merged
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Mon, 25 Mar 2019 19:47:29 +0100 |
| parents | f60c44563c3a |
| children | b67636bc87d0 |
line wrap: on
line diff
--- a/roundup/cgi/client.py Mon Mar 25 19:46:20 2019 +0100 +++ b/roundup/cgi/client.py Mon Mar 25 19:47:29 2019 +0100 @@ -237,15 +237,13 @@ needed for handling json and xml data blobs under python 3. Under python 2, str and binary are interchangable, not so under 3. - - Note that there may be places where this should support text mode. - (e.g. a large text file upload??). None are known, but this could be - a problem. ''' def make_file(self, mode=None): ''' work around https://bugs.python.org/issue27777 ''' import tempfile - return tempfile.TemporaryFile("wb+") + if self.length >= 0: + return tempfile.TemporaryFile("wb+") + return super().make_file() class Client: """Instantiate to handle one CGI request. @@ -527,7 +525,16 @@ self.determine_language() # Open the database as the correct user. # TODO: add everything to RestfulDispatcher - self.determine_user() + try: + self.determine_user() + except LoginError as err: + self.response_code = http_.client.UNAUTHORIZED + output = b"Invalid Login\n" + self.setHeader("Content-Length", str(len(output))) + self.setHeader("Content-Type", "text/plain") + self.write(output) + return + self.check_anonymous_access() # Call rest library to handle the request
