From a368839123c36f5eb5a3d2e3487ee60e8664443b Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 5 Nov 2008 18:25:40 +0000 Subject: [PATCH] [thorstenp] import rst generator only when needed. see #4457 --- src/chat_control.py | 2 +- src/common/connection.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 635e808d8..e5021bde8 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -48,7 +48,6 @@ from message_textview import MessageTextView from common.contacts import GC_Contact from common.logger import Constants constants = Constants() -from common.rst_xhtml_generator import create_xhtml from common.pep import MOODS, ACTIVITIES from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS from common.xmpp.protocol import NS_ESESSION @@ -1872,6 +1871,7 @@ class ChatControl(ChatControlBase): name = gajim.nicks[self.account] if not xhtml and not encrypted and gajim.config.get( 'rst_formatting_outgoing_messages'): + from common.rst_xhtml_generator import create_xhtml xhtml = create_xhtml(text) if xhtml: xhtml = '%s' % (NS_XHTML, xhtml) diff --git a/src/common/connection.py b/src/common/connection.py index b3d16dca2..598024ae0 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -58,8 +58,6 @@ from common import exceptions from connection_handlers import * -from common.rst_xhtml_generator import create_xhtml - from string import Template import logging log = logging.getLogger('gajim.c.connection') @@ -1078,6 +1076,7 @@ class Connection(ConnectionHandlers): if not self.connection: return 1 if msg and not xhtml and gajim.config.get('rst_formatting_outgoing_messages'): + from common.rst_xhtml_generator import create_xhtml xhtml = create_xhtml(msg) if not msg and chatstate is None and form_node is None: return 2 @@ -1113,6 +1112,7 @@ class Connection(ConnectionHandlers): if msgtxt and not xhtml and gajim.config.get( 'rst_formatting_outgoing_messages'): # Generate a XHTML part using reStructured text markup + from common.rst_xhtml_generator import create_xhtml xhtml = create_xhtml(msgtxt) if type_ == 'chat': msg_iq = common.xmpp.Message(to = fjid, body = msgtxt, typ = type_, @@ -1558,6 +1558,7 @@ class Connection(ConnectionHandlers): if not self.connection: return if not xhtml and gajim.config.get('rst_formatting_outgoing_messages'): + from common.rst_xhtml_generator import create_xhtml xhtml = create_xhtml(msg) msg_iq = common.xmpp.Message(jid, msg, typ = 'groupchat', xhtml = xhtml) self.connection.send(msg_iq)