Repository: GeotrekCE/Geotrek-admin

Issue:
Error - SHAPE export
Trying to export TRAILS as a shape, send some errors emails to ADMIN : 

[Geotrek] ERROR: GDAL_ERROR 1: Field id of width 255 truncated to 254.

[Geotrek] ERROR: GDAL_ERROR 1: Field name of width 255 truncated to 254.

[Geotrek] ERROR: GDAL_ERROR 1: Field departure of width 255 truncated to 254.

[Geotrek] ERROR: GDAL_ERROR 1: Field arrival of width 255 truncated to 254.

Same when exporting PATH to shapes.



Discussion:
Hier, un utilisateur a du faire un export des ITINERAIRES car j'ai reçu 86 emails d'erreur de ce type.

[Geotrek] ERROR: GDAL_ERROR 1: Field slope of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field usages of width 255 truncated to 254
[Geotrek] ERROR: GDAL_ERROR 1: Field duration_p of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field ambiance of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field is_park_ce of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field related of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field themes of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field published_ of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field web_links of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field duration of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field ascent of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field id of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field informatio of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field pictures of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field descent of width 255 truncated to 254.
[Geotrek] ERROR: GDAL_ERROR 1: Field advised_pa of width 255 truncated to 254.
....

Mais aussi quelques erreurs sur les noms de champs : 

[Geotrek] ERROR: GDAL_ERROR 6: Normalized/laundered field name: 'descriptio' to 'descript_1'

Ainsi que quelques erreurs de ce type : 

[Geotrek] ERROR: GDAL_ERROR 1: One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1.\nThis warning will not be emitted anymore.

[Geotrek] ERROR: GDAL_ERROR 1: Value 'elise.chaulacel attached paperclip/trekking_trek/919184/randonneurs-vers-le-col-de-la-coupa.jpg, elise.chaulacel attached paperclip/trekking_trek/919184/troupeau-a-lalpage-du-vallon-reallon.jpg, elise.chaulacel attached paperclip/trekking_trek/919184/myrtil' of field pictures has been truncated to 254 characters.\nThis warning will not be emitted any more for that layer.

J'ai ce problème à chaque EXPORT SHP des tronçons, certainement à cause de la colonne RESEAUX dont le contenu est souvent long. Du coup, l'export fonctionne quand même mais la colonne RESEAU est vide. 

En essayant d'exporter les tronçons, je reçois ces erreurs mais là j'ai aussi reçu : 

[Geotrek] ERROR: GDAL_ERROR 1: One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1.\nThis warning will not be emitted anymore.

Ça doit être du à un problème d'accent ? 

Just tried to export some paths with Geotrek-admin 2.7.1 and still received 26 error email such as "[Geotrek] ERROR: GDAL_ERROR 1: Field valid of width 255 truncated to 254."


Resolving patch:
diff --git a/geotrek/trekking/models.py b/geotrek/trekking/models.py
--- a/geotrek/trekking/models.py
+++ b/geotrek/trekking/models.py
@@ -119,6 +119,7 @@ class Trek(StructureRelated, PicturesMixin, PublishableMixin, MapEntityMixin, To
     objects = Topology.get_manager_cls(models.GeoManager)()
 
     category_id_prefix = 'T'
+    capture_map_image_waitfor = '.poi_enum_loaded.services_loaded.info_desks_loaded.ref_points_loaded'
 
     class Meta:
         db_table = 'o_t_itineraire'


Test patch:
diff --git a/geotrek/maintenance/tests/test_views.py b/geotrek/maintenance/tests/test_views.py
--- a/geotrek/maintenance/tests/test_views.py
+++ b/geotrek/maintenance/tests/test_views.py
@@ -366,8 +366,8 @@ def test_shape_mixed(self):
                 u'id', u'name', u'period', u'type', u'domain', u'constraint',
                 u'global_cos', u'interventi', u'interven_1', u'comments',
                 u'contractor', u'project_ow', u'project_ma', u'founders',
-                u'structure', u'date_inser', u'date_updat',
-                u'cities', u'districts', u'areas'
+                u'related_st', u'insertion_', u'update_dat',
+                u'cities', u'districts', u'restricted'
             ])
 
         self.assertEquals(len(layer_point), 1)