Ignore:
Timestamp:
15 Mar 2013, 00:58:05 (12 years ago)
Author:
uli
Message:

Support unicode-aware CSV ops. New buildout run required (new dependency package).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r9931 r10027  
    1818""" Viewing components for Kofa objects.
    1919"""
    20 import csv
     20# XXX: All csv ops should move to a dedicated module soon
     21import unicodecsv as csv
    2122import grok
    2223import os
     
    10441045            # XXX: temporary solution to prevent users from
    10451046            # uploading non-ascii files.
    1046             for element in filecontent:
    1047                 try:
    1048                     if ord(element) > 128:
    1049                       self.flash(_(
    1050                           "Only ASCII files are allowed. "
    1051                           "Your file contains non-ASCII characters."))
    1052                       logger.info('%s - non-ascii file uploaded: %s' %
    1053                           (ob_class, target))
    1054                       return
    1055                 except TypeError:
    1056                     self.flash(_(
    1057                         "Only ASCII files are allowed. "
    1058                         "Your file contains non-ASCII characters."))
    1059                     logger.info('%s - non-ascii file uploaded: %s' %
    1060                         (ob_class, target))
    1061                     return
     1047            #for element in filecontent:
     1048            #    try:
     1049            #        if ord(element) > 128:
     1050            #          self.flash(_(
     1051            #              "Only ASCII files are allowed. "
     1052            #              "Your file contains non-ASCII characters."))
     1053            #          logger.info('%s - non-ascii file uploaded: %s' %
     1054            #              (ob_class, target))
     1055            #          return
     1056            #    except TypeError:
     1057            #        self.flash(_(
     1058            #            "Only ASCII files are allowed. "
     1059            #            "Your file contains non-ASCII characters."))
     1060            #        logger.info('%s - non-ascii file uploaded: %s' %
     1061            #            (ob_class, target))
     1062            #        return
    10621063
    10631064            open(target, 'wb').write(filecontent)
Note: See TracChangeset for help on using the changeset viewer.