[Yt-svn] yt-commit r1107 - trunk/yt/lagos

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Mon Jan 12 16:29:29 PST 2009


Author: britton
Date: Mon Jan 12 16:29:29 2009
New Revision: 1107
URL: http://yt.spacepope.org/changeset/1107

Log:
Data_mode for yt file was being set to read-only if the file did not exist at 
all.  Now, if file does not exist, the code checks to see if the directory 
is writable and goes from that.


Modified:
   trunk/yt/lagos/HierarchyType.py

Modified: trunk/yt/lagos/HierarchyType.py
==============================================================================
--- trunk/yt/lagos/HierarchyType.py	(original)
+++ trunk/yt/lagos/HierarchyType.py	Mon Jan 12 16:29:29 2009
@@ -114,8 +114,11 @@
         else:
             fn = os.path.join(self.directory,
                     "%s.yt" % self.parameter_file.basename)
-        if ytcfg.getboolean('lagos','onlydeserialize') or \
-           not os.access(fn, os.W_OK):
+        if os.path.isfile(fn):
+            writable = os.access(fn, os.W_OK)
+        else:
+            writable = os.access(self.directory, os.W_OK)
+        if ytcfg.getboolean('lagos','onlydeserialize') or not writable:
             self._data_mode = mode = 'r'
         else:
             self._data_mode = mode = 'a'



More information about the yt-svn mailing list