[kupfer] Define a dummy gettext function in kupfer.obj.base if needed
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] Define a dummy gettext function in kupfer.obj.base if needed
- Date: Thu, 11 Feb 2010 00:01:23 +0000 (UTC)
commit 8e42b8f86f3ef3cd12f569f7ffcf992142e75479
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Feb 10 23:46:38 2010 +0100
Define a dummy gettext function in kupfer.obj.base if needed
If the kupfer.obj.base module is loaded without us having a gettext
function installed, we install a dummy function at this point. This
makes sure all core object code can be tested properly (without
localization of course).
kupfer/obj/base.py | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/obj/base.py b/kupfer/obj/base.py
index 80b2df3..411438d 100644
--- a/kupfer/obj/base.py
+++ b/kupfer/obj/base.py
@@ -8,6 +8,13 @@ __all__ = [
"InvalidDataError", "KupferObject", "Leaf", "Action", "Source", "TextSource"
]
+# If no gettext function is loaded at this point, we load a substitute,
+# so that testing code can still work
+import __builtin__
+if not hasattr(__builtin__, "_"):
+ def identity(x): x
+ __builtin__._ = identity
+
class Error (Exception):
pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]