All pastes #426103 Raw Edit

Something

public text v1 · immutable
·published 2007-04-05 22:13 UTC
rendered paste body
Index: /home/heikki/workspace/chandler/parcels/osaf/dumpreload.py
===================================================================
--- /home/heikki/workspace/chandler/parcels/osaf/dumpreload.py	(revision 13830)
+++ /home/heikki/workspace/chandler/parcels/osaf/dumpreload.py	(working copy)
@@ -15,7 +15,7 @@
 
 """Dump and Reload module"""
 
-import logging, cPickle, sys
+import logging, cPickle, sys, os
 from osaf import pim, sharing
 from osaf.sharing.eim import uri_registry, RecordClass
 from application import schema
@@ -77,8 +77,9 @@
 
 def dump(rv, filename, uuids=None, translator=sharing.DumpTranslator,
     serializer=PickleSerializer, activity=None):
-
-    """ Dumps EIM records to a file """
+    """
+    Dumps EIM records to a file, file permissions 0700.
+    """
 
     if uuids is None:
         uuids = set()
@@ -90,7 +91,11 @@
 
     trans.startExport()
 
-    output = open(filename, "wb")
+    try:
+        flags = os.O_CREAT | os.O_WRONLY | os.O_BINARY
+    except AttributeError:
+        flags = os.O_CREAT | os.O_WRONLY
+    output = os.fdopen(os.open(filename, flags, 0700), 'wb')
     try:
         dump = serializer.dumper(output)