Univention Bugzilla – Attachment 7942 Details for
Bug 41374
Printermoderation fails on restricted printers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
41374.patch (text/plain), 2.58 KB, created by
Florian Best
on 2016-08-29 19:28:41 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2016-08-29 19:28:41 CEST
Size:
2.58 KB
patch
obsolete
>diff --git a/ucs-school-umc-printermoderation/umc/python/printermoderation/__init__.py b/ucs-school-umc-printermoderation/umc/python/printermoderation/__init__.py >index e3b62bd..78d9898 100644 >--- a/ucs-school-umc-printermoderation/umc/python/printermoderation/__init__.py >+++ b/ucs-school-umc-printermoderation/umc/python/printermoderation/__init__.py >@@ -39,7 +39,7 @@ import subprocess > > from univention.lib.i18n import Translation > >-from univention.management.console.modules import UMC_OptionTypeError, UMC_Error >+from univention.management.console.modules import UMC_Error > from univention.management.console.modules.decorators import simple_response, sanitize > from univention.management.console.modules.sanitizers import StringSanitizer > from univention.management.console.log import MODULE >@@ -85,7 +85,7 @@ class Instance(SchoolBaseModule): > username = username.replace('/', '') > path = os.path.join(CUPSPDF_DIR, username, CUPSPDF_USERSUBDIR, printjob) > if not os.path.realpath(path).startswith(os.path.realpath(CUPSPDF_DIR)): >- raise UMC_OptionTypeError('Invalid file') >+ raise UMC_Error('Invalid file') > return path > > def _get_all_username_variants(self, username): >@@ -164,7 +164,7 @@ class Instance(SchoolBaseModule): > path = self._get_path(request.options['username'], request.options['printjob']) > > if not os.path.exists(path): >- raise UMC_OptionTypeError('Invalid file') >+ raise UMC_Error('Invalid file') > > with open(path) as fd: > self.finished(request.id, fd.read(), mimetype='application/pdf') >@@ -217,13 +217,13 @@ class Instance(SchoolBaseModule): > try: > spoolhost, printer = printer.split('://', 1) > except ValueError: >- raise UMC_OptionTypeError('Invalid printer URI') >+ raise UMC_Error('Invalid printer URI') > > if spoolhost == self.fqdn: > spoolhost = None > > if not os.path.exists(path): >- raise UMC_Error('File %s doesnt exists' % path) >+ raise UMC_Error(_('File %r could not be printed as it does not exists (anymore).') % (printjob,)) > > MODULE.info('Deleting print job %r' % (path,)) > cmd = [ >@@ -240,7 +240,7 @@ class Instance(SchoolBaseModule): > path, > ] > if spoolhost: >- cmd.extend([ >+ cmd.extend([ > # spool host > '-H', spoolhost > ]) >@@ -249,7 +249,7 @@ class Instance(SchoolBaseModule): > lpr = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE) > (stdout, stderr) = lpr.communicate() > if lpr.returncode != 0: >- raise UMC_Error(_('Failed to print on %s: %s' % (printer, stderr))) >+ raise UMC_Error(_('Failed to print on %s: %s') % (printer, stderr)) > > return True >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 41374
: 7942 |
8053