Use enum instead of strings

This commit is contained in:
vas3k
2020-02-26 10:37:46 +01:00
parent 604ccd0444
commit 430dbdbf12

View File

@@ -3,17 +3,19 @@ from django.http import Http404
from parsing.exceptions import ParsingException
from parsing.telegram.telegram import get_channel
from parsing.telegram.models import MessageType
class TelegramChannelFeed(Feed):
FEED_ITEMS = 30
def get_object(self, request, channel):
limit = int(request.GET.get("size") or self.FEED_ITEMS)
only = str(request.GET.get("only") or "")
if only:
only = [item.strip() for item in only.split(",")]
only = [
MessageType.get(item.strip()) for item in only.split(",")
]
limit = 100 # dirty hack: artificially increase the limit to get more filtered messages
try: