--- a/src/p4l/management/commands/dump_record.py Tue Oct 01 02:53:54 2013 +0200
+++ b/src/p4l/management/commands/dump_record.py Wed Oct 02 05:23:00 2013 +0200
@@ -76,7 +76,7 @@
dest= 'batch',
type='int',
default=100,
- help= 'query batch default 500.'
+ help= 'query batch default 100.'
),
make_option('-j', '--bzip2',
dest= 'bzip2',
@@ -130,16 +130,18 @@
open_method = None
open_args = []
+ decode_method = lambda s: s
if bzip2:
open_method = bz2.BZ2File
- open_args = [filepath, 'wb', 9]
+ open_args = [filepath, 'wb', 9]
elif gzip_opt:
open_method = gzip.GzipFile
open_args = [filepath, 'wb', 9]
else:
open_method = codecs.open
open_args = [filepath, 'wb', "utf-8"]
+ decode_method = lambda s: s.decode("utf-8")
total_records = qs.count()
@@ -162,7 +164,7 @@
if "<iiep:Record" in line:
do_write = True
if do_write:
- dest_file.write(line.decode("utf-8"))
+ dest_file.write(decode_method(line))
if "</iiep:Record>" in line:
break