cleanup legacy code
This commit is contained in:
parent
0fbaaaea43
commit
c0802c9c04
4 changed files with 6 additions and 32 deletions
|
@ -147,12 +147,14 @@ class DiscoverGenerator(BaseJob):
|
|||
"pk", flat=True
|
||||
)[:20]
|
||||
)
|
||||
print(post_ids)
|
||||
if len(post_ids) < 30:
|
||||
post_ids |= set(
|
||||
Takahe.get_popular_posts(3, 1)
|
||||
.order_by("-published")
|
||||
.values_list("pk", flat=True)[:2]
|
||||
Comment.objects.filter(visibility=0)
|
||||
.order_by("-created_time")
|
||||
.values_list("posts", flat=True)[:2]
|
||||
)
|
||||
print(post_ids)
|
||||
cache.set("public_gallery", gallery_list, timeout=None)
|
||||
cache.set("trends_links", trends, timeout=None)
|
||||
cache.set("featured_collections", collection_ids, timeout=None)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
from .decorators import *
|
|
@ -1,27 +0,0 @@
|
|||
import functools
|
||||
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from requests.exceptions import Timeout
|
||||
|
||||
|
||||
def mastodon_request_included(func):
|
||||
"""Handles timeout exception of requests to mastodon, returns http 500"""
|
||||
|
||||
@functools.wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except (Timeout, ConnectionError):
|
||||
return render(
|
||||
args[0],
|
||||
"common/error.html",
|
||||
{"msg": _("Timeout connecting to Fediverse.")},
|
||||
)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
class HttpResponseInternalServerError(HttpResponse):
|
||||
status_code = 500
|
|
@ -46,7 +46,7 @@
|
|||
<article>
|
||||
{{ announcement.html | safe }}
|
||||
<footer>
|
||||
<span class="action inline"><span><a>{{ announcement.created|default:announcement.created|naturaldelta }}</a></span>
|
||||
<span class="action inline"><span><a>{{ announcement.created|default:announcement.created|date }}</a></span>
|
||||
</span>
|
||||
</footer>
|
||||
</article>
|
||||
|
|
Loading…
Add table
Reference in a new issue