]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
py3: max does not accept 'None'
authorStephen Finucane <stephen.finucane@intel.com>
Sun, 29 Nov 2015 06:51:14 +0000 (06:51 +0000)
committerStephen Finucane <stephen.finucane@intel.com>
Thu, 3 Dec 2015 22:08:56 +0000 (22:08 +0000)
max(n, None), where n is a valid number, is valid in Python 2 but not
Python 3. Replace these calls with something that works in both
versions of Python.

Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/views/xmlrpc.py

index 64909e24a454ea8ef83e8c051993f21bfe575e3c..4f8fa6f7aaf55bb98128bc745e0d2d859eea14aa 100644 (file)
@@ -278,8 +278,8 @@ def patch_to_dict(obj):
         'submitter': six.text_type(obj.submitter).encode('utf-8'),
         'submitter_id': obj.submitter_id,
         'delegate': six.text_type(obj.delegate).encode('utf-8'),
-        'delegate_id': max(obj.delegate_id, 0),
-        'commit_ref': max(obj.commit_ref, ''),
+        'delegate_id': obj.delegate_id or 0,
+        'commit_ref': obj.commit_ref or '',
     }