Browse Source

catch importerrors in case the library is being used outside MD

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

7
pyweb/mumble/MumbleCtlIce.py

@ -41,13 +41,18 @@ def loadSlice( slicefile ):
# Ice returns '' in getSliceDir() sometimes. (I kid you not.) # Ice returns '' in getSliceDir() sometimes. (I kid you not.)
if not icepath: if not icepath:
try:
from django.conf import settings from django.conf import settings
except ImportError:
# CTL is being used independently from MD
icepath = None
else:
icepath = settings.SLICEDIR icepath = settings.SLICEDIR
if not exists( join( icepath, "Ice", "SliceChecksumDict.ice" ) ): if not exists( join( icepath, "Ice", "SliceChecksumDict.ice" ) ):
icepath = None icepath = None
if not icepath: 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 ) Ice.loadSlice( slicefile )
else: else:
Ice.loadSlice( '', ['-I' + icepath, slicefile ] ) Ice.loadSlice( '', ['-I' + icepath, slicefile ] )

Loading…
Cancel
Save