Univention Bugzilla – Attachment 7617 Details for
Bug 33792
UMC printer quota: displaying the quota takes very long if there are many users
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
suggestions
33792.patch (text/plain), 5.73 KB, created by
Florian Best
on 2016-04-26 08:37:52 CEST
(
hide
)
Description:
suggestions
Filename:
MIME Type:
Creator:
Florian Best
Created:
2016-04-26 08:37:52 CEST
Size:
5.73 KB
patch
obsolete
>diff --git a/services/univention-printserver/debian/control b/services/univention-printserver/debian/control >index 6e4aa2c..fb907b4 100644 >--- a/services/univention-printserver/debian/control >+++ b/services/univention-printserver/debian/control >@@ -80,7 +80,8 @@ Architecture: all > Depends: ${misc:Depends}, > ${python:Depends}, > univention-directory-manager-tools (>> 7.0.147), >- univention-management-console-server >+ univention-management-console-server, >+ python-lxml > Recommends: univention-printserver (= ${source:Version}) > Description: UMC module for printer administration > This package contains the UMC module for the administration >diff --git a/services/univention-printserver/umc/js/printers/DetailPage.js b/services/univention-printserver/umc/js/printers/DetailPage.js >index 947c6db..ec2b065 100644 >--- a/services/univention-printserver/umc/js/printers/DetailPage.js >+++ b/services/univention-printserver/umc/js/printers/DetailPage.js >@@ -230,8 +230,6 @@ define([ > this._show_button('activate',res['status'] == 'disabled'); > this._show_button('deactivate',res['status'] == 'enabled'); > this._show_button('editquota',res['quota']); >- >- this.layout(); // whenever you change a non-center region of a BorderLayout... > }), lang.hitch(this, function(data) { > this._grid.filter(); // clears stale grid data > })); >diff --git a/services/univention-printserver/umc/python/printers/__init__.py b/services/univention-printserver/umc/python/printers/__init__.py >index 024a518..c904ee9 100644 >--- a/services/univention-printserver/umc/python/printers/__init__.py >+++ b/services/univention-printserver/umc/python/printers/__init__.py >@@ -31,35 +31,27 @@ > # /usr/share/common-licenses/AGPL-3; if not, see > # <http://www.gnu.org/licenses/>. > >-import pprint >+import re > import subprocess >-import os >-import univention.management.console as umc >-import univention.management.console.modules as umcm >-from univention.management.console.modules import UMC_CommandError >-from univention.management.console.modules import UMC_Error >+import lxml.html > >-import univention.config_registry >-import univention.admin.uldap >+from univention.lib.i18n import Translation > >-import re >-import lxml.html >+import univention.admin.uldap > >+from univention.management.console.base import Base > from univention.management.console.log import MODULE >-from univention.management.console.protocol.definitions import * >+from univention.management.console.config import ucr >+from univention.management.console.modules import UMC_Error > from univention.management.console.modules.decorators import simple_response, log, sanitize > from univention.management.console.modules.sanitizers import PatternSanitizer, ChoicesSanitizer > >-_ = umc.Translation('univention-management-console-module-printers').translate >+_ = Translation('univention-management-console-module-printers').translate > >-class Instance(umcm.Base): >+class Instance(Base): > > def init(self): >- >- self.ucr = univention.config_registry.ConfigRegistry() >- self.ucr.load() >- >- self._hostname = self.ucr.get('hostname') >+ self._hostname = ucr.get('hostname') > > @sanitize(pattern=PatternSanitizer(default='.*'), key=ChoicesSanitizer(choices=['printer', 'description', 'location'], required=True)) > @simple_response >@@ -113,7 +105,7 @@ def list_quota(self, printer=''): > from pykota.tool import PyKotaTool > from pykota import reporter > from pykota.storages.pgstorage import PGError >- except ImportError as err: >+ except ImportError: > raise UMC_Error(_('The print quota settings are currently disabled. Please install the package univention-printquota to enable them.')) > > try: >@@ -122,8 +114,9 @@ def list_quota(self, printer=''): > printers = reportTool.storage.getMatchingPrinters(printer) > reportingtool = reporter.openReporter(reportTool, 'html', printers, '*', 0) > status = reportingtool.generateReport() >- except PGError as err: >- raise UMC_Error(_('The connection to the print quota postgres database failed: %s') % str(err)) >+ except PGError as exc: >+ MODULE.error('Cannot connect to postgres: %s' % (exc,)) >+ raise UMC_Error(_('The connection to the print quota postgres database failed. Please make sure the postgres service is running and reachable.')) > > if status: > tree = lxml.html.fromstring(status) >@@ -135,16 +128,16 @@ def list_quota(self, printer=''): > data.append(b.text_content().strip()) > if data and len(data) >= 11: > user = data[0] >- limitby = data[1] >- overcharge = data[2] >+# limitby = data[1] >+# overcharge = data[2] > used = data[3] > soft = data[4] > hard = data[5] >- balance = data[6] >- grace = data[7] >+# balance = data[6] >+# grace = data[7] > total = data[8] >- paid = data[9] >- warn = data[10] >+# paid = data[9] >+# warn = data[10] > result.append(dict( > user=user, > used=used, >@@ -190,7 +183,6 @@ def cancel_jobs(self, jobs, printer=''): > > return self._cancel_jobs(printer, jobs) > >- > @simple_response > @log > def set_quota(self, printer='', user='', soft=0, hard=0): >@@ -335,7 +327,7 @@ def _reset_quota(self, printer, users): > cmd.append(user) > (stdout, stderr, status) = self._shell_command(cmd, {'LANG':'C'}) > >- if status or len(stderr): >+ if status or stderr: > return stderr > > return '' >@@ -361,9 +353,7 @@ def _quota_enabled(self, printer=None): > return result > > # Printer specified: return its quota value or False if not found. >- if printer in result: >- return result[printer] >- return False >+ return result.get(printer, False) > > def _cancel_jobs(self, printer, jobs): > """ internal function that cancels a list of jobs. >@@ -386,4 +376,3 @@ def _shell_command(self, args, env=None): > outputs = proc.communicate() > > return (outputs[0], outputs[1], proc.returncode) >-
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 33792
:
7607
| 7617 |
7624