Skip to content

Commit

Permalink
hotfix for issue #73 (fixed)
Browse files Browse the repository at this point in the history
  • Loading branch information
Baguage committed Jul 8, 2017
1 parent 632aa5b commit 385fd28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ def test_post_as_different_user(self):
client.login(username=user.username, password="1")
response = client.post(self.url, data={})
self.assertEqual(response.status_code, 403)

def test_get_broken_xml(self):
self.scenario.xml = "<"
self.scenario.save()
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
9 changes: 5 additions & 4 deletions website/apps/ts_om_edit/views/ScenarioSummaryView.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from website.apps.ts_om import submit
from website.apps.ts_om_edit.forms import ScenarioSummaryForm
from website.apps.ts_om.models import Scenario as ScenarioModel
from website.notification import set_notification
from website.notification import set_notification, DANGER


class ScenarioSummaryView(TemplateView):
Expand Down Expand Up @@ -72,21 +72,22 @@ def get_context_data(self, **kwargs):
try:
self.scenario = Scenario(self.model_scenario.xml)
except ParseError:
set_notification(self.request, "Invalid XML Document", DANGER)
self.scenario = None

context["scenario"] = self.model_scenario
context["xml"] = self.model_scenario.xml
context["desc"] = self.model_scenario.description if self.model_scenario.description else ""
if self.scenario:
vectors = list(self.scenario.entomology.vectors)
context["scenario"] = self.model_scenario
context["scenario_id"] = self.model_scenario.id
context["name"] = self.model_scenario.name
context["desc"] = self.model_scenario.description if self.model_scenario.description else ""
context["deleted"] = self.model_scenario.deleted
context["version"] = self.scenario.schemaVersion

if self.model_scenario.new_simulation:
context['sim_id'] = self.model_scenario.new_simulation.id

context["xml"] = self.scenario.xml

monitor_info = get_survey_times(self.scenario.monitoring, self.model_scenario.start_date)

Expand Down

0 comments on commit 385fd28

Please sign in to comment.