old_contents: # -*- coding: utf-8 -*-
  
  
  # OpenFisca -- A versatile microsimulation software
  # By: OpenFisca Team <contact@openfisca.fr>
  #
  # Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
  # https://github.com/openfisca
  #
  # This file is part of OpenFisca.
  #
  # OpenFisca is free software; you can redistribute it and/or modify
  # it under the terms of the GNU Affero General Public License as
  # published by the Free Software Foundation, either version 3 of the
  # License, or (at your option) any later version.
  #
  # OpenFisca is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU Affero General Public License for more details.
  #
  # You should have received a copy of the GNU Affero General Public License
  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
  
  import json
  import urllib
  import webbrowser
  
  
  def open_trace_tool(scenario, variables, api_url = u'http://api.openfisca.fr'):
      scenario_json = scenario.to_json()
      simulation_json = {
          "scenarios": [scenario_json],
          "variables": variables,
          }
      trace_base_url = u"http://www.openfisca.fr/outils/trace"
      url = trace_base_url + "?" + urllib.urlencode({
          "simulation": json.dumps(simulation_json),
          "api_url": api_url,
          })
      webbrowser.open_new_tab(url)
  
new_contents: # -*- coding: utf-8 -*-
  
  
  # OpenFisca -- A versatile microsimulation software
  # By: OpenFisca Team <contact@openfisca.fr>
  #
  # Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
  # https://github.com/openfisca
  #
  # This file is part of OpenFisca.
  #
  # OpenFisca is free software; you can redistribute it and/or modify
  # it under the terms of the GNU Affero General Public License as
  # published by the Free Software Foundation, either version 3 of the
  # License, or (at your option) any later version.
  #
  # OpenFisca is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU Affero General Public License for more details.
  #
  # You should have received a copy of the GNU Affero General Public License
  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
  
  import json
  import urllib
  import webbrowser
  
  
  def open_trace_tool(scenario, variables, api_url = u'http://api.openfisca.fr',
          trace_tool_url = u'http://www.openfisca.fr/outils/trace'):
      scenario_json = scenario.to_json()
      simulation_json = {
          'scenarios': [scenario_json],
          'variables': variables,
          }
      url = trace_tool_url + '?' + urllib.urlencode({
          'simulation': json.dumps(simulation_json),
          'api_url': api_url,
          })
      webbrowser.open_new_tab(url)
  
subject: allow to customize trace_tool_url