Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
bug 1208238 - Use unicodecsv instead of builtin
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhitlock committed Sep 29, 2015
1 parent 424b92e commit 5eccd8a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions mdn/tests/test_views.py
Expand Up @@ -340,6 +340,19 @@ def test_get(self):
]
self.assert_csv_response(url, expected)

def test_get_unicode(self):
text = "Pas avant les éléments en-ligne"
self.issue.params = {"text": text}
self.issue.save()

url = reverse('issues_detail_csv', kwargs={'slug': 'inline-text'})
full_url = 'http://testserver/importer/{}'.format(self.fp.pk)
expected = [
'MDN Slug,Import URL,Source Start,Source End,text',
'docs/Web/CSS/float,{},10,20,{}'.format(full_url, text),
]
self.assert_csv_response(url, expected)


class TestIssuesSummaryCSV(CSVTestCase):
def test_get(self):
Expand Down
2 changes: 1 addition & 1 deletion mdn/views.py
Expand Up @@ -2,7 +2,6 @@
from collections import Counter
from json import loads
from math import floor
import csv

from django import forms
from django.contrib.auth.decorators import user_passes_test
Expand All @@ -15,6 +14,7 @@
from django.views.generic.base import TemplateResponseMixin, View
from django.views.generic.detail import BaseDetailView
from django.views.generic.edit import CreateView, FormMixin, UpdateView
import unicodecsv as csv

from .models import FeaturePage, Issue, ISSUES, SEVERITIES, validate_mdn_url
from .tasks import start_crawl, parse_page
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Expand Up @@ -84,3 +84,6 @@ requests==2.7.0
oauthlib==1.0.3
requests-oauthlib==0.5.0
django-allauth==0.23.0

# Unicode-aware CSVs
unicodecsv==0.14.1

0 comments on commit 5eccd8a

Please sign in to comment.