Tim Abbott
df0d2a726d
python3: Add missing utf-8 encoding/decoding in various places.
2016-03-08 09:14:15 -08:00
Tim Abbott
a46647a87a
python3: Mark certain strings as unicode strings.
...
This is required in Python 3 since these strings are combined with
other unicode strings.
2016-03-08 09:14:11 -08:00
Tim Abbott
cbf9b7605a
Add test that all functions defined in urls.py actually exist.
...
This would have caught the create_user_backend issue introduced recently.
2016-02-07 19:21:53 -08:00
Reid Barton
6c6dc1d81d
Allow create user API to create any user in an open realm.
2016-02-07 19:19:19 -08:00
Reid Barton
9735025167
Refactor logic around restricted_to_domain.
...
Add a function email_allowed_for_realm that checks whether a user with
given email is allowed to join a given realm (either because the email
has the right domain, or because the realm is open), and use it
whenever deciding whether to allow adding a user to a realm.
This commit is not intended to change any behavior, except in one case
where the Zulip realm's domain was not being converted to lowercase.
2016-02-07 10:54:52 -05:00
Reid Barton
0755b51c2e
Move create_user_backend into zerver.views.users.
...
Commit aa33a0da
moved users views into their own file, but missed this one.
2016-02-07 10:54:48 -05:00
Reid Barton
4e5f18407d
Add comment in create_user_backend about not needing to invite users first.
2016-02-07 10:52:50 -05:00
Tim Abbott
1af7cbfd64
runtornado: Move more imports to the top of the file.
...
This is needed for adding more specific type annotations but is
otherwise counterproductive since it increases the diff from the
original.
2016-02-03 19:47:14 -08:00
Tim Abbott
2259ce62f8
tornado: Fix AsyncDjangoHandler get() and friends missing args/kwargs.
2016-02-03 19:47:14 -08:00
Tim Abbott
1d008576f2
QueueProcessingWorker: Add stub consume function and queue_name.
...
QueueProcessingWorker will now throw errors if there's a misconfigured
queue processor.
2016-02-03 19:47:14 -08:00
Tim Abbott
3469fd4bb2
Fix last remaining use of file() -> open().
2016-02-03 19:31:46 -08:00
Tim Abbott
d7b7ae2d0f
rundjango: Fix confusing return line in log_message_monkey.
2016-02-03 19:31:45 -08:00
Tim Abbott
05a40f11b3
runtornado: Add explicit return None.
2016-02-03 19:31:45 -08:00
Tim Abbott
37e987e250
Make realm_filters --show's empty list output more consistent.
2016-02-03 19:29:44 -08:00
Tim Abbott
3475a5c1ed
Fix test_runner.py fast_test_only return type.
2016-02-03 19:29:44 -08:00
Tim Abbott
fcc32b1093
Fix check_redis abuse of setting self.trim global.
2016-02-03 19:29:44 -08:00
Tim Abbott
693b9110df
Fix weird import of get_user_profile_by_email from decorator.py.
2016-02-03 19:29:44 -08:00
Tim Abbott
7595e4b05f
process_queue: Fix worker variable being accessed before initialization.
2016-02-03 19:29:44 -08:00
Tim Abbott
b34768837d
storage: Fix type error returning nothing in dry run case.
2016-02-03 19:29:44 -08:00
Tim Abbott
1ee0706511
Fix missing UTF-8 encoding.
2016-02-03 19:29:30 -08:00
Tim Abbott
10f15a2d00
middleware: Fix str/unicode type mismatch in statsd_path.
2016-02-03 19:29:07 -08:00
Tim Abbott
23705f4f16
Remove duplicate self._log_data initialization.
2016-02-03 19:29:07 -08:00
Tim Abbott
df1670ef59
Fix various float initialization to use 0.0 instead of 0.
...
This is needed to type-check these values.
2016-02-03 19:29:07 -08:00
Tim Abbott
fc02ea9f67
do_add_default_stream: Fix return value if stream exists.
...
Discovered using mypy static type checker.
2016-02-03 19:28:48 -08:00
Tim Abbott
620411c0ea
Fix type mismatches in streams.py.
2016-02-03 19:25:19 -08:00
Tim Abbott
e6e2584c5a
test_runner: Cleanup fast_tests_only types.
2016-02-03 19:25:19 -08:00
Tim Abbott
ee6062691a
Fix missing None in check_none_or return.
2016-02-03 19:25:18 -08:00
Tim Abbott
f03bfc5816
Fix missing prefix cache error output.
2016-02-03 19:25:18 -08:00
Tim Abbott
8654b57c7b
bugdown: Move definition of current_node above set_text function using it.
2016-02-03 19:25:18 -08:00
Tim Abbott
8dcdb1d8a8
actions: Remove duplicate import of RealmFilter.
...
Apparently we were importing it twice in the same import statement.
Discovered using mypy.
2016-02-03 19:25:17 -08:00
Tim Abbott
294b7aa7bd
EventsRegisterTest: Remove unused variable maxDiff.
...
Discovered using mypy.
2016-02-03 19:25:17 -08:00
Tim Abbott
e9f39922a0
notify_subscriptions_*: Fix use of leaked stream variable.
...
While I believe this actually produced correct output since users are
always subscribed to streams within their realm, this code was
definitely wrong.
Discovered using the mypy type-checking tool.
2016-02-03 19:25:17 -08:00
Tim Abbott
6c5cee2400
Cleanup 500s due to Google oauth2 errors.
...
These are user errors, albeit somewhat interesting ones, so they
should be logged (and return a user error response), not throw an
exception.
2016-02-02 23:08:20 -08:00
Tim Abbott
aad3bff193
Harden style rule for % comprehensions and fix existing errors.
2016-02-02 23:08:19 -08:00
Tim Abbott
5bacda3662
python3: Fix usage of .keys()/.values() to handle iterators.
...
This fixes the places where we use the result of .keys(), .items(),
and .values() that wouldn't work with an iterator to wrap them with
list().
2016-01-26 21:11:25 -08:00
Tim Abbott
f5de149976
python3: specify explicit sorting algorithm for subscriptions.
2016-01-26 21:11:25 -08:00
Tim Abbott
05a827c520
need_to_render_content: Fix comparison with None.
...
If the content wasn't rendered, both rendered_content and
rendered_content_version would be None. In addition to being
confusing, in Python 3, `None < 2` is an error and this code breaks.
2016-01-26 21:11:25 -08:00
Tim Abbott
bd0918cd5a
python3: Use zip from the six.moves package.
2016-01-26 21:11:24 -08:00
Tim Abbott
757e89260e
Migrate use of StringIO to Python 2+3 compatible six.moves.cStringIO.
...
And add a check for additional usage of the original StringIO module.
2016-01-26 21:09:43 -08:00
Tim Abbott
1f44417fc1
Switch to using Python 3 style division everywhere.
...
Also add testing for this to our Python 3 compatibility test suite.
2016-01-26 21:09:43 -08:00
Tim Abbott
6528b18ad3
Switch all urllib/urlparse usage to six.moves.urllib.
...
This provides Python 2+3 compatibility for our use of urllib.
Also add a test to avoid future regressions.
2016-01-26 21:09:43 -08:00
Tim Abbott
700055c194
Apply modernize transform libmodernize.fixes.fix_file.
...
This replaces use of file() with open() which is python 3 compatible,
and also adds it to our python 3 support test suite.
2016-01-26 21:09:42 -08:00
Tim Abbott
83dd51dcd6
Remove now-obsolete get_message_by_id_dbwarn transition code.
2016-01-26 21:05:11 -08:00
Tim Abbott
eecd1513b3
Don't access/store full Client objects in Tornado queue servers.
...
At present, we only do a few simple checks on the client type inside
the event system, and this saves database/memcached queries.
Note that this preserves the structure of the marshalled name in
to_dict/from_dict as client_type to avoid an unnecessary migration.
2016-01-26 21:04:32 -08:00
Tim Abbott
e3b6bfa3ca
Remove code for pickle event queue store.
...
Since we've had the JSON store in all environments for some time, we
no longer need this legacy code.
2016-01-26 20:59:34 -08:00
Tim Abbott
f6073d1708
Move HTTPResponse construction out of event_queue.py.
2016-01-26 20:59:19 -08:00
Tim Abbott
a9bf4b4cc7
Store the client name for the current handler in ClientDescriptor.
2016-01-26 20:58:01 -08:00
Tim Abbott
c7e3c3ce38
Look up client descriptors by handler_id.
...
Previously, client descriptors were referenced directly from the
handler object. Once we split the Tornado process into separate queue
and connection servers, these will no longer be in the same process,
so we need to reference them by ID instead.
2016-01-26 20:57:25 -08:00
Tim Abbott
ea6211c041
Allocate handler ids in AsyncDjangoHandler setup process.
2016-01-26 20:56:53 -08:00
Tim Abbott
ae760a351e
Move most of ClientDescriptor.finish_current_handler into library.
2016-01-26 20:56:08 -08:00