This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, master has been updated
via 2f4ecf9a0f8b34907fc4a71e99674f9d77f4acc2 (commit)
via 74519a65d4e63b84ccaeefbf151cac7e89eb58d9 (commit)
via fcac09d07a7701615ff8c3e11db423ff981a1658 (commit)
via 9ac6a41a1e20d0a3f5986a997d312693d8840bee (commit)
from 84e6bd0983563d428bc65bc643d6069d62e33cfb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/2f4ecf9a0f8b34907fc4a71e99674f9d77f4acc2
commit 2f4ecf9a0f8b34907fc4a71e99674f9d77f4acc2
Merge: 74519a6 fcac09d
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 23 17:35:52 2015 +0300
Merge pull request #93 from drnlm/fix_test_csvexport
On python3, zipfile deals in bytes
http://sourceforge.net/p/sqlobject/sqlobject/ci/74519a65d4e63b84ccaeefbf151cac7e89eb58d9
commit 74519a65d4e63b84ccaeefbf151cac7e89eb58d9
Merge: 84e6bd0 9ac6a41
Author: Oleg Broytman <ph...@ph...>
Date: Mon Feb 23 17:30:42 2015 +0300
Merge pull request #92 from drnlm/fix_test_enum
Don't unnecessarily encode enum on python 3 path
http://sourceforge.net/p/sqlobject/sqlobject/ci/fcac09d07a7701615ff8c3e11db423ff981a1658
commit fcac09d07a7701615ff8c3e11db423ff981a1658
Author: Neil <drn...@gm...>
Date: Mon Feb 23 15:32:16 2015 +0200
On python3, zipfile deals in bytes
diff --git a/sqlobject/tests/test_csvexport.py b/sqlobject/tests/test_csvexport.py
index 7f97f2d..b062d56 100644
--- a/sqlobject/tests/test_csvexport.py
+++ b/sqlobject/tests/test_csvexport.py
@@ -96,6 +96,6 @@ def test_zip():
ComplexCSV(fname='Bob', lname='Dylan', age=60)
ComplexCSV(fname='Harriet', lname='Tubman', age=160)
s = export_csv_zip([SimpleCSV, ComplexCSV])
- assert isinstance(s, str) and s
+ assert isinstance(s, bytes) and s
s = export_csv_zip([SimpleCSV.selectBy(name='Bob'),
(ComplexCSV, list(ComplexCSV.selectBy(fname='John')))])
diff --git a/sqlobject/util/csvexport.py b/sqlobject/util/csvexport.py
index 5169879..32a7f61 100644
--- a/sqlobject/util/csvexport.py
+++ b/sqlobject/util/csvexport.py
@@ -3,13 +3,14 @@ Exports a SQLObject class (possibly annotated) to a CSV file.
"""
import os
import csv
+import sys
try:
from cStringIO import StringIO
except ImportError:
try:
from StringIO import StringIO
except ImportError:
- from io import StringIO
+ from io import StringIO, BytesIO
import sqlobject
from sqlobject.compat import string_type
@@ -168,7 +169,11 @@ def export_csv_zip(soClasses, file=None, zip=None, filename_prefix='',
close_zip_when_finished = False
else:
return_when_finished = True
- file = StringIO()
+ if sys.version_info[0] < 3:
+ file = StringIO()
+ else:
+ # zipfile on python3 requires BytesIO
+ file = BytesIO()
if not zip:
zip = zipfile.ZipFile(file, mode='w')
http://sourceforge.net/p/sqlobject/sqlobject/ci/9ac6a41a1e20d0a3f5986a997d312693d8840bee
commit 9ac6a41a1e20d0a3f5986a997d312693d8840bee
Author: Neil <drn...@gm...>
Date: Mon Feb 23 15:28:51 2015 +0200
Don't unnecessarily encode enum on python 3 path
diff --git a/sqlobject/col.py b/sqlobject/col.py
index d8fdf78..6a4670e 100644
--- a/sqlobject/col.py
+++ b/sqlobject/col.py
@@ -1032,7 +1032,9 @@ class EnumValidator(SOValidator):
def to_python(self, value, state):
if value in self.enumValues:
- if isinstance(value, unicode_type):
+ # Only encode on python 2 - on python 3, the database driver
+ # will handle this
+ if isinstance(value, unicode_type) and sys.version_info[0] == 2:
dbEncoding = self.getDbEncoding(state)
value = value.encode(dbEncoding)
return value
-----------------------------------------------------------------------
Summary of changes:
sqlobject/col.py | 4 +++-
sqlobject/tests/test_csvexport.py | 2 +-
sqlobject/util/csvexport.py | 9 +++++++--
3 files changed, 11 insertions(+), 4 deletions(-)
hooks/post-receive
--
SQLObject development repository
|