View | Details | Raw Unified | Return to bug 41374 | Differences between
and this patch

Collapse All | Expand All

(-)a/ucs-school-umc-printermoderation/umc/python/printermoderation/__init__.py (-3 / +8 lines)
 Lines 231-237   class Instance(SchoolBaseModule): Link Here 
231
			raise UMC_Error(_('Invalid printer URI'))
231
			raise UMC_Error(_('Invalid printer URI'))
232
232
233
		if not os.path.exists(path):
233
		if not os.path.exists(path):
234
				raise UMC_Error(_('File %r could not be printed as it does not exists (anymore).') % (printjob,))
234
			raise UMC_Error(_('File %r could not be printed as it does not exists (anymore).') % (printjob,))
235
235
236
		MODULE.process('Printing: %s' % path)
236
		MODULE.process('Printing: %s' % path)
237
		self.pw_callback_bad_password = False
237
		self.pw_callback_bad_password = False
 Lines 243-250   class Instance(SchoolBaseModule): Link Here 
243
			conn.printFile(printer, path, Printjob.filename2label(printjob), {})
243
			conn.printFile(printer, path, Printjob.filename2label(printjob), {})
244
		except RuntimeError:
244
		except RuntimeError:
245
			raise UMC_Error(_('Failed to connect to print server %(printserver)s.') % {'printserver': spoolhost})
245
			raise UMC_Error(_('Failed to connect to print server %(printserver)s.') % {'printserver': spoolhost})
246
		except cups.IPPError as e:
246
		except cups.IPPError as (errno, description):
247
			raise UMC_Error(_('Failed to print on %(printer)s: %(stderr)s') % {'printer': printer, 'stderr': e})
247
			IPP_AUTHENTICATION_CANCELED = 4096
248
			description = {
249
				cups.IPP_NOT_AUTHORIZED: _('No permission to print'),
250
				IPP_AUTHENTICATION_CANCELED: _('Wrong password'),
251
			}.get(errno, description)
252
			raise UMC_Error(_('Failed to print on %(printer)s: %(stderr)s (error %(errno)d).') % {'printer': printer, 'stderr': description, 'errno': errno})
248
253
249
		# delete file
254
		# delete file
250
		MODULE.info('Deleting print job %r' % (path,))
255
		MODULE.info('Deleting print job %r' % (path,))

Return to bug 41374