This commit is contained in:
Andy McKay 2011-04-28 11:45:42 -07:00
Родитель 41f3fdfc16
Коммит ea84663c39
4 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -105,7 +105,7 @@ class FileViewer:
def read_file(self, selected):
if selected['size'] > settings.FILE_VIEWER_SIZE_LIMIT:
return '', _('File size is over the limit of %s.'
% (filesizeformat(settings.FILE_VIEWER_SIZE_LIMIT)))
% (filesizeformat(settings.FILE_VIEWER_SIZE_LIMIT)))
with open(selected['full'], 'r') as opened:
cont = opened.read()

Просмотреть файл

@ -50,7 +50,9 @@
{% if selected and not selected['binary'] and not selected['directory'] and content %}
<pre id="content" class="wrapped">{{ content }}</pre>
{% endif %}
{% include "files/file.html" %}
{% if selected and not selected['directory'] %}
{% include "files/file.html" %}
{% endif %}
{% endif %}
{% if diff %}
{% if diff.is_diffable() %}
@ -67,12 +69,14 @@
<pre class="left hidden">{{ text_one }}</pre>
<pre class="right hidden">{{ text_two }}</pre>
{% endif %}
{% if selected and not selected['directory']%}
{% with selected = diff.one, file = diff.file_one.file %}
{% include "files/file.html" %}
{% endwith %}
{% with selected = diff.two, file = diff.file_two.file %}
{% include "files/file.html" %}
{% endwith %}
{% endif %}
{% endif %}
</div>
</div>

Просмотреть файл

@ -132,7 +132,7 @@ class TestFileHelper(test_utils.TestCase):
rt = files.index(u'chrome')
eq_(files[rt:rt + 3], [u'chrome', u'chrome/foo', u'chrome.manifest'])
@patch_object(settings, 'FILE_VIEWER_SIZE_LIMIT', 5)
@patch_object(settings._wrapped, 'FILE_VIEWER_SIZE_LIMIT', 5)
def test_file_size(self):
self.viewer.extract()
files = self.viewer.get_files()

Просмотреть файл

@ -369,10 +369,10 @@ class TestDiffViewer(FilesBase, test_utils.TestCase):
self.add_file(self.file_viewer.file_one, not_binary, 'something')
res = self.client.get(self.file_url(not_binary))
doc = pq(res.content)
eq_(doc('#content-wrapper p').text(), 'Files are different.')
assert doc('#content-wrapper p').text().startswith('Files are diff')
def test_files_same_msg(self):
self.file_viewer.extract()
res = self.client.get(self.file_url(not_binary))
doc = pq(res.content)
eq_(doc('#content-wrapper p').text(), 'Files are the same.')
assert doc('#content-wrapper p').text().startswith('Files are the s')