Commits

Anonymous committed f411937

remove the request param as it is unneeded, and add error catch for unicode exception

  • Participants
  • Parent commits cead16d

Comments (0)

Files changed (1)

File shapes/views/export.py

+# -*- coding: utf-8 -*-
+
 import os
 import shutil
 import zipfile
         self.file_name = 'shp_download'
         self.file_name = self.file_name.rstrip('.shp')
     
-    def __call__(self, request, *args, **kwargs):
+    def __call__(self, *args, **kwargs):
         """
         """
         fields = self.queryset.model._meta.fields
             idx = 0
             for field in attributes:
               value = getattr(item,field.name)
-              ogr.OGR_F_SetFieldString(feat, idx, str(value))
+              try:
+                string_value = str(value)
+              except UnicodeEncodeError, E:
+                # pass for now....
+                # http://trac.osgeo.org/gdal/ticket/882
+                string_value = ''
+              ogr.OGR_F_SetFieldString(feat, idx, string_value)
               idx += 1
               
             # Transforming & setting the geometry