Permalink
Browse files

Simplify get_stream_backend.

Assume that get_stream_backend() always receives a realm, not a
realm id.  We can be pretty confident of that now due to mypy.
  • Loading branch information...
showell committed Sep 20, 2016
1 parent 1dbc94b commit eb09dd217dbd5d9c214b14a5b28b3a12cf8b7854
Showing with 1 addition and 5 deletions.
  1. +1 −5 zerver/models.py
View
@@ -694,12 +694,8 @@ def get_client_remote_cache(name):
@cache_with_key(get_stream_cache_key, timeout=3600*24*7)
def get_stream_backend(stream_name, realm):
# type: (text_type, Realm) -> Stream
- if isinstance(realm, Realm):
- realm_id = realm.id
- else:
- realm_id = realm
return Stream.objects.select_related("realm").get(
- name__iexact=stream_name.strip(), realm_id=realm_id)
+ name__iexact=stream_name.strip(), realm_id=realm.id)
def get_active_streams(realm):
# type: (Realm) -> QuerySet

0 comments on commit eb09dd2

Please sign in to comment.