Tim Abbott
986706c7e5
tornado: Use common code for copying headers.
...
This fixes a bug where our asynchronous requests were only copying the
Content-Type header (i.e. the one case where we're noticed) from the
Django HttpResponse. I'm not sure what the impact of this would be;
the rate-limiting headers rarely come up when breaking a long-polled
request. But it seems clearly an improvement to do this in a
consistent fashion.
Only the headers piece is a change; in Tornado
self.finish(x)
is equivalent to:
self.write(x)
self.finish()
2020-02-07 16:14:19 -08:00
Tim Abbott
224a73a3ec
tornado: Extract a function for writing Tornado responses.
...
This increases the readability of what's happening in our core Tornado
handlers code, as well as making this logic reusable.
2020-02-07 16:13:49 -08:00
Tim Abbott
5305e8af85
tornado: Extract convert_tornado_request_to_django_request.
2020-02-07 16:03:58 -08:00
Tim Abbott
fc58ae117a
handlers: Rename confusingly named response to result_dict.
...
This should somewhat increase the readability of zulip_finish.
2020-02-07 16:03:58 -08:00
Anders Kaseorg
0d20145b93
mypy: Upgrade from 0.730 to 0.740.
...
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
becef760bf
cleanup: Delete leading newlines.
...
Previous cleanups (mostly the removals of Python __future__ imports)
were done in a way that introduced leading newlines. Delete leading
newlines from all files, except static/assets/zulip-emoji/NOTICE,
which is a verbatim copy of the Apache 2.0 license.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:29:11 -07:00
Wyatt Hoodes
a2fa1a6f25
handlers: Remove duplicate type annotation.
...
`self._request_middleware` is already typed in the `__init__` method.
2019-07-22 16:27:39 -07:00
Tim Abbott
e4813e462b
tornado: Rename async_request_{restart,stop} to mention timer.
...
Previously, these timer accounting functions could be easily mistaken
for referring to starting/stopping the request. By adding timer to
the name, we make the code easier for the casual observer to read and
understand.
2018-10-16 15:39:10 -07:00
Vishnu Ks
54a002c2e2
requirements: Upgrade pyflakes to 2.0.0.
...
We fix a few errors that only the new version finds.
2018-05-24 11:31:36 -07:00
Tim Abbott
276b78e952
tornado: Extract AsyncDjangoHandlerBase and mark as nocoverage.
...
We're never going to add tests for this block, which is fundamentally
well-tested code from Django with a since line changed which is hard
to screw up (long-polling will not work at all without it). The hope
is to remove it entirely and replace it with a cleaner monkey-patch,
but until then, unit tests for it would be redundant.
2018-05-15 18:39:52 -07:00
neiljp (Neil Pilgrim)
2ed6da77c7
mypy: Rewrite some middleware annotations to use ViewFuncT.
2018-03-17 23:25:05 +00:00
rht
9a8d2244ca
django-2.0: Shift to resolvers from urlresolvers.
...
The old name is deprecated.
2018-01-30 10:53:54 -08:00
Tim Abbott
dc8dd2333c
tornado: Sort imports in files with no merge conflicts.
2017-11-15 15:53:11 -08:00
rht
19bd335cbb
Change urllib import to be Python 3-specific.
2017-11-07 10:46:42 -08:00
neiljp (Neil Pilgrim)
452802bf75
mypy: Add Callable parameters/returns to AsyncDjangoHandler in handlers.py,
2017-10-31 00:03:35 -07:00
rht
c4fcff7178
refactor: Replace super(.*self) with Python 3-specific super().
...
We change all the instances except for the `test_helpers.py`
TimeTrackingCursor monkey-patching, which actually needs to specify
the base class.
2017-10-30 14:30:25 -07:00
rht
1047733486
zerver/tornado: Use python 3 syntax for typing.
2017-10-26 21:58:22 -07:00
rht
241e318eba
zerver/tornado: remove `import six`.
2017-09-27 19:10:28 -07:00
rht
b8aa92194c
zerver/tornado: Remove print_function.
2017-09-27 18:05:45 -07:00
rht
74fd3d9f31
zerver/tornado: Remove absolute_import.
2017-09-27 10:00:39 -07:00
neiljp (Neil Pilgrim)
b782db48e1
mypy: Remove superfluous older 'type: ignore' annotations.
2017-08-08 11:27:51 -07:00
Umair Khan
95fc16d90d
Django 1.11: MIDDLEWARE_CLASSES setting is deprecated.
...
Django provides MiddlewareMixin to upgrade old-style middlewares. See
https://docs.djangoproject.com/en/1.11/topics/http/middleware/#upgrading-middleware
2017-06-13 15:04:04 -07:00
Tim Abbott
315a9ee72e
handlers: Fix type of zulip_finish.
2017-05-23 17:36:19 -07:00
Aditya Bansal
5c82319101
pep8: Add compliance with rule E261 to handlers.py.
2017-05-07 23:21:50 -07:00
Tim Abbott
2b62c4fa38
mypy: Fix missing annotation in Tornado handlers.
...
This was accidentally removed in
9866124b78
, but is needed on the current
mypy version.
2017-03-19 22:26:25 -07:00
Tim Abbott
9866124b78
mypy: Fix some new errors flagged by latest mypy master.
...
Mostly list -> List bugs in annotations.
2017-03-19 21:03:45 -07:00
sinwar
6f0564e9f4
python: Fix remaining bare excepts in codebase.
...
Fixes #2862 .
2017-03-05 16:17:04 -08:00
Raghav Jajodia
a3a03bd6a5
mypy: Added Dict, List and Set imports.
...
Fixed mypy errors associated with the upgrade.
2017-03-04 14:33:44 -08:00
Sidhant Bhavnani
8c0c12c1d9
pep8: Fix E303 violations.
2016-12-02 15:34:11 -08:00
Tim Abbott
169d404579
tornado: Move zerver.lib.handlers into zerver.tornado.handlers.
...
This cleans up the confusingly duplicated file names, while also
moving more of the Tornado-specific code under zerver/tornado/.
2016-11-26 22:29:28 -08:00
Tim Abbott
d75f49b119
tornado: Move descriptor dict management code to handlers.py.
2016-11-26 22:29:28 -08:00
Tim Abbott
f2782971e0
tornado: Clean up AsyncDjangoHandler Python style.
2016-11-26 22:05:04 -08:00
Tim Abbott
9e9066f77a
tornado: Extract AsyncDjangoHandler to its own file.
2016-11-26 21:43:11 -08:00