diff mbox

[7/9] py3: max does not accept 'None'

Message ID 1448835050-1572-8-git-send-email-stephen.finucane@intel.com
State Accepted
Headers show

Commit Message

Stephen Finucane Nov. 29, 2015, 10:10 p.m. UTC
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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stephen Finucane Dec. 10, 2015, 8:21 p.m. UTC | #1
On 29 Nov 22:10, Stephen Finucane wrote:
> 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>

Again, simple fix. Merged.
diff mbox

Patch

diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py
index 64909e2..4f8fa6f 100644
--- a/patchwork/views/xmlrpc.py
+++ b/patchwork/views/xmlrpc.py
@@ -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 '',
     }