forked from rDrama/rDrama
1
0
Fork 0

very minor dedup

master
Aevann 2023-03-22 00:12:28 +02:00
parent b5e3c5d728
commit 40b73fe048
3 changed files with 5 additions and 4 deletions

View File

@ -458,4 +458,4 @@ class Comment(Base):
@property
@lazy
def complies_with_chud(self):
return re.search(self.author.phrase_regex_pattern, self.body_html.lower())
return self.author.phrase_regex.search(self.body_html.lower())

View File

@ -363,4 +363,4 @@ class Submission(Base):
@property
@lazy
def complies_with_chud(self):
return re.search(self.author.phrase_regex_pattern, self.body_html.lower())
return self.author.phrase_regex.search(self.body_html.lower())

View File

@ -1,6 +1,7 @@
import random
from operator import *
from typing import Union
import re
import pyotp
from sqlalchemy import Column, ForeignKey
@ -1213,5 +1214,5 @@ class User(Base):
@property
@lazy
def phrase_regex_pattern(self):
return f"<p>[^<>]*{self.agendaposter_phrase}[^<>]*<\/p>"
def phrase_regex(self):
return re.compile(f"<p>[^<>]*{self.agendaposter_phrase}[^<>]*<\/p>")