deluge/tests/common.py

29 lines
810 B
Python
Raw Normal View History

import tempfile
import deluge.configmanager
import deluge.log
2009-07-05 01:17:38 +00:00
deluge.log.setupLogger("none")
def set_tmp_config_dir():
config_directory = tempfile.mkdtemp()
deluge.configmanager.set_config_dir(config_directory)
return config_directory
2009-07-05 01:17:38 +00:00
import gettext
import locale
import pkg_resources
# Initialize gettext
try:
locale.setlocale(locale.LC_ALL, '')
if hasattr(locale, "bindtextdomain"):
locale.bindtextdomain("deluge", pkg_resources.resource_filename("deluge", "i18n"))
if hasattr(locale, "textdomain"):
locale.textdomain("deluge")
gettext.bindtextdomain("deluge", pkg_resources.resource_filename("deluge", "i18n"))
gettext.textdomain("deluge")
gettext.install("deluge", pkg_resources.resource_filename("deluge", "i18n"))
except Exception, e:
print e