mirror of https://github.com/zulip/zulip.git
[django 1.5] Update read flags handling to use new Django 1.5 syntax.
(imported from commit af1e2608b6d6d3677bf6266980d8dc77739aa4ba)
This commit is contained in:
parent
4a91b4a1ea
commit
fde2243dbc
|
@ -571,9 +571,9 @@ if settings.USING_RABBITMQ or settings.TEST_SUITE:
|
|||
to_update = UserMessage.objects.filter(id__in=mids)
|
||||
|
||||
if operation == "add":
|
||||
to_update.update(flags=F('flags') | flagattr)
|
||||
to_update.update(flags=F('flags').bitor(flagattr))
|
||||
elif operation == "remove":
|
||||
to_update.update(flags=F('flags') & ~flagattr)
|
||||
to_update.update(flags=F('flags').bitand(~flagattr))
|
||||
|
||||
if len(mids) == 0:
|
||||
return True
|
||||
|
@ -630,9 +630,9 @@ def process_update_message_flags(event):
|
|||
id__lte=until_id)
|
||||
|
||||
if op == 'add':
|
||||
msgs.update(flags=F('flags') | flagattr)
|
||||
msgs.update(flags=F('flags').bitor(flagattr))
|
||||
elif op == 'remove':
|
||||
msgs.update(flags=F('flags') & ~flagattr)
|
||||
msgs.update(flags=F('flags').bitand(~flagattr))
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -66,9 +66,9 @@ class Command(BaseCommand):
|
|||
with transaction.commit_on_success():
|
||||
msgs = UserMessage.objects.filter(id__in=batch)
|
||||
if op == 'add':
|
||||
msgs.update(flags=models.F('flags') | flag)
|
||||
msgs.update(flags=models.F('flags').bitor(flag))
|
||||
elif op == 'remove':
|
||||
msgs.update(flags=models.F('flags') & ~flag)
|
||||
msgs.update(flags=models.F('flags').bitand(~flag))
|
||||
|
||||
if not options["for_real"]:
|
||||
logging.info("Updating %s by %s %s" % (mids, op, flag))
|
||||
|
|
|
@ -61,7 +61,7 @@ class Command(BaseCommand):
|
|||
else:
|
||||
def do_update(batch):
|
||||
with transaction.commit_on_success():
|
||||
UserMessage.objects.filter(id__in=batch).update(flags=models.F('flags') | UserMessage.flags.read)
|
||||
UserMessage.objects.filter(id__in=batch).update(flags=models.F('flags').bitor(UserMessage.flags.read))
|
||||
|
||||
mids = [m.id for m in msgs]
|
||||
utils.run_in_batches(mids, 250, do_update, 3, logging.info)
|
||||
|
|
|
@ -474,7 +474,7 @@ def update_pointer_backend(request, user_profile,
|
|||
UserMessage.objects.filter(user_profile=user_profile,
|
||||
message__id__lte=pointer,
|
||||
flags=~UserMessage.flags.read) \
|
||||
.update(flags=F('flags') | UserMessage.flags.read)
|
||||
.update(flags=F('flags').bitor(UserMessage.flags.read))
|
||||
|
||||
if settings.TORNADO_SERVER:
|
||||
tornado_callbacks.send_notification(dict(
|
||||
|
|
Loading…
Reference in New Issue