Browse Source

Log load GeoJSON errors, clarify the accepted types on the form

Gu1 11 years ago
parent
commit
e86a14f571

+ 1 - 2
ffdnispdb/forms.py

@@ -76,7 +76,7 @@ class GeoJSONField(TextField):
             if not validate_geojson(self.data):
             if not validate_geojson(self.data):
                 raise StopValidation(_(u'Invalid GeoJSON, please check it'))
                 raise StopValidation(_(u'Invalid GeoJSON, please check it'))
             if not check_geojson_spatialite(self.data):
             if not check_geojson_spatialite(self.data):
-                # TODO: log this
+                current_app.logger.error('Spatialite could not decode the following GeoJSON: %s', self.data)
                 raise StopValidation(_(u'Unable to store GeoJSON in database'))
                 raise StopValidation(_(u'Unable to store GeoJSON in database'))
 
 
 
 
@@ -173,7 +173,6 @@ class ProjectForm(Form):
             raise ValidationError(_(u'You must specify at least one area'))
             raise ValidationError(_(u'You must specify at least one area'))
 
 
         geojson_size = sum([len(ca.area.raw_data[0]) for ca in self.covered_areas if ca.area.raw_data])
         geojson_size = sum([len(ca.area.raw_data[0]) for ca in self.covered_areas if ca.area.raw_data])
-        print geojson_size
         max_size = current_app.config['ISP_FORM_GEOJSON_MAX_SIZE_TOTAL']
         max_size = current_app.config['ISP_FORM_GEOJSON_MAX_SIZE_TOTAL']
         if geojson_size > max_size:
         if geojson_size > max_size:
             # TODO: XXX This is not printed !
             # TODO: XXX This is not printed !

+ 3 - 2
ffdnispdb/templates/site.js

