import config
+quote_matcher = re.compile(config.quote_regexp, flags=re.UNICODE)
+quote_matcher_with_timestamp = re.compile(config.quote_regexp_with_timestamp, flags=re.UNICODE)
+
def get_now():
""" Renvoie la date actuelle """
return datetime.datetime(*time.localtime()[:6])
Indépendamment de la date. """
return [self.author, self.content] == [otherquote.author, otherquote.content]
-quote_matcher = re.compile(config.quote_regexp)
def parse(text, date=None):
""" Parse le ``text`` et renvoie une quote ou None. """
with open(dump_file) as f:
t = f.read()
t = t.decode("utf-8") # Oui, ça peut fail, mais on ne doit alors pas continuer
- regex = re.compile(config.quote_regexp_with_timestamp)
- l = [m.groupdict() for m in regex.finditer(t)]
+ l = [m.groupdict() for m in quote_matcher_with_timestamp.finditer(t)]
# On instancie les quotes grâce aux dicos qui ont déjà la bonne tronche
l = [Quote(**q) for q in l]
newquotedb = QuoteDB()