blacklisted_masks = [("Flo!*@*", [])]
#: Regexp utilisée pour parser des quotes
-quote_regexp = ur"""\s*("|«|')\s*(?P<content>.*?)\s*("|»|') ?~ ?(?P<author>.*)"""
+quote_regexp = ur"""\s*("|«|')\s*(?P<content>.*?)\s*("|»|') ?~ ?(?P<author>.*?)\s*$"""
#: Template pour afficher une quote
quote_template = u"« %(content)s » ~ %(author)s"
self.last_perdu = 0
self.quotedb = quotes.QuoteDB()
- self.quotedb.load()
+ self.reload_quotes()
+
### Utilitaires
def _getnick(self):
quit_message = random.choice(config.quit_messages)
self.die(msg=quit_message.encode("utf8"))
+ def reload_quotes(self):
+ """ Recharge la base de données des quotes et recompile la regexp de quote """
+ self.quotedb.load()
+ self.quote_pattern = re.compile(config.quote_regexp, flags=re.UNICODE)
+
def execute_reload(self, auteur=None):
"""Recharge la config."""
reload(config)
- self.quotedb.load()
+ self.reload_quotes()
if auteur in [None, "SIGHUP"]:
towrite = "Config reloaded" + " (SIGHUP received)" * (auteur == "SIGHUP")
for to in config.report_bugs_to: