Files
zulip/zerver/views/digest.py
Anders Kaseorg 365fe0b3d5 python: Sort imports with isort.
Fixes #2665.

Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.

Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start.  I expect this change will increase pressure for us to split
those files, which isn't a bad thing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -07:00

21 lines
775 B
Python

import time
from datetime import timedelta
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.utils.timezone import now as timezone_now
from zerver.decorator import zulip_login_required
from zerver.lib.digest import DIGEST_CUTOFF, handle_digest_email
@zulip_login_required
def digest_page(request: HttpRequest) -> HttpResponse:
user_profile_id = request.user.id
cutoff = time.mktime((timezone_now() - timedelta(days=DIGEST_CUTOFF)).timetuple())
context = handle_digest_email(user_profile_id, cutoff, render_to_web=True)
if context:
context.update({'physical_address': settings.PHYSICAL_ADDRESS})
return render(request, 'zerver/digest_base.html', context=context)