comparison src/memory/persistent.py @ 993:301b342c697a

core: use of the new core.log module: /!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
author Goffi <goffi@goffi.org>
date Sat, 19 Apr 2014 19:19:19 +0200
parents 8f8bdd31375a
children f6182f6418ea
comparison
equal deleted inserted replaced
992:f51a1895275c 993:301b342c697a
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from sat.core.i18n import _ 20 from sat.core.i18n import _
21 from logging import debug, info, warning, error 21 from sat.core.log import getLogger
22 log = getLogger(__name__)
22 23
23 24
24 class MemoryNotInitializedError(Exception): 25 class MemoryNotInitializedError(Exception):
25 pass 26 pass
26 27
33 34
34 def __init__(self, namespace, profile=None): 35 def __init__(self, namespace, profile=None):
35 """@param namespace: unique namespace for this dictionary 36 """@param namespace: unique namespace for this dictionary
36 @param profile: profile which *MUST* exists, or None for general values""" 37 @param profile: profile which *MUST* exists, or None for general values"""
37 if not self.storage: 38 if not self.storage:
38 error(_("PersistentDict can't be used before memory initialisation")) 39 log.error(_("PersistentDict can't be used before memory initialisation"))
39 raise MemoryNotInitializedError 40 raise MemoryNotInitializedError
40 self._cache = {} 41 self._cache = {}
41 self.namespace = namespace 42 self.namespace = namespace
42 self.profile = profile 43 self.profile = profile
43 44