mirror of https://github.com/zulip/zulip.git
Remove some unnecessary intermediate lists
Use generator comprehensions for efficiency and cleaner code. (imported from commit 6b4b709515b5c904ef38b8ea33a9d4a4af0f5468)
This commit is contained in:
parent
3e51ef8c1c
commit
04b1c21333
|
@ -127,7 +127,7 @@ class Huddle(models.Model):
|
|||
|
||||
def get_huddle(id_list):
|
||||
id_list = sorted(set(id_list))
|
||||
hash_key = ",".join([str(x) for x in id_list])
|
||||
hash_key = ",".join(str(x) for x in id_list)
|
||||
huddle_hash = hashlib.sha1(hash_key).hexdigest()
|
||||
if Huddle.objects.filter(huddle_hash=huddle_hash):
|
||||
return Huddle.objects.get(huddle_hash=huddle_hash)
|
||||
|
|
|
@ -57,14 +57,14 @@ def home(request):
|
|||
personals = filter_by_subscriptions(Zephyr.objects.filter(
|
||||
recipient__type="personal").all(), request.user)
|
||||
people = simplejson.dumps(list(
|
||||
set([get_display_recipient(zephyr.recipient) for zephyr in personals])))
|
||||
set(get_display_recipient(zephyr.recipient) for zephyr in personals)))
|
||||
|
||||
publics = filter_by_subscriptions(Zephyr.objects.filter(
|
||||
recipient__type="class").all(), request.user)
|
||||
classes = simplejson.dumps(list(
|
||||
set([get_display_recipient(zephyr.recipient) for zephyr in publics])))
|
||||
instances = simplejson.dumps(list(set(
|
||||
[zephyr.instance for zephyr in publics])))
|
||||
set(get_display_recipient(zephyr.recipient) for zephyr in publics)))
|
||||
instances = simplejson.dumps(list(
|
||||
set(zephyr.instance for zephyr in publics)))
|
||||
|
||||
return render_to_response('zephyr/index.html',
|
||||
{'zephyr_json' : zephyr_json,
|
||||
|
|
Loading…
Reference in New Issue