Browse Source

catch importerrors in case the library is being used outside MD

Natenom/support-murmur-13-1446181288462
Michael Ziegler 13 years ago
parent
commit
c1cb16da0a
  1. 13
      pyweb/mumble/MumbleCtlIce.py

13
pyweb/mumble/MumbleCtlIce.py

@ -41,13 +41,18 @@ def loadSlice( slicefile ):
# Ice returns '' in getSliceDir() sometimes. (I kid you not.)
if not icepath:
from django.conf import settings
icepath = settings.SLICEDIR
if not exists( join( icepath, "Ice", "SliceChecksumDict.ice" ) ):
try:
from django.conf import settings
except ImportError:
# CTL is being used independently from MD
icepath = None
else:
icepath = settings.SLICEDIR
if not exists( join( icepath, "Ice", "SliceChecksumDict.ice" ) ):
icepath = None
if not icepath:
# last resort when getSliceDir fails AND settings are wrong, won't work for >=1.2.3
# last resort when getSliceDir fails AND settings are wrong/unavailable, won't work for >=1.2.3
Ice.loadSlice( slicefile )
else:
Ice.loadSlice( '', ['-I' + icepath, slicefile ] )

Loading…
Cancel
Save