Changeset 773

Show
Ignore:
Timestamp:
02/09/03 14:05:43 (22 years ago)
Author:
jalet
Message:

Internationalization continues...

Location:
pykota/trunk/pykota
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/config.py

    r747 r773  
    1515# 
    1616# $Log$ 
     17# Revision 1.7  2003/02/09 13:05:43  jalet 
     18# Internationalization continues... 
     19# 
    1720# Revision 1.6  2003/02/07 22:00:09  jalet 
    1821# Bad cut&paste 
     
    7174                        "smtpserver", "method", "gracedelay" ] : 
    7275            if not self.config.has_option("global", option) :             
    73                 raise PyKotaConfigError, "Option %s not found in section global of %s" % (option, self.filename) 
     76                raise PyKotaConfigError, _("Option %s not found in section global of %s") % (option, self.filename) 
    7477                 
    7578        # more precise checks         
    7679        validloggers = [ "stderr", "system" ]  
    7780        if self.config.get("global", "logger").lower() not in validloggers :              
    78             raise PyKotaConfigError, "Option logger only supports values in %s" % str(validloggers) 
     81            raise PyKotaConfigError, _("Option logger only supports values in %s") % str(validloggers) 
    7982             
    8083        validmethods = [ "lazy" ] # TODO add more methods             
    8184        if self.config.get("global", "method").lower() not in validmethods :              
    82             raise PyKotaConfigError, "Option method only supports values in %s" % str(validmethods) 
     85            raise PyKotaConfigError, _("Option method only supports values in %s") % str(validmethods) 
    8386             
    8487        # check all printers now  
     
    8689            for poption in [ "requester", "policy" ] :  
    8790                if not self.config.has_option(printer, poption) : 
    88                     raise PyKotaConfigError, "Option %s not found in section %s of %s" % (option, printer, self.filename) 
     91                    raise PyKotaConfigError, _("Option %s not found in section %s of %s") % (option, printer, self.filename) 
    8992                     
    9093            validpolicies = [ "ALLOW", "DENY" ]      
    9194            if self.config.get(printer, "policy").upper() not in validpolicies : 
    92                 raise PyKotaConfigError, "Option policy in section %s only supports values in %s" % (printer, str(validpolicies)) 
     95                raise PyKotaConfigError, _("Option policy in section %s only supports values in %s") % (printer, str(validpolicies)) 
    9396             
    9497            validrequesters = [ "snmp" ] # TODO : add more requesters 
    9598            requester = self.config.get(printer, "requester").lower() 
    9699            if requester not in validrequesters : 
    97                 raise PyKotaConfigError, "Option requester in section %s only supports values in %s" % (printer, str(validrequesters)) 
     100                raise PyKotaConfigError, _("Option requester in section %s only supports values in %s") % (printer, str(validrequesters)) 
    98101            if requester == "snmp" : 
    99102                for poption in [ "snmpcmnty", "snmpoid" ] :  
    100103                    if not self.config.has_option(printer, poption) : 
    101                         raise PyKotaConfigError, "Option %s not found in section %s of %s" % (option, printer, self.filename) 
     104                        raise PyKotaConfigError, _("Option %s not found in section %s of %s") % (option, printer, self.filename) 
    102105                         
    103106    def getPrinterNames(self) :     
     
    150153            return int(gd) 
    151154        except ValueError :     
    152             raise PyKotaConfigError, "Invalid grace delay %s" % gd 
     155            raise PyKotaConfigError, _("Invalid grace delay %s") % gd 
  • pykota/trunk/pykota/logger.py

    r698 r773  
    1515# 
    1616# $Log$ 
     17# Revision 1.4  2003/02/09 13:05:43  jalet 
     18# Internationalization continues... 
     19# 
    1720# Revision 1.3  2003/02/05 22:10:29  jalet 
    1821# Typos 
     
    4750        exec "from pykota.loggers import %s as loggingbackend" % backend.lower()     
    4851    except ImportError : 
    49         raise PyKotaLoggingError, "Unsupported logging subsystem %s" % backend 
     52        raise PyKotaLoggingError, _("Unsupported logging subsystem %s") % backend 
    5053    else :     
    5154        return getattr(loggingbackend, "Logger")() 
  • pykota/trunk/pykota/requester.py

    r698 r773  
    1515# 
    1616# $Log$ 
     17# Revision 1.4  2003/02/09 13:05:43  jalet 
     18# Internationalization continues... 
     19# 
    1720# Revision 1.3  2003/02/05 22:10:29  jalet 
    1821# Typos 
     
    4548        exec "from pykota.requesters import %s as requesterbackend" % backend.lower()     
    4649    except ImportError : 
    47         raise PyKotaRequesterError, "Unsupported requester backend %s" % backend 
     50        raise PyKotaRequesterError, _("Unsupported requester backend %s") % backend 
    4851    else :     
    4952        return getattr(requesterbackend, "Requester")(config, printername) 
  • pykota/trunk/pykota/requesters/external.py

    r745 r773  
    1515# 
    1616# $Log$ 
     17# Revision 1.2  2003/02/09 13:05:43  jalet 
     18# Internationalization continues... 
     19# 
    1720# Revision 1.1  2003/02/07 13:15:01  jalet 
    1821# External requester skeleton added. 
     
    2932        """Sets instance vars depending on the current printer.""" 
    3033        self.printername = printername 
    31         raise PyKotaRequesterError, "Requester not implemented yet." 
     34        raise PyKotaRequesterError, _("Requester not implemented yet.") 
    3235         
    3336    def getPrinterPageCounter(self, hostname) : 
     
    3639           Currently uses the snmpget external command. TODO : do it internally  
    3740        """ 
    38         raise PyKotaRequesterError, "Requester not implemented yet." 
     41        raise PyKotaRequesterError, _("Requester not implemented yet.") 
    3942         
  • pykota/trunk/pykota/requesters/snmp.py

    r744 r773  
    1515# 
    1616# $Log$ 
     17# Revision 1.4  2003/02/09 13:05:43  jalet 
     18# Internationalization continues... 
     19# 
    1720# Revision 1.3  2003/02/07 13:12:41  jalet 
    1821# Bad old comment 
     
    4548        """ 
    4649        if hostname is None : 
    47             raise PyKotaRequesterError, "Unknown printer address in SNMP(%s, %s) for printer %s" % (self.community, self.oid, self.printername) 
     50            raise PyKotaRequesterError, _("Unknown printer address in SNMP(%s, %s) for printer %s") % (self.community, self.oid, self.printername) 
    4851        answer = os.popen("snmpget -c %s -Ov %s %s" % (self.community, hostname, self.oid)) 
    4952        try : 
    5053            pagecounter = int(answer.readline().split()[-1].strip()) 
    5154        except IndexError :     
    52             raise PyKotaRequesterError, "Unable to query printer %s via SNMP(%s, %s)" % (hostname, self.community, self.oid)  
     55            raise PyKotaRequesterError, _("Unable to query printer %s via SNMP(%s, %s)") % (hostname, self.community, self.oid)  
    5356        answer.close() 
    5457        return pagecounter 
  • pykota/trunk/pykota/storage.py

    r768 r773  
    1515# 
    1616# $Log$ 
     17# Revision 1.6  2003/02/09 13:05:43  jalet 
     18# Internationalization continues... 
     19# 
    1720# Revision 1.5  2003/02/08 22:39:46  jalet 
    1821# --reset command line option added 
     
    109112        exec "from pykota.storages import %s as storagebackend" % backend.lower()     
    110113    except ImportError : 
    111         raise PyKotaStorageError, "Unsupported quota storage backend %s" % backend 
     114        raise PyKotaStorageError, _("Unsupported quota storage backend %s") % backend 
    112115    else :     
    113116        return getattr(storagebackend, "Storage")(host, database, (asadmin and admin) or user) 
  • pykota/trunk/pykota/tool.py

    r772 r773  
    1515# 
    1616# $Log$ 
     17# Revision 1.17  2003/02/09 13:05:43  jalet 
     18# Internationalization continues... 
     19# 
    1720# Revision 1.16  2003/02/09 12:56:53  jalet 
    1821# Internationalization begins... 
     
    200203    def sendMessageToUser(self, username, subject, message) : 
    201204        """Sends an email message to a user.""" 
    202         message += "\n\nPlease contact your system administrator :\n\n\t%s - <%s>\n" % (self.admin, self.adminmail) 
     205        message += _("\n\nPlease contact your system administrator :\n\n\t%s - <%s>\n") % (self.admin, self.adminmail) 
    203206        self.sendMessage(username, "Subject: %s\n\n%s" % (subject, message)) 
    204207         
     
    217220            else :     
    218221                action = "DENY" 
    219             self.logger.log_message("Unable to match user %s on printer %s, applying default policy (%s)" % (username, printername, action), "warn") 
     222            self.logger.log_message(_("Unable to match user %s on printer %s, applying default policy (%s)") % (username, printername, action), "warn") 
    220223            return (action, None, None) 
    221224        else :     
     
    250253        """Checks a user quota and send him a message if quota is exceeded on current printer.""" 
    251254        pname = printername or self.printername 
    252         raise PyKotaToolError, "Group quotas are currently not implemented." 
     255        raise PyKotaToolError, _("Group quotas are currently not implemented.") 
    253256         
    254257    def warnUserPQuota(self, username, printername=None) : 
     
    259262            if (grace is not None) and (gracedate is not None) : 
    260263                # only when both user and printer are known 
    261                 adminmessage = "Print Quota exceeded for user %s on printer %s" % (username, pname) 
     264                adminmessage = _("Print Quota exceeded for user %s on printer %s") % (username, pname) 
    262265                self.logger.log_message(adminmessage) 
    263                 self.sendMessageToUser(username, "Print Quota Exceeded", "You are not allowed to print anymore because\nyour Print Quota is exceeded on printer %s." % pname) 
     266                self.sendMessageToUser(username, _("Print Quota Exceeded"), _("You are not allowed to print anymore because\nyour Print Quota is exceeded on printer %s.") % pname) 
    264267                self.sendMessageToAdmin("Print Quota", adminmessage) 
    265268        elif action == "WARN" :     
    266             adminmessage = "Print Quota soft limit exceeded for user %s on printer %s" % (username, pname) 
     269            adminmessage = _("Print Quota soft limit exceeded for user %s on printer %s") % (username, pname) 
    267270            self.logger.log_message(adminmessage) 
    268             self.sendMessageToUser(username, "Print Quota Exceeded", "You will soon be forbidden to print anymore because\nyour Print Quota is almost reached on printer %s." % pname) 
    269             self.sendMessageToAdmin("Print Quota", adminmessage) 
     271            self.sendMessageToUser(username, _("Print Quota Exceeded"), _("You will soon be forbidden to print anymore because\nyour Print Quota is almost reached on printer %s.") % pname) 
     272            self.sendMessageToAdmin(_("Print Quota"), adminmessage) 
    270273        return action         
    271274