[Greater-commits] r445 - trunk/GREAT-ER-DB/tools
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jul 14 11:22:07 CEST 2011
Author: aheinecke
Date: 2011-07-14 11:22:06 +0200 (Thu, 14 Jul 2011)
New Revision: 445
Modified:
trunk/GREAT-ER-DB/tools/export_blobs.py
Log:
Write and read files in binary format to avoid line ending corruption
Modified: trunk/GREAT-ER-DB/tools/export_blobs.py
===================================================================
--- trunk/GREAT-ER-DB/tools/export_blobs.py 2011-07-14 09:18:45 UTC (rev 444)
+++ trunk/GREAT-ER-DB/tools/export_blobs.py 2011-07-14 09:22:06 UTC (rev 445)
@@ -52,10 +52,11 @@
output += ", ".join([pretty_attr(bin_obj.__getattr__(field)) \
for field in fields[:-1]])
output += ", lo_import('%d.obj'));\n" % bin_obj.bin_obj_id
+
return output
def write_file_obj(bin_obj):
- fptr = open("%d.obj" % bin_obj.bin_obj_id, "w")
+ fptr = open("%d.obj" % bin_obj.bin_obj_id, "wb")
fptr.write(bin_obj.file_obj)
fptr.close()
@@ -66,10 +67,10 @@
all_objs = da_get_bin_obj(-1, "%", -1, "Y")
sql_file = open("insert_bin_obj.sql", "w")
+ grant_file = open("grant_file_obj.sql", "w")
for bin_obj in all_objs:
sql_file.write(bin_obj_to_stmt(bin_obj))
write_file_obj(bin_obj)
-
if __name__ == '__main__':
main()
More information about the Greater-commits
mailing list