From: Quentin Smith Date: Mon, 19 Oct 2020 01:21:47 +0000 (-0400) Subject: Fix _unitFormatter for Python 3 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-database.git/commitdiff_plain/2a1bbbdf34f9fc3347be75fbd5fb5320363aa981 Fix _unitFormatter for Python 3 --- diff --git a/python/database/owner.py b/python/database/owner.py index 58beaa3..99b16fd 100644 --- a/python/database/owner.py +++ b/python/database/owner.py @@ -1,6 +1,11 @@ from invirt.database import record from invirt.database.models import session +__all__ = ['Owner'] + +def _unitFormatter(unit): + return lambda v:'%s%s'%(v,unit) + class Owner(record.Record): _f = { 'ram_quota_total': (512, 'MiB'), @@ -11,8 +16,6 @@ class Owner(record.Record): 'vms_quota_active': (4, '') } _default = dict([(_k,_v[0]) for _k,_v in _f.items()]) - def _unitFormatter(unit): - return lambda v:'%s%s'%(v,unit) _format = dict([(_k,_unitFormatter(_v[1])) for _k,_v in _f.items()]) _identity_field = 'owner_id'