Mercurial > kallithea
comparison rhodecode/lib/diffs.py @ 3625:260a7a01b054 beta
follow Python conventions for boolean values
True and False might be singletons and the "default" values for "boolean"
expressions, but "all" values in Python has a boolean value and should be
evaluated as such. Checking with 'is True' and 'is False' is thus confusing,
error prone and unnessarily complex.
If we anywhere rely and nullable boolean fields from the database layer and
don't want the null value to be treated as False then we should check
explicitly for null with 'is None'.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 28 Mar 2013 01:10:45 +0100 |
parents | c72dbcad0337 |
children | ec6354949623 |
comparison
equal
deleted
inserted
replaced
3624:4dddb7ee8865 | 3625:260a7a01b054 |
---|---|
419 'stats': stats, | 419 'stats': stats, |
420 }) | 420 }) |
421 | 421 |
422 sorter = lambda info: {'A': 0, 'M': 1, 'D': 2}.get(info['operation']) | 422 sorter = lambda info: {'A': 0, 'M': 1, 'D': 2}.get(info['operation']) |
423 | 423 |
424 if inline_diff is False: | 424 if not inline_diff: |
425 return diff_container(sorted(_files, key=sorter)) | 425 return diff_container(sorted(_files, key=sorter)) |
426 | 426 |
427 # highlight inline changes | 427 # highlight inline changes |
428 for diff_data in _files: | 428 for diff_data in _files: |
429 for chunk in diff_data['chunks']: | 429 for chunk in diff_data['chunks']: |