Show
Ignore:
Timestamp:
10/02/04 07:48:56 (20 years ago)
Author:
jalet
Message:

Should now correctly deal with charsets both when storing into databases and when
retrieving datas. Works with both PostgreSQL and LDAP.

Files:
1 modified

Legend:

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

    r1757 r1761  
    2222# 
    2323# $Log$ 
     24# Revision 1.124  2004/10/02 05:48:56  jalet 
     25# Should now correctly deal with charsets both when storing into databases and when 
     26# retrieving datas. Works with both PostgreSQL and LDAP. 
     27# 
    2428# Revision 1.123  2004/09/29 20:20:52  jalet 
    2529# Added the winbind_separator directive to pykota.conf to allow the admin to 
     
    493497class PyKotaTool :     
    494498    """Base class for all PyKota command line tools.""" 
    495     def __init__(self, lang=None, doc="PyKota %s (c) 2003-2004 %s" % (version.__version__, version.__author__)) : 
     499    def __init__(self, lang=None, charset=None, doc="PyKota %s (c) 2003-2004 %s" % (version.__version__, version.__author__)) : 
    496500        """Initializes the command line tool.""" 
    497501        # locale stuff 
     
    501505        except (locale.Error, IOError) : 
    502506            gettext.NullTranslations().install() 
     507             
     508        # We can force the charset.     
     509        # The CHARSET environment variable is set by CUPS when printing. 
     510        # Else we use the current locale's one. 
     511        # If nothing is set, we use ISO-8859-15 widely used in western Europe. 
     512        self.charset = charset or os.environ.get("CHARSET") or locale.getlocale()[1] or locale.getdefaultlocale()[1] or "ISO-8859-15" 
    503513     
    504514        # pykota specific stuff 
     
    522532        self.softwareJobSize = 0 
    523533        self.softwareJobPrice = 0.0 
     534        self.logdebug("Charset in use : %s" % self.charset) 
     535         
     536    def getCharset(self) :     
     537        """Returns the charset in use.""" 
     538        return self.charset 
    524539         
    525540    def logdebug(self, message) :