Changeset 1761 for pykota/trunk/pykota/tool.py
- Timestamp:
- 10/02/04 07:48:56 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/tool.py
r1757 r1761 22 22 # 23 23 # $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 # 24 28 # Revision 1.123 2004/09/29 20:20:52 jalet 25 29 # Added the winbind_separator directive to pykota.conf to allow the admin to … … 493 497 class PyKotaTool : 494 498 """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__)) : 496 500 """Initializes the command line tool.""" 497 501 # locale stuff … … 501 505 except (locale.Error, IOError) : 502 506 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" 503 513 504 514 # pykota specific stuff … … 522 532 self.softwareJobSize = 0 523 533 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 524 539 525 540 def logdebug(self, message) :