##// END OF EJS Templates
util: check for compression engine availability before returning...
Gregory Szorc -
r30438:90933e4e default
parent child Browse files
Show More
@@ -3021,15 +3021,27 b' class compressormanager(object):'
3021 """Obtain a compression engine registered to a bundle name.
3021 """Obtain a compression engine registered to a bundle name.
3022
3022
3023 Will raise KeyError if the bundle type isn't registered.
3023 Will raise KeyError if the bundle type isn't registered.
3024
3025 Will abort if the engine is known but not available.
3024 """
3026 """
3025 return self._engines[self._bundlenames[bundlename]]
3027 engine = self._engines[self._bundlenames[bundlename]]
3028 if not engine.available():
3029 raise error.Abort(_('compression engine %s could not be loaded') %
3030 engine.name())
3031 return engine
3026
3032
3027 def forbundletype(self, bundletype):
3033 def forbundletype(self, bundletype):
3028 """Obtain a compression engine registered to a bundle type.
3034 """Obtain a compression engine registered to a bundle type.
3029
3035
3030 Will raise KeyError if the bundle type isn't registered.
3036 Will raise KeyError if the bundle type isn't registered.
3037
3038 Will abort if the engine is known but not available.
3031 """
3039 """
3032 return self._engines[self._bundletypes[bundletype]]
3040 engine = self._engines[self._bundletypes[bundletype]]
3041 if not engine.available():
3042 raise error.Abort(_('compression engine %s could not be loaded') %
3043 engine.name())
3044 return engine
3033
3045
3034 compengines = compressormanager()
3046 compengines = compressormanager()
3035
3047
General Comments 0
You need to be logged in to leave comments. Login now