From 92fd130c43cdd9e4c3ae030bbd56faa1a5b90553 Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Thu, 11 Feb 2010 17:59:15 +0100 Subject: [PATCH] only load the slice if the Murmur module cannot be imported (e.g., it has not already been loaded) --- pyweb/mumble/MumbleCtlIce.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/pyweb/mumble/MumbleCtlIce.py b/pyweb/mumble/MumbleCtlIce.py index 1aa420b..ab205ab 100644 --- a/pyweb/mumble/MumbleCtlIce.py +++ b/pyweb/mumble/MumbleCtlIce.py @@ -55,22 +55,27 @@ def MumbleCtlIce( connstring ): Murmur version matches the slice Version. """ - if not settings.SLICE: - raise EnvironmentError( "You didn't configure a slice file. Please set the SLICE variable in settings.py." ) - - if not exists( settings.SLICE ): - raise EnvironmentError( "The slice file does not exist: '%s' - please check the settings." % settings.SLICE ) - - if " " in settings.SLICE: - raise EnvironmentError( "You have a space char in your Slice path. This will confuse Ice, please check." ) - - if not settings.SLICE.endswith( ".ice" ): - raise EnvironmentError( "The slice file name MUST end with '.ice'." ) - - Ice.loadSlice( settings.SLICE ) - ice = Ice.initialize() + try: + import Murmur - import Murmur + except ImportError: + print "Loading Slice!" + if not settings.SLICE: + raise EnvironmentError( "You didn't configure a slice file. Please set the SLICE variable in settings.py." ) + + if not exists( settings.SLICE ): + raise EnvironmentError( "The slice file does not exist: '%s' - please check the settings." % settings.SLICE ) + + if " " in settings.SLICE: + raise EnvironmentError( "You have a space char in your Slice path. This will confuse Ice, please check." ) + + if not settings.SLICE.endswith( ".ice" ): + raise EnvironmentError( "The slice file name MUST end with '.ice'." ) + + Ice.loadSlice( settings.SLICE ) + ice = Ice.initialize() + + import Murmur prx = ice.stringToProxy( connstring.encode("utf-8") ) meta = Murmur.MetaPrx.checkedCast(prx)