[yum-cvs] yum/yum plugins.py,1.36,1.37

Jeremy Katz katzj at linux.duke.edu
Wed Mar 28 15:59:48 UTC 2007


Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv16688/yum

Modified Files:
	plugins.py 
Log Message:
allow YumPluginExit to have a translation domain set so that we can
get a localized error message


Index: plugins.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/plugins.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- plugins.py	22 Feb 2007 22:43:09 -0000	1.36
+++ plugins.py	28 Mar 2007 15:59:46 -0000	1.37
@@ -18,6 +18,7 @@
 import imp
 import warnings
 import atexit
+import gettext
 import logging
 import logginglevels
 from constants import *
@@ -89,7 +90,15 @@
 class PluginYumExit(Exception):
     '''Used by plugins to signal that yum should stop
     '''
-
+    def __init__(self, value="", translation_domain=""):
+        self.value = value
+        self.translation_domain = translation_domain
+    def __str__(self):
+        if self.translation_domain:
+            return gettext.dgettext(self.translation_domain, self.value)
+        else:
+            return self.value
+    
 class YumPlugins:
     '''
     Manager class for Yum plugins.




More information about the Yum-cvs-commits mailing list