...
 
Commits (5)
......@@ -132,10 +132,11 @@ def parse_feed(db, Message, topic_id, app):
'''
# Override misspelled county :/
location = location.replace('Gataland', 'Gotaland')
if location:
location = location.replace('Gataland', 'Gotaland')
# current location
logging.info(location)
logging.info("Location: %s", location)
try:
location = locationfinder( location )
......@@ -145,7 +146,7 @@ def parse_feed(db, Message, topic_id, app):
logging.error("%s location conversion with id %s failed!" % (name, alert))
msg = Message()
msg.subject = u'VMA - Viktigt Meddelande till Allmänheten'
msg.subject = 'VMA - Viktigt Meddelande till Allmänheten'
msg.message = data['info'][0]['resource'][0]['derefUri']
msg.active = True
msg.topic_id = topic_id
......
......@@ -64,6 +64,7 @@ class MessageForm(Form):
location = TextField(_('Location'))
url = TextField(_('URL'))
topic_id = SelectField(_('Topic'), coerce=int )
error = BooleanField(_('Error'))
def validate(self):
check_validate = super(MessageForm, self).validate()
......@@ -86,6 +87,7 @@ class MessageEditForm(Form):
subject = TextField(_('Subject'))
location = TextField(_('Location'))
url = TextField(_('URL'))
error = BooleanField(_('Error'))
def validate(self):
check_validate = super(MessageEditForm, self).validate()
......
......@@ -406,6 +406,7 @@ def fix():
def sendalarm():
e = False
messages = Message.query.filter(Message.delivered == 'f', Message.location != None, Message.error == 'f').all()
for m in messages:
# Loop over messages, make sure that we could parse something from the location
if m.location:
......
......@@ -9,6 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
<meta name="flattr:id" content="voqoy3">
{% block css %}
{% endblock %}
......
......@@ -6,16 +6,19 @@
<div class="container-fluid">
<div class="row" style="background-color: #ccc;">
<div class="col-sm-2">
<div class="col-sm-2" align=center>
Date - Time
</div>
<div class="col-sm-1">
Topic
</div>
<div class="col-sm-1">
Active
<div class="col-sm-1" align=center>
Active
</div>
<div class="col-sm-1" align=center>
Error
</div>
<div class="col-sm-4">
<div class="col-sm-3">
Location
</div>
<div class="col-sm-1">
......@@ -48,7 +51,12 @@
<a href="{{ url_for('.logging', activate=l.id ) }} "> <span class="icon-plus"></a>
{%endif%}
</div>
<div class="col-sm-4">
<div class="col-sm-1" align=center>
{% if l.error %}
{{ l.error }}
{% endif %}
</div>
<div class="col-sm-3">
{% if l.location[0] %}
{{ l.location[0]['display_name'] }}
{% else %}
......
......@@ -37,7 +37,7 @@
To:<br/>
{{ data.topic.name }}
</div>
<div class="col-sm-8">
<div class="col-sm-4">
Active: <br/>{{ form.active() }}
{% if form.active.errors %}
{% for e in form.active.errors %}
......@@ -45,6 +45,9 @@
{% endfor %}
{% endif %}
</div>
<div class="col-sm-4">
Error: <br/>{{ form.error() }}
</div>
</div>{# end row #}
<div class="row">
<div class="col-sm-12">
......