diff --git a/flask_app/app/main.py b/flask_app/app/main.py index 028013c..0bf0514 100644 --- a/flask_app/app/main.py +++ b/flask_app/app/main.py @@ -1,7 +1,10 @@ +# coding: utf8 from __future__ import print_function +from __future__ import unicode_literals import datetime import os +import io import pytz import voeventparse as vp @@ -64,8 +67,12 @@ def index(): # one dictionary for all field description my_list_description = {"what":request.form['description']} + my_shortname=request.form['shortname'] + my_shortname=my_shortname.encode('utf-8') + print (my_shortname) + output_filename = '/var/tmp/new_voevent.xml' - new_voevent = open(output_filename,'w') + new_voevent = io.open(output_filename,'w',encoding='utf8') new_voevent.write(template.render(voevent_id=voevent_id, my_shortname=request.form['shortname'], my_contactname=request.form['observer'], @@ -134,7 +141,7 @@ def indexlunar(): my_list_description = {"what":request.form['description']} output_filename = '/var/tmp/new_voevent.xml' - new_voevent = open(output_filename,'w') + new_voevent = io.open(output_filename,'w',encoding='utf8') new_voevent.write(template.render(voevent_id=voevent_id, my_shortname=request.form['shortname'], my_contactname=request.form['observer'], @@ -198,7 +205,7 @@ def indexcomet(): my_list_description = {"what":"Tail disconnection of comet 67P"} output_filename = '/var/tmp/new_voevent.xml' - new_voevent = open(output_filename,'w') + new_voevent = io.open(output_filename,'w',encoding='utf8') new_voevent.write(template.render(voevent_id=voevent_id, my_shortname=request.form['shortname'], my_contactname=request.form['observer'], diff --git a/flask_app/app/new_voevent.xml b/flask_app/app/new_voevent.xml index c2f2b47..af6f54e 100644 --- a/flask_app/app/new_voevent.xml +++ b/flask_app/app/new_voevent.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<voe:VOEvent ivorn="ivo://vopdc.obspm/VOEvent/#01604fa2-6b43-467b-aa51-861c54eff5c7" +<voe:VOEvent ivorn="ivo://vopdc.obspm/VOEvent/#b36903b4-b210-4a73-b303-76eba15a5ed2" role="test" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:voe="http://www.ivoa.net/xml/VOEvent/v2.0" @@ -7,8 +7,8 @@ <Who> <AuthorIVORN>ivo://psws/not_registered_yet</AuthorIVORN> <Author> - <shortName>MG</shortName> - <contactName>Michel GANGLOFF</contactName> + <shortName>Mé</shortName> + <contactName>Mémé</contactName> <contactPhone>604086971</contactPhone> <contactEmail>Michel.Gangloff@yahoo.fr</contactEmail> </Author> @@ -16,22 +16,22 @@ </Who> <What> <Description> - Location of observation : Toulouse,France - M + Location of observation : ré,aé + aéèç </Description> <Param name="event_status" value="finished" dataType="string" ucd="meta.flag" /> - <Param name="event_type" value="giant planet fireball" dataType="string" ucd="meta.flag" /> + <Param name="event_type" value="detection" dataType="string" ucd="meta.flag" /> <Group name="target"> - <Param name="target_name" value="Jupiter" dataType="string" ucd="meta.id" /> - <Param name="target_class" value="planet" dataType="string" ucd="meta.id" /> - <Param name="target_region" value="atmosphere" dataType="string" ucd="meta.id" /> + <Param name="target_name" value="Moon" dataType="string" ucd="meta.id" /> + <Param name="target_class" value="satellite" dataType="string" ucd="meta.id" /> + <Param name="target_region" value="surface" dataType="string" ucd="meta.id" /> <Param name="latitude" value="0" dataType="float" ucd="pos.bodyrc.lat" unit="deg" /> <Param name="longitude" value="0" dataType="float" ucd="pos.bodyrc.lon" unit="deg" /> </Group> <Group name="source"> - <Param name="target_name" value="0" dataType="string" ucd="meta.id" /> - <Param name="target_class" value="comet" dataType="string" ucd="meta.id" /> - <Param name="target_region" value="trail" dataType="string" ucd="meta.id" /> + <Param name="target_name" value="éç" dataType="string" ucd="meta.id" /> + <Param name="target_class" value="asteroid" dataType="string" ucd="meta.id" /> + <Param name="target_subclass" value="neo" dataType="string" ucd="meta.id" /> </Group> </What> <WhereWhen> @@ -54,7 +54,7 @@ </WhereWhen> <How> <Description> - 0 + ç </Description> <Reference uri="https://TBD.html" type="url" /> </How> -- libgit2 0.21.2