Files
@ 260a7a01b054
Branch filter:
Location: kallithea/rhodecode/templates/changeset/diff_block.html - annotation
260a7a01b054
3.6 KiB
text/html
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'.
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'.
d4a7b6c82efe d4a7b6c82efe d4a7b6c82efe a07e04ef7bb4 d4a7b6c82efe a07e04ef7bb4 efc00d363d1e efc00d363d1e efc00d363d1e efc00d363d1e 32471bd1f4ee 32471bd1f4ee 32471bd1f4ee 32471bd1f4ee d4a7b6c82efe d4a7b6c82efe d4a7b6c82efe 32471bd1f4ee 32471bd1f4ee d4a7b6c82efe 37b3c3244bbc ebe3e388bbb3 32471bd1f4ee ebe3e388bbb3 32471bd1f4ee 32471bd1f4ee 37b3c3244bbc d4a7b6c82efe d4a7b6c82efe d4a7b6c82efe 32471bd1f4ee d4a7b6c82efe d4a7b6c82efe d4a7b6c82efe d4a7b6c82efe d4a7b6c82efe 32471bd1f4ee 17caf4efe15c d4a7b6c82efe d4a7b6c82efe 32471bd1f4ee d4a7b6c82efe efc00d363d1e f91d3f9b7230 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 8eab81115660 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 674a8fad3abc f8daaaf1b1e2 35f45d0025a7 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 a07e04ef7bb4 8eab81115660 | ## -*- coding: utf-8 -*-
##usage:
## <%namespace name="diff_block" file="/changeset/diff_block.html"/>
## ${diff_block.diff_block(change)}
##
<%def name="diff_block(change)">
<div class="diff-collapse">
<span target="${'diff-container-%s' % (id(change))}" class="diff-collapse-button">↑ ${_('collapse diff')} ↑</span>
</div>
<div class="diff-container" id="${'diff-container-%s' % (id(change))}">
%for FID,(cs1, cs2, change, path, diff, stats) in change.iteritems():
##%if op !='removed':
<div id="${FID}_target" style="clear:both;margin-top:25px"></div>
<div id="${FID}" class="diffblock margined comm">
<div class="code-header">
<div class="changeset_header">
<div class="changeset_file">
${h.link_to_if(change!='removed',h.safe_unicode(path),h.url('files_home',repo_name=c.repo_name,
revision=cs2,f_path=h.safe_unicode(path)))}
</div>
<div class="diff-actions">
<a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(path),diff2=cs2,diff1=cs1,diff='diff',fulldiff=1)}" class="tooltip" title="${h.tooltip(_('show full diff for this file'))}"><img class="icon" src="${h.url('/images/icons/page_white_go.png')}"/></a>
<a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(path),diff2=cs2,diff1=cs1,diff='raw')}" class="tooltip" title="${h.tooltip(_('raw diff'))}"><img class="icon" src="${h.url('/images/icons/page_white.png')}"/></a>
<a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(path),diff2=cs2,diff1=cs1,diff='download')}" class="tooltip" title="${h.tooltip(_('download diff'))}"><img class="icon" src="${h.url('/images/icons/page_save.png')}"/></a>
${c.ignorews_url(request.GET, h.FID(cs2,path))}
${c.context_url(request.GET, h.FID(cs2,path))}
</div>
<span style="float:right;margin-top:-3px">
<label>
${_('show inline comments')}
${h.checkbox('',checked="checked",class_="show-inline-comments",id_for=h.FID(cs2,path))}
</label>
</span>
</div>
</div>
<div class="code-body">
<div class="full_f_path" path="${h.safe_unicode(path)}"></div>
${diff|n}
</div>
</div>
##%endif
%endfor
</div>
</%def>
<%def name="diff_block_simple(change)">
%for op,filenode_path,diff in change:
<div id="${h.FID('',filenode_path)}_target" style="clear:both;margin-top:25px"></div>
<div id="${h.FID('',filenode_path)}" class="diffblock margined comm">
<div class="code-header">
<div class="changeset_header">
<div class="changeset_file">
${h.safe_unicode(filenode_path)} |
<a class="spantag" href="${h.url('files_home', repo_name=c.other_repo.repo_name, f_path=filenode_path, revision=c.org_ref)}" title="${_('show file at latest version in this repo')}">${c.org_ref_type}@${h.short_id(c.org_ref) if c.org_ref_type=='rev' else c.org_ref}</a> ->
<a class="spantag" href="${h.url('files_home', repo_name=c.repo_name, f_path=filenode_path, revision=c.other_ref)}" title="${_('show file at initial version in this repo')}">${c.other_ref_type}@${h.short_id(c.other_ref) if c.other_ref_type=='rev' else c.other_ref}</a>
</div>
</div>
</div>
<div class="code-body">
<div class="full_f_path" path="${h.safe_unicode(filenode_path)}"></div>
${diff|n}
</div>
</div>
%endfor
</%def>
|