@@ -69,8 +69,9 @@ $(function () {
                      '<h3>'+{{ _("GeoJSON Input")|js_str }}+'</h3>'+
                      '<h3>'+{{ _("GeoJSON Input")|js_str }}+'</h3>'+
                      '</div>'+
                      '</div>'+
                      '<div class="modal-body">'+
                      '<div class="modal-body">'+
-                     '<p>'+{{ _("Paste your GeoJSON here")|js_str }}+'</p>'+
-                     '<textarea style="width: 97%; height: 200px"></textarea>'+
+                     '<p>'+{{ _("Paste your GeoJSON here :")|js_str }}+'</p>'+
+                     '<p><textarea style="width: 97%; height: 200px"></textarea></p>'+
+                     '<p><small>'+{{ _("Accepted types: Polygon, MultiPolygon")|js_str }}+'</small></p>'+
                      '</div>'+
                      '</div>'+
                      '<div class="modal-footer">'+
                      '<div class="modal-footer">'+
                      '<button class="btn" data-dismiss="modal" aria-hidden="true">'+{{ _("Cancel")|js_str }}+'</button>'+
                      '<button class="btn" data-dismiss="modal" aria-hidden="true">'+{{ _("Cancel")|js_str }}+'</button>'+

BIN
ffdnispdb/translations/fr/LC_MESSAGES/messages.mo


+ 22 - 18
ffdnispdb/translations/fr/LC_MESSAGES/messages.po

@@ -6,8 +6,8 @@
 msgid ""
 msgid ""
 msgstr ""
 msgstr ""
 "Report-Msgid-Bugs-To: gu1@cafai.fr\n"
 "Report-Msgid-Bugs-To: gu1@cafai.fr\n"
-"POT-Creation-Date: 2013-12-21 11:19+0100\n"
-"PO-Revision-Date: 2013-12-21 11:21+0100\n"
+"POT-Creation-Date: 2013-12-21 15:25+0100\n"
+"PO-Revision-Date: 2013-12-21 15:25+0100\n"
 "Last-Translator: Gu1 <gu1@cafai.fr>\n"
 "Last-Translator: Gu1 <gu1@cafai.fr>\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 "MIME-Version: 1.0\n"
 "MIME-Version: 1.0\n"
@@ -237,7 +237,7 @@ msgstr "abonnées"
 msgid "Number of subscribers to an internet access"
 msgid "Number of subscribers to an internet access"
 msgstr "Nombre d'abonnées à un accès à Internet"
 msgstr "Nombre d'abonnées à un accès à Internet"
 
 
-#: ffdnispdb/forms.py:160 ffdnispdb/forms.py:289
+#: ffdnispdb/forms.py:160 ffdnispdb/forms.py:288
 msgid "Email"
 msgid "Email"
 msgstr "Email"
 msgstr "Email"
 
 
@@ -249,25 +249,25 @@ msgstr "Contact technique, en cas de problème"
 msgid "You must specify at least one area"
 msgid "You must specify at least one area"
 msgstr "Vous devez spécifier au moins une zone"
 msgstr "Vous devez spécifier au moins une zone"
 
 
-#: ffdnispdb/forms.py:181
+#: ffdnispdb/forms.py:180
 #, python-format
 #, python-format
 msgid "The size of all GeoJSON data combined must not exceed %(max_size)s"
 msgid "The size of all GeoJSON data combined must not exceed %(max_size)s"
 msgstr ""
 msgstr ""
 "La taille de toutes les données GeoJSON ne soit pas excéder %(max_size)s"
 "La taille de toutes les données GeoJSON ne soit pas excéder %(max_size)s"
 
 
-#: ffdnispdb/forms.py:270 ffdnispdb/forms.py:294
+#: ffdnispdb/forms.py:269 ffdnispdb/forms.py:293
 msgid "Invalid URL"
 msgid "Invalid URL"
 msgstr "URL invalide"
 msgstr "URL invalide"
 
 
-#: ffdnispdb/forms.py:286
+#: ffdnispdb/forms.py:285
 msgid "base url"
 msgid "base url"
 msgstr "url de base"
 msgstr "url de base"
 
 
-#: ffdnispdb/forms.py:286
+#: ffdnispdb/forms.py:285
 msgid "E.g. https://isp.com/"
 msgid "E.g. https://isp.com/"
 msgstr "E.g. https://isp.com/"
 msgstr "E.g. https://isp.com/"
 
 
-#: ffdnispdb/forms.py:287
+#: ffdnispdb/forms.py:286
 msgid ""
 msgid ""
 "A ressource implementing our JSON-Schema specification must exist at path /"
 "A ressource implementing our JSON-Schema specification must exist at path /"
 "isp.json"
 "isp.json"
@@ -275,23 +275,23 @@ msgstr ""
 "Une ressource implémentant notre spécification JSON-Schema doit exister au "
 "Une ressource implémentant notre spécification JSON-Schema doit exister au "
 "chemin /isp.json"
 "chemin /isp.json"
 
 
-#: ffdnispdb/forms.py:290
+#: ffdnispdb/forms.py:289
 msgid "Technical contact, in case of problems"
 msgid "Technical contact, in case of problems"
 msgstr "Contact technique, en cas de problèmes"
 msgstr "Contact technique, en cas de problèmes"
 
 
-#: ffdnispdb/forms.py:297
+#: ffdnispdb/forms.py:296
 msgid "Invalid URL (must be HTTP(S))"
 msgid "Invalid URL (must be HTTP(S))"
 msgstr "URL invalide (doit être HTTP(S))"
 msgstr "URL invalide (doit être HTTP(S))"
 
 
-#: ffdnispdb/forms.py:300
+#: ffdnispdb/forms.py:299
 msgid "This URL is already in our database"
 msgid "This URL is already in our database"
 msgstr "Cette URL est déjà dans notre base de données"
 msgstr "Cette URL est déjà dans notre base de données"
 
 
-#: ffdnispdb/forms.py:304
+#: ffdnispdb/forms.py:303
 msgid "Tech Email"
 msgid "Tech Email"
 msgstr "Email Technique"
 msgstr "Email Technique"
 
 
-#: ffdnispdb/forms.py:305
+#: ffdnispdb/forms.py:304
 msgid "The Technical contact you provided while registering"
 msgid "The Technical contact you provided while registering"
 msgstr "Le contact technique que vous avez fourni lors de l'enregistrement"
 msgstr "Le contact technique que vous avez fourni lors de l'enregistrement"
 
 
@@ -395,7 +395,7 @@ msgstr "Valider"
 #: ffdnispdb/templates/gen_edit_token.html:14
 #: ffdnispdb/templates/gen_edit_token.html:14
 #: ffdnispdb/templates/project_form_generic.html:66
 #: ffdnispdb/templates/project_form_generic.html:66
 #: ffdnispdb/templates/project_json_form_generic.html:14
 #: ffdnispdb/templates/project_json_form_generic.html:14
-#: ffdnispdb/templates/site.js:76
+#: ffdnispdb/templates/site.js:77
 msgid "Cancel"
 msgid "Cancel"
 msgstr "Annuler"
 msgstr "Annuler"
 
 
@@ -548,14 +548,18 @@ msgid "GeoJSON Input"
 msgstr "Champ GeoJSON"
 msgstr "Champ GeoJSON"
 
 
 #: ffdnispdb/templates/site.js:72
 #: ffdnispdb/templates/site.js:72
-msgid "Paste your GeoJSON here"
-msgstr "Collez votre GeoJSON ici"
+msgid "Paste your GeoJSON here :"
+msgstr "Collez votre GeoJSON ici :"
 
 
-#: ffdnispdb/templates/site.js:77
+#: ffdnispdb/templates/site.js:74
+msgid "Accepted types: Polygon, MultiPolygon"
+msgstr "Types acceptés: Polygon, Multipolygon"
+
+#: ffdnispdb/templates/site.js:78
 msgid "Done"
 msgid "Done"
 msgstr "Fini"
 msgstr "Fini"
 
 
-#: ffdnispdb/templates/site.js:141
+#: ffdnispdb/templates/site.js:142
 msgid "Find ISPs near you"
 msgid "Find ISPs near you"
 msgstr "Trouvez des FAI proche de vous"
 msgstr "Trouvez des FAI proche de vous"