##// END OF EJS Templates
Strip html tags from the fetched sources description
neko259 -
r1977:7b889029 default
parent child Browse files
Show More
@@ -9,6 +9,7 b' from django.db import models, transactio'
9 from django.utils.dateparse import parse_datetime
9 from django.utils.dateparse import parse_datetime
10 from django.utils.timezone import utc
10 from django.utils.timezone import utc
11 from django.utils import timezone
11 from django.utils import timezone
12 from django.utils.html import strip_tags
12
13
13 from boards.models import Post
14 from boards.models import Post
14 from boards.models.post import TITLE_MAX_LENGTH
15 from boards.models.post import TITLE_MAX_LENGTH
@@ -64,7 +65,7 b' class ThreadSource(models.Model):'
64 if timestamp > last_timestamp:
65 if timestamp > last_timestamp:
65 last_timestamp = timestamp
66 last_timestamp = timestamp
66 if timestamp > start_timestamp:
67 if timestamp > start_timestamp:
67 Post.objects.create_post(title=title, text=item.description,
68 Post.objects.create_post(title=title, text=self.parse_text(item.description),
68 thread=self.thread, file_urls=[item.link], tripcode=tripcode)
69 thread=self.thread, file_urls=[item.link], tripcode=tripcode)
69 logger.info('Fetched item {} from {} into thread {}'.format(
70 logger.info('Fetched item {} from {} into thread {}'.format(
70 title, self.name, self.thread))
71 title, self.name, self.thread))
@@ -72,3 +73,5 b' class ThreadSource(models.Model):'
72 self.timestamp = last_timestamp
73 self.timestamp = last_timestamp
73 self.save(update_fields=['timestamp'])
74 self.save(update_fields=['timestamp'])
74
75
76 def parse_text(self, text):
77 return strip_tags(text)
General Comments 0
You need to be logged in to leave comments. Login now