Commit a8344941 authored by Pierre Arnaud's avatar Pierre Arnaud

Improve error messages

parent ae13572f
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Passim 0.0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2015-04-30 17:45+0200\n"
"POT-Creation-Date: 2015-04-30 18:43+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -30,7 +30,7 @@ msgid "Administrator"
msgstr ""
#: passim/templates/about.mako:12 passim/templates/site.mako:95
#: passim/templates/site.mako:139 passim/views/__init__.py:100
#: passim/templates/site.mako:139 passim/views/__init__.py:99
msgid "About"
msgstr ""
......@@ -66,10 +66,10 @@ msgstr ""
msgid "{0} most recently updated Information Services"
msgstr ""
#: passim/templates/accueil.mako:33 passim/templates/organisms.mako:100
#: passim/templates/territories.mako:45 passim/templates/territories.mako:80
#: passim/templates/territories.mako:117 passim/templates/territories.mako:154
#: passim/templates/territories.mako:193 passim/templates/maps/dep.mako:20
#: passim/templates/accueil.mako:33 passim/templates/organisms.mako:102
#: passim/templates/territories.mako:45 passim/templates/territories.mako:82
#: passim/templates/territories.mako:121 passim/templates/territories.mako:160
#: passim/templates/territories.mako:201 passim/templates/maps/dep.mako:20
msgid "Name"
msgstr ""
......@@ -82,7 +82,7 @@ msgid "Last modification time"
msgstr ""
#: passim/templates/contact.mako:19 passim/templates/site.mako:98
#: passim/views/__init__.py:144
#: passim/views/__init__.py:143
msgid "Contact"
msgstr ""
......@@ -129,7 +129,7 @@ msgid "Contribute Form"
msgstr ""
#: passim/templates/contribute.mako:9 passim/templates/site.mako:101
#: passim/views/__init__.py:180
#: passim/views/__init__.py:179
msgid "Contribute"
msgstr ""
......@@ -172,12 +172,12 @@ msgid ""
"href=\"{}\">return to Home</a>"
msgstr ""
#: passim/templates/feed.mako:5 passim/templates/organisms.mako:24
#: passim/templates/feed.mako:5 passim/templates/organisms.mako:26
msgid "Last update"
msgstr ""
#: passim/templates/help.mako:12 passim/templates/site.mako:107
#: passim/views/__init__.py:214
#: passim/views/__init__.py:213
msgid "Help"
msgstr ""
......@@ -236,51 +236,54 @@ msgid ""
"Thank you for using PASSIM and thanks in advance for your comments!\n"
msgstr ""
#: passim/templates/organisms.mako:15
#: passim/templates/organisms.mako:17
msgid "Information Service"
msgstr ""
#: passim/templates/organisms.mako:34
#: passim/templates/organisms.mako:36
msgid "Website"
msgstr ""
#: passim/templates/organisms.mako:37
#: passim/templates/organisms.mako:39
msgid "Transport offer website."
msgstr ""
#: passim/templates/organisms.mako:45 passim/templates/organisms.mako:49
#: passim/templates/organisms.mako:52 passim/templates/organisms.mako:55
#: passim/templates/organisms.mako:47 passim/templates/organisms.mako:51
#: passim/templates/organisms.mako:54 passim/templates/organisms.mako:57
msgid "Mobile applications"
msgstr ""
#: passim/templates/organisms.mako:63
#: passim/templates/organisms.mako:65
msgid "Covered Territory"
msgstr ""
#: passim/templates/organisms.mako:68
#: passim/templates/organisms.mako:70 passim/templates/organisms.mako:123
#: passim/templates/territories.mako:60 passim/templates/territories.mako:98
#: passim/templates/territories.mako:137 passim/templates/territories.mako:176
#: passim/templates/territories.mako:218 passim/views/__init__.py:486
msgid "None"
msgstr ""
#: passim/templates/organisms.mako:76
#: passim/templates/organisms.mako:78
msgid "Transport Offers : "
msgstr ""
#: passim/templates/organisms.mako:81
#: passim/templates/organisms.mako:83
msgid "List"
msgstr ""
#: passim/templates/organisms.mako:101 passim/templates/territories.mako:46
#: passim/templates/territories.mako:81 passim/templates/territories.mako:118
#: passim/templates/territories.mako:155 passim/templates/territories.mako:194
#: passim/templates/organisms.mako:103 passim/templates/territories.mako:46
#: passim/templates/territories.mako:83 passim/templates/territories.mako:122
#: passim/templates/territories.mako:161 passim/templates/territories.mako:202
msgid "Transport Type"
msgstr ""
#: passim/templates/organisms.mako:102
#: passim/templates/organisms.mako:104
msgid "Transport Mode"
msgstr ""
#: passim/templates/reuse.mako:12 passim/templates/site.mako:104
#: passim/views/__init__.py:187
#: passim/views/__init__.py:186
msgid "Reuse"
msgstr ""
......@@ -384,26 +387,26 @@ msgid "Traveler Info Services List For"
msgstr ""
#: passim/templates/territories.mako:44 passim/templates/territories.mako:53
#: passim/templates/territories.mako:79 passim/templates/territories.mako:89
#: passim/templates/territories.mako:116 passim/templates/territories.mako:126
#: passim/templates/territories.mako:153 passim/templates/territories.mako:163
#: passim/templates/territories.mako:192 passim/templates/territories.mako:203
#: passim/templates/territories.mako:81 passim/templates/territories.mako:91
#: passim/templates/territories.mako:120 passim/templates/territories.mako:130
#: passim/templates/territories.mako:159 passim/templates/territories.mako:169
#: passim/templates/territories.mako:200 passim/templates/territories.mako:211
msgid "Web Site"
msgstr ""
#: passim/templates/territories.mako:70
#: passim/templates/territories.mako:72
msgid "Local Interest Traveler Info Services"
msgstr ""
#: passim/templates/territories.mako:107
#: passim/templates/territories.mako:111
msgid "Departmental Interest Traveler Info Services"
msgstr ""
#: passim/templates/territories.mako:144
#: passim/templates/territories.mako:150
msgid "Regional Interest Traveler Info Services"
msgstr ""
#: passim/templates/territories.mako:182
#: passim/templates/territories.mako:190
msgid "National Information"
msgstr ""
......@@ -499,36 +502,36 @@ msgid ""
"agency) public transport offer over a territory and a route planner."
msgstr ""
#: passim/views/__init__.py:83
#: passim/views/__init__.py:82
msgid "Access denied"
msgstr ""
#: passim/views/__init__.py:93
#: passim/views/__init__.py:92
msgid "Page not found"
msgstr ""
#: passim/views/__init__.py:124
#: passim/views/__init__.py:123
msgid "Home"
msgstr ""
#: passim/views/__init__.py:140
#: passim/views/__init__.py:139
msgid "Contact PASSIM: [your message subject]"
msgstr ""
#: passim/views/__init__.py:141
#: passim/views/__init__.py:140
msgid ""
"I am [an end-user, a company...]\n"
"\n"
"My message: ..."
msgstr ""
#: passim/views/__init__.py:160
#: passim/views/__init__.py:159
msgid ""
"Contribution to PASSIM : [new Info Service, correction to an existing Info "
"Service...]"
msgstr ""
#: passim/views/__init__.py:161
#: passim/views/__init__.py:160
msgid ""
"Proposed contribution : [new Info Service, correction to an existing Info "
"Service...]\n"
......@@ -554,15 +557,11 @@ msgid ""
"real time info...):"
msgstr ""
#: passim/views/__init__.py:232
#: passim/views/__init__.py:231
msgid "CSV data"
msgstr ""
#: passim/views/__init__.py:306
msgid "Contribution to PASSIM : [{0}]"
msgstr ""
#: passim/views/__init__.py:307
#: passim/views/__init__.py:238
msgid ""
"Your are [an end-user, a company...]\n"
"\n"
......@@ -578,7 +577,7 @@ msgid ""
"- Web site address :\n"
"- Mobile site or application :\n"
"- Transport services covered:\n"
" - Name, Territory (city, department, region), Transport type (public "
"- Name, Territory (city, department, region), Transport type (public "
"transport...):\n"
"- Your remarks (or information about web services, open data, real time "
"info...):\n"
......@@ -586,19 +585,23 @@ msgid ""
"Thank you advance for any remarks, questions or suggestions about PASSIM !\n"
msgstr ""
#: passim/views/__init__.py:361
#: passim/views/__init__.py:257
msgid "Contribution to PASSIM : [{0}]"
msgstr ""
#: passim/views/__init__.py:270 passim/views/__init__.py:371
msgid "Not found"
msgstr ""
#: passim/views/__init__.py:413
#: passim/views/__init__.py:423
msgid "API error"
msgstr ""
#: passim/views/__init__.py:416
#: passim/views/__init__.py:426
msgid "Error: "
msgstr ""
#: passim/views/__init__.py:556
#: passim/views/__init__.py:566
msgid "Your email has been sent."
msgstr ""
......
This diff is collapsed.
......@@ -8,7 +8,20 @@ ${parent.head()}
</%def>
${parent.page_header()}
% if error:
<div class="error-page">
<h3 class="headline text-info">404</h3>
<div class="error-page-content">
<h4><i class="fa fa-warning text-yellow"></i> ${_(u'Oops! Page not found.')}</h4>
<p>
${error}
</p>
<p>
${_(u'We could not find the page you were looking for. Meanwhile, you may <a href="{}">return to Home</a>').format(request.route_path('accueil')) | n}.
</p>
</div><!-- /.error-content -->
</div><!-- /.error-page -->
%else:
<div class="container"><div class="row">
<div class="page-header">
<h4>
......@@ -120,3 +133,4 @@ ${parent.page_header()}
% else:
${_("None")}
% endif
% endif
......@@ -12,6 +12,18 @@ ${parent.head()}
${parent.page_header()}
${parent.search_bar()}
% if error:
<div class="error-page">
<h3 class="headline text-info">404</h3>
<div class="error-page-content">
<h4><i class="fa fa-warning text-yellow"></i> ${_(u'Oops! Page not found.')}</h4>
<p>
${_(u'We could not find the page you were looking for. Meanwhile, you may <a href="{}">return to Home</a>').format(request.route_path('accueil')) | n}.
</p>
</div><!-- /.error-content -->
</div><!-- /.error-page -->
% endif
<div class="search-navbar">
<h3>
% if error:
......
......@@ -234,15 +234,47 @@ def open_data(request):
@view_config(route_name='organisms', renderer='/organisms.mako')
def organisms(request):
_ = request.translate
name = request.matchdict.get('name')
body = _(u'''Your are [an end-user, a company...]
Your e-mail address: [xxx@yyy.org]
Your contribution : [{0}]
Information Service {1}
- Info Service name
- Info booth:
- Call centre number :
- Web site address :
- Mobile site or application :
- Transport services covered:
- Name, Territory (city, department, region), Transport type (public transport...):
- Your remarks (or information about web services, open data, real time info...):
Thank you advance for any remarks, questions or suggestions about PASSIM !
''')
subject = _(u'Contribution to PASSIM : [{0}]')
# get the service info data by id
id = request.matchdict.get('id')
petitpois_api = request.registry.settings['petitpois_api']
url = '{}poi/{}'.format(petitpois_api, id)
resp = requests.get(url)
error = dict(
id=id,
result=None,
success_message=None,
subject=subject.format(name),
body=body.format(name, request.url),
title=name,
error="" + name + " " + _("Not found")
)
petitpois_response = resp.json()
parse_result = dict()
if not petitpois_response.get("data"):
return error
parse_result["updated"] = datetime.datetime.strptime(petitpois_response["data"]["updated"]["date"].split("T")[0], "%Y-%m-%d").strftime('%d/%m/%Y')
# Extract all needed data for the service infos
......@@ -299,26 +331,8 @@ def organisms(request):
id=id,
result=parse_result,
success_message=None,
subject=_(u'Contribution to PASSIM : [{0}]').format(parse_result["name"]),
body=_(u'''Your are [an end-user, a company...]
Your e-mail address: [xxx@yyy.org]
Your contribution : [{0}]
Information Service {1}
- Info Service name
- Info booth:
- Call centre number :
- Web site address :
- Mobile site or application :
- Transport services covered:
- Name, Territory (city, department, region), Transport type (public transport...):
- Your remarks (or information about web services, open data, real time info...):
Thank you advance for any remarks, questions or suggestions about PASSIM !
''').format(parse_result["name"], request.url),
subject=subject.format(parse_result["name"]),
body=body.format(parse_result["name"], request.url),
title=parse_result["name"],
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment