[impression_canon] fix + proprete
darcs-hash:20091102143816-bd074-e37ecdb9ef922b7adefa034db3ab1e9c356f45cb.gz
This commit is contained in:
parent
d1c0935c1b
commit
b639d90a11
1 changed files with 13 additions and 9 deletions
|
@ -28,20 +28,19 @@
|
||||||
Classe pour gérer l'envoie de pdf à l'imprimante.
|
Classe pour gérer l'envoie de pdf à l'imprimante.
|
||||||
Calcule le coût des options d'impression.
|
Calcule le coût des options d'impression.
|
||||||
"""
|
"""
|
||||||
__version__ = '1'
|
__version__ = '9.11'
|
||||||
|
|
||||||
import sys, syslog, os.path, time
|
import sys, os.path
|
||||||
sys.path.append('/usr/scripts/gestion')
|
sys.path.append('/usr/scripts/gestion')
|
||||||
from config import impression as config_impression
|
from config import impression as config_impression
|
||||||
from commands import getstatusoutput
|
from commands import getstatusoutput
|
||||||
from crans.utils import QuoteForPOSIX as escapeForShell
|
|
||||||
import crans.utils.logs
|
import crans.utils.logs
|
||||||
|
|
||||||
# ######################################################## #
|
# ######################################################## #
|
||||||
# CONSTANTES #
|
# CONSTANTES #
|
||||||
# ######################################################## #
|
# ######################################################## #
|
||||||
|
|
||||||
FICHIER_LOG="/var/log/log_couts/impressions"
|
FICHIER_LOG = "/var/log/log_couts/impressions"
|
||||||
|
|
||||||
SNMP_CAPA_B = "mib-2.43.11.1.1.8.1.1"
|
SNMP_CAPA_B = "mib-2.43.11.1.1.8.1.1"
|
||||||
SNMP_CAPA_C = "mib-2.43.11.1.1.8.1.2"
|
SNMP_CAPA_C = "mib-2.43.11.1.1.8.1.2"
|
||||||
|
@ -370,12 +369,11 @@ class impression:
|
||||||
c_total = int(self._settings['copies'] * ( c_impression +
|
c_total = int(self._settings['copies'] * ( c_impression +
|
||||||
c_agrafes ) + 0.5) # arrondi et facture
|
c_agrafes ) + 0.5) # arrondi et facture
|
||||||
|
|
||||||
self._prix= float(c_total)/100
|
self._prix = float(c_total)/100
|
||||||
return self._prix
|
return self._prix
|
||||||
|
|
||||||
def _get_adh(self, adh):
|
def _get_adh(self, adh):
|
||||||
if type(adh) == str:
|
if type(adh) == str:
|
||||||
import sys
|
|
||||||
sys.path.append("/usr/scripts/gestion/")
|
sys.path.append("/usr/scripts/gestion/")
|
||||||
#from ldap_crans_test import crans_ldap
|
#from ldap_crans_test import crans_ldap
|
||||||
from ldap_crans import CransLdap
|
from ldap_crans import CransLdap
|
||||||
|
@ -457,15 +455,21 @@ class impression:
|
||||||
if not self._settings['livret'] and self._settings['agrafage'] in ['None', None]:
|
if not self._settings['livret'] and self._settings['agrafage'] in ['None', None]:
|
||||||
left = self._settings['copies']
|
left = self._settings['copies']
|
||||||
while left >= 100:
|
while left >= 100:
|
||||||
"lpr %s -# %d %s" % (options, 99, self._fichier)
|
cmd = "lpr %s -# %d %s" % (options, 99, self._fichier)
|
||||||
left -= 99
|
left -= 99
|
||||||
|
(status, rep) = getstatusoutput(cmd)
|
||||||
|
self.log.info("printing: %s" % cmd)
|
||||||
|
if status != 0:
|
||||||
|
self.log.error("erreur impression")
|
||||||
|
self.log.error("lpr status:%d | rep: %s" % (status, rep))
|
||||||
|
raise PrintError, "%s \n status:%d rep: %s" % (cmd, status, rep)
|
||||||
cmd = "lpr %s -# %d %s" % (options, left, self._fichier)
|
cmd = "lpr %s -# %d %s" % (options, left, self._fichier)
|
||||||
(status, rep) = getstatusoutput(cmd)
|
(status, rep) = getstatusoutput(cmd)
|
||||||
self.log.info("printing: %s" % cmd)
|
self.log.info("printing: %s" % cmd)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
self.log.error("erreur impression")
|
self.log.error("erreur impression")
|
||||||
self.log.error("lpr status:%d | rep: %s" % (status, rep))
|
self.log.error("lpr status:%d | rep: %s" % (status, rep))
|
||||||
raise PrintError, "%s \n status:%d rep: %s" % (cmp, status, rep)
|
raise PrintError, "%s \n status:%d rep: %s" % (cmd, status, rep)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
cmd = "lpr %s %s" % (options, self._fichier)
|
cmd = "lpr %s %s" % (options, self._fichier)
|
||||||
|
@ -475,4 +479,4 @@ class impression:
|
||||||
if status != 0:
|
if status != 0:
|
||||||
self.log.error("erreur impression")
|
self.log.error("erreur impression")
|
||||||
self.log.error("lpr status:%d | rep: %s" % (status, rep))
|
self.log.error("lpr status:%d | rep: %s" % (status, rep))
|
||||||
raise PrintError, "%s \n status:%d rep: %s" % (cmp, status, rep)
|
raise PrintError, "%s \n status:%d rep: %s" % (cmd, status, rep)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue