mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-24 01:57:32 +01:00
Don't install unicodecsv on Python 3 and fallback to pythons built in csv library it it isn't installed.
This commit is contained in:
parent
2dd45a8e71
commit
1cc258f404
44
setup.py
44
setup.py
@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
try:
|
||||
from setuptools import setup, find_packages
|
||||
except ImportError:
|
||||
@ -16,6 +19,31 @@ except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
|
||||
install_requires = [
|
||||
"Django>=1.6.2,<1.7",
|
||||
"South>=0.8.4",
|
||||
"django-compressor>=1.3",
|
||||
"django-libsass>=0.1",
|
||||
"django-modelcluster>=0.1",
|
||||
"django-taggit==0.11.2",
|
||||
"django-treebeard==2.0",
|
||||
"Pillow>=2.3.0",
|
||||
"beautifulsoup4>=4.3.2",
|
||||
"lxml>=3.3.0",
|
||||
"Unidecode>=0.04.14",
|
||||
"BeautifulSoup==3.2.1", # django-compressor gets confused if we have lxml but not BS3 installed
|
||||
]
|
||||
|
||||
|
||||
if not PY3:
|
||||
install_requires += [
|
||||
"unicodecsv>=0.9.4"
|
||||
]
|
||||
|
||||
|
||||
setup(
|
||||
name='wagtail',
|
||||
version='0.3.1',
|
||||
@ -40,20 +68,6 @@ setup(
|
||||
'Framework :: Django',
|
||||
'Topic :: Internet :: WWW/HTTP :: Site Management',
|
||||
],
|
||||
install_requires=[
|
||||
"Django>=1.6.2,<1.7",
|
||||
"South>=0.8.4",
|
||||
"django-compressor>=1.3",
|
||||
"django-libsass>=0.1",
|
||||
"django-modelcluster>=0.1",
|
||||
"django-taggit==0.11.2",
|
||||
"django-treebeard==2.0",
|
||||
"Pillow>=2.3.0",
|
||||
"beautifulsoup4>=4.3.2",
|
||||
"lxml>=3.3.0",
|
||||
'unicodecsv>=0.9.4',
|
||||
'Unidecode>=0.04.14',
|
||||
"BeautifulSoup==3.2.1", # django-compressor gets confused if we have lxml but not BS3 installed
|
||||
],
|
||||
install_requires=install_requires,
|
||||
zip_safe=False,
|
||||
)
|
||||
|
@ -1,5 +1,11 @@
|
||||
import datetime
|
||||
import unicodecsv
|
||||
|
||||
try:
|
||||
import unicodecsv as csv
|
||||
using_unicodecsv = True
|
||||
except ImportError:
|
||||
import csv
|
||||
using_unicodecsv = False
|
||||
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from django.core.exceptions import PermissionDenied
|
||||
@ -65,7 +71,11 @@ def list_submissions(request, page_id):
|
||||
# return a CSV instead
|
||||
response = HttpResponse(content_type='text/csv; charset=utf-8')
|
||||
response['Content-Disposition'] = 'attachment;filename=export.csv'
|
||||
writer = unicodecsv.writer(response, encoding='utf-8')
|
||||
|
||||
if using_unicodecsv:
|
||||
writer = csv.writer(response, encoding='utf-8')
|
||||
else:
|
||||
writer = csv.writer(response)
|
||||
|
||||
header_row = ['Submission date'] + [label for name, label in data_fields]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user