Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webapp/polls/models.py2
-rw-r--r--webapp/polls/tests/poll_result_file_tests.py6
-rw-r--r--webapp/sociologist/templates/poll-result-list.html2
3 files changed, 8 insertions, 2 deletions
diff --git a/webapp/polls/models.py b/webapp/polls/models.py
index b50557d..3c1afe7 100644
--- a/webapp/polls/models.py
+++ b/webapp/polls/models.py
@@ -1538,7 +1538,7 @@ class PollResultFile(object):
return self.name
def get_upload_timestamp(self):
- time_string = self.data['upload_timestamp']
+ time_string = self.data.get('upload_timestamp', None)
return time_string
def set_upload_timestamp(self, time_string):
diff --git a/webapp/polls/tests/poll_result_file_tests.py b/webapp/polls/tests/poll_result_file_tests.py
index 935b5f0..7da0117 100644
--- a/webapp/polls/tests/poll_result_file_tests.py
+++ b/webapp/polls/tests/poll_result_file_tests.py
@@ -54,6 +54,12 @@ class PollResultFileTest(MongoTestCase):
result = PollResultFile(file_path)
self.assertEqual(time_string, result.get_upload_timestamp())
+ def test_it_should_return_None_when_there_is_no_timestamp(self):
+ data = self.data
+ file_path = self.make_temp_file(data)
+ result = PollResultFile(file_path)
+ self.assertIsNone(result.get_upload_timestamp())
+
def test_it_should_set_the_upload_timestamp(self):
data = self.data
file_path = self.make_temp_file(data)
diff --git a/webapp/sociologist/templates/poll-result-list.html b/webapp/sociologist/templates/poll-result-list.html
index 3f81e02..53c92e5 100644
--- a/webapp/sociologist/templates/poll-result-list.html
+++ b/webapp/sociologist/templates/poll-result-list.html
@@ -36,7 +36,7 @@
<td>
<a name="poll_result_file" href="{{ poll_result.absolute_url }}">{{ poll_result.file_name }}</a>
</td>
- <td>{{ poll_result.upload_timestamp }}</td>
+ <td>{{ poll_result.upload_timestamp|default_if_none:"Sin fecha registrada" }}</td>
</tr>
{% endfor %}
</tbody>