Revision 695, 1.2 kB
(checked in by jalet, 22 years ago)
|
Initial import into CVS
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
Rev | Line | |
---|
[695] | 1 | # PyKota |
---|
| 2 | # |
---|
| 3 | # PyKota : Print Quotas for CUPS |
---|
| 4 | # |
---|
| 5 | # (c) 2003 Jerome Alet <alet@librelogiciel.com> |
---|
| 6 | # You're welcome to redistribute this software under the |
---|
| 7 | # terms of the GNU General Public Licence version 2.0 |
---|
| 8 | # or, at your option, any higher version. |
---|
| 9 | # |
---|
| 10 | # You can read the complete GNU GPL in the file COPYING |
---|
| 11 | # which should come along with this software, or visit |
---|
| 12 | # the Free Software Foundation's WEB site http://www.fsf.org |
---|
| 13 | # |
---|
| 14 | # $Id$ |
---|
| 15 | # |
---|
| 16 | # $Log$ |
---|
| 17 | # Revision 1.1 2003/02/05 21:28:17 jalet |
---|
| 18 | # Initial import into CVS |
---|
| 19 | # |
---|
| 20 | # |
---|
| 21 | # |
---|
| 22 | |
---|
| 23 | class PyKotaRequesterError(Exception): |
---|
| 24 | """An exception for Requester related stuff.""" |
---|
| 25 | def __init__(self, message = ""): |
---|
| 26 | self.message = message |
---|
| 27 | Exception.__init__(self, message) |
---|
| 28 | def __repr__(self): |
---|
| 29 | return self.message |
---|
| 30 | __str__ = __repr__ |
---|
| 31 | |
---|
| 32 | def openRequester(config, printername) : |
---|
| 33 | """Returns a connection handle to the appropriate requester.""" |
---|
| 34 | backend = config.getRequesterBackend(printername) |
---|
| 35 | try : |
---|
| 36 | module = __import__("pykota.requesters." + backend.lower()) |
---|
| 37 | except ImportError : |
---|
| 38 | raise PyKotaRequesterError, "Unsupported requester backend %s" % backend |
---|
| 39 | else : |
---|
| 40 | return getattr(module, "Requester")(config, printername) |
---|