changeset 3609:f2fda3e6fc8b

umask is now configurable (with the same 0002 default)
author Richard Jones <richard@users.sourceforge.net>
date Thu, 27 Apr 2006 04:59:37 +0000
parents 19c0ee158c29
children 1dbaa664be28
files CHANGES.txt roundup/backends/back_anydbm.py roundup/backends/back_metakit.py roundup/backends/back_sqlite.py roundup/backends/sessions_dbm.py roundup/configuration.py roundup/scripts/roundup_server.py scripts/imapServer.py
diffstat 8 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Thu Apr 27 04:14:48 2006 +0000
+++ b/CHANGES.txt	Thu Apr 27 04:59:37 2006 +0000
@@ -18,6 +18,7 @@
 - dangling connections in session handling (sf bug 1463359)
 - reduced frequency of session timestamp update
 - classhelp popup pagination forgot about "type" (sf bug 1465836)
+- umask is now configurable (with the same 0002 default)
 
 
 2006-03-03 1.1.1
--- a/roundup/backends/back_anydbm.py	Thu Apr 27 04:14:48 2006 +0000
+++ b/roundup/backends/back_anydbm.py	Thu Apr 27 04:59:37 2006 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 #
-#$Id: back_anydbm.py,v 1.198 2006-04-27 01:39:47 richard Exp $
+#$Id: back_anydbm.py,v 1.199 2006-04-27 04:59:37 richard Exp $
 '''This module defines a backend that saves the hyperdatabase in a
 database chosen by anydbm. It is guaranteed to always be available in python
 versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -96,8 +96,7 @@
         self.transactions = []
         self.indexer = Indexer(self)
         self.security = security.Security(self)
-        # ensure files are group readable and writable
-        os.umask(0002)
+        os.umask(config.UMASK)
 
         # lock it
         lockfilenm = os.path.join(self.dir, 'lock')
--- a/roundup/backends/back_metakit.py	Thu Apr 27 04:14:48 2006 +0000
+++ b/roundup/backends/back_metakit.py	Thu Apr 27 04:59:37 2006 +0000
@@ -1,4 +1,4 @@
-# $Id: back_metakit.py,v 1.107 2006-04-27 01:39:47 richard Exp $
+# $Id: back_metakit.py,v 1.108 2006-04-27 04:59:37 richard Exp $
 '''Metakit backend for Roundup, originally by Gordon McMillan.
 
 Known Current Bugs:
@@ -100,7 +100,7 @@
         self.stats = {'cache_hits': 0, 'cache_misses': 0, 'get_items': 0,
             'filtering': 0}
 
-        os.umask(0002)
+        os.umask(config.UMASK)
 
     def post_init(self):
         if self.indexer.should_reindex():
--- a/roundup/backends/back_sqlite.py	Thu Apr 27 04:14:48 2006 +0000
+++ b/roundup/backends/back_sqlite.py	Thu Apr 27 04:59:37 2006 +0000
@@ -1,4 +1,4 @@
-# $Id: back_sqlite.py,v 1.43 2005-06-08 03:41:21 anthonybaxter Exp $
+# $Id: back_sqlite.py,v 1.44 2006-04-27 04:59:37 richard Exp $
 '''Implements a backend for SQLite.
 
 See https://pysqlite.sourceforge.net/ for pysqlite info
@@ -94,7 +94,7 @@
 
     def open_connection(self):
         # ensure files are group readable and writable
-        os.umask(0002)
+        os.umask(self.config.UMASK)
 
         (self.conn, self.cursor) = self.sql_open_connection()
 
--- a/roundup/backends/sessions_dbm.py	Thu Apr 27 04:14:48 2006 +0000
+++ b/roundup/backends/sessions_dbm.py	Thu Apr 27 04:59:37 2006 +0000
@@ -1,4 +1,4 @@
-#$Id: sessions_dbm.py,v 1.6 2006-04-27 04:03:11 richard Exp $
+#$Id: sessions_dbm.py,v 1.7 2006-04-27 04:59:37 richard Exp $
 """This module defines a very basic store that's used by the CGI interface
 to store session and one-time-key information.
 
@@ -19,8 +19,7 @@
     def __init__(self, db):
         self.config = db.config
         self.dir = db.config.DATABASE
-        # ensure files are group readable and writable
-        os.umask(0002)
+        os.umask(db.config.UMASK)
 
     def exists(self, infoid):
         db = self.opendb('c')
--- a/roundup/configuration.py	Thu Apr 27 04:14:48 2006 +0000
+++ b/roundup/configuration.py	Thu Apr 27 04:59:37 2006 +0000
@@ -1,6 +1,6 @@
 # Roundup Issue Tracker configuration support
 #
-# $Id: configuration.py,v 1.33 2006-02-08 03:47:28 richard Exp $
+# $Id: configuration.py,v 1.34 2006-04-27 04:59:37 richard Exp $
 #
 __docformat__ = "restructuredtext"
 
@@ -353,6 +353,19 @@
         except ValueError:
             raise OptionValueError(self, value, "Integer number required")
 
+class OctalNumberOption(Option):
+
+    """Octal Integer numbers"""
+
+    def str2value(self, value):
+        try:
+            return int(value, 8)
+        except ValueError:
+            raise OptionValueError(self, value, "Octal Integer number required")
+
+    def _value2str(self, value):
+        return oct(value)
+
 class NullableOption(Option):
 
     """Option that is set to None if it's string value is one of NULL strings
@@ -466,6 +479,8 @@
             "Additional stop-words for the full-text indexer specific to\n"
             "your tracker. See the indexer source for the default list of\n"
             "stop-words (eg. A,AND,ARE,AS,AT,BE,BUT,BY, ...)"),
+        (OctalNumberOption, "umask", "02",
+            "Defines the file creation mode mask."),
     )),
     ("tracker", (
         (Option, "name", "Roundup issue tracker",
--- a/roundup/scripts/roundup_server.py	Thu Apr 27 04:14:48 2006 +0000
+++ b/roundup/scripts/roundup_server.py	Thu Apr 27 04:59:37 2006 +0000
@@ -17,7 +17,7 @@
 
 """Command-line script that runs a server over roundup.cgi.client.
 
-$Id: roundup_server.py,v 1.82 2006-02-22 05:40:56 a1s Exp $
+$Id: roundup_server.py,v 1.83 2006-04-27 04:59:37 richard Exp $
 """
 __docformat__ = 'restructuredtext'
 
@@ -657,7 +657,6 @@
         os._exit(0)
 
     os.chdir("/")
-    os.umask(0)
 
     # close off std(in|out|err), redirect to devnull so the file
     # descriptors can't be used again
--- a/scripts/imapServer.py	Thu Apr 27 04:14:48 2006 +0000
+++ b/scripts/imapServer.py	Thu Apr 27 04:59:37 2006 +0000
@@ -263,9 +263,6 @@
                 pidfile.close()
             os._exit(0)
 
-        #os.chdir("/")
-        #os.umask(0)
-
     def run(self):
         """Run email gathering daemon.
 

Roundup Issue Tracker: http://roundup-tracker.org/