Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        Module.__init__(self, *args, **kwargs)

        def pandoc_formatter(text):
            return Popen(
                ["pandoc", "-f", "markdown", "-t", "html", "--mathml", "-"],
                stdin=PIPE,
                stdout=PIPE).communicate(
                    text.encode('utf-8'))[0].decode('utf-8')

        try:
            from markdown import Markdown
        except ImportError:
            Markdown = None

        self.default_flags = Message.IS_HTML
        try:
            Popen(["pandoc", "-v"], stdout=PIPE, stderr=PIPE).communicate()
            self.formatter = pandoc_formatter
        except OSError:
            if Markdown:
                self.formatter = Markdown().convert
            else:
                self.formatter = (lambda text: text)
                self.default_flags = 0
Exemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        Module.__init__(self, *args, **kwargs)

        def pandoc_formatter(text):
            return Popen(["pandoc", "-f", "markdown", "-t", "html", "--mathml", "-"],
                    stdin=PIPE, stdout=PIPE).communicate(text.encode('utf-8'))[0].decode('utf-8')

        try:
            from markdown import Markdown
        except ImportError:
            Markdown = None

        self.default_flags = Message.IS_HTML
        try:
            Popen(["pandoc", "-v"], stdout=PIPE, stderr=PIPE).communicate()
            self.formatter = pandoc_formatter
        except OSError:
            if Markdown:
                self.formatter = Markdown().convert
            else:
                self.formatter = (lambda text: text)
                self.default_flags = 0
Exemplo n.º 3
0
 def __init__(self, *args, **kwargs):
     Module.__init__(self, *args, **kwargs)
     self._threads = None
     self._threads_age = datetime.utcnow()
Exemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     Module.__init__(self, *args, **kwargs)
     self._threads = None
     self._threads_age = datetime.utcnow()
Exemplo n.º 5
0
 def __init__(self, *args, **kwargs):
     Module.__init__(self, *args, **kwargs)
     if self.config['antispam'].get():
         self.antispam = AntiSpam()
     else:
         self.antispam = None
Exemplo n.º 6
0
 def __init__(self, *args, **kwargs):
     Module.__init__(self, *args, **kwargs)
     if self.config['antispam'].get():
         self.antispam = AntiSpam()
     else:
         self.antispam = None