review on imports & svn keywords
[sfa.git] / geni / util / hierarchy.py
index 742ab8b..dd2bd50 100644 (file)
 #      *.DBINFO - database info
 ##
 
+### $Id$
+### $URL$
+
 import os
 import report
-from cert import *
-from credential import *
-from gid import *
-from misc import *
-from config import *
-from geniticket import *
+
+from geni.util.cert import *
+from geni.util.credential import *
+from geni.util.gid import *
+from geni.util.misc import *
+from geni.util.config import *
+from geni.util.geniticket import *
 
 ##
 # The AuthInfo class contains the information for an authority. This information
@@ -78,24 +82,24 @@ class AuthInfo():
         f.close()
         return dict
 
-    ##\r
-    # Replace the GID with a new one. The file specified by gid_filename is\r
-    # overwritten with the new GID object\r
-    #\r
-    # @param gid object containing new GID\r
+    ##
+    # Replace the GID with a new one. The file specified by gid_filename is
+    # overwritten with the new GID object
+    #
+    # @param gid object containing new GID
 
     def update_gid_object(self, gid):
         gid.save_to_file(self.gid_filename)
         self.gid_object = gid
 
-##\r
-# The Hierarchy class is responsible for managing the tree of authorities.\r
-# Each authority is a node in the tree and exists as an AuthInfo object.\r
-#\r
-# The tree is stored on disk in a hierarchical manner than reflects the\r
-# structure of the tree. Each authority is a subdirectory, and each subdirectory\r
-# contains the GID, pkey, and dbinfo files for that authority (as well as\r
-# subdirectories for each sub-authority)\r
+##
+# The Hierarchy class is responsible for managing the tree of authorities.
+# Each authority is a node in the tree and exists as an AuthInfo object.
+#
+# The tree is stored on disk in a hierarchical manner than reflects the
+# structure of the tree. Each authority is a subdirectory, and each subdirectory
+# contains the GID, pkey, and dbinfo files for that authority (as well as
+# subdirectories for each sub-authority)
 
 class Hierarchy():
     ##
@@ -106,7 +110,7 @@ class Hierarchy():
     def __init__(self, basedir = None):
         if not basedir:
             config = Config()
-            basedir = config.basepath + os.sep + "authorities"
+            basedir = config.config_path + os.sep + "authorities"
         self.basedir = basedir
     ##
     # Given a hrn, return the filenames of the GID, private key, and dbinfo
@@ -134,7 +138,7 @@ class Hierarchy():
     def auth_exists(self, hrn):
         (directory, gid_filename, privkey_filename, dbinfo_filename) = \
             self.get_auth_filenames(hrn)
-    
+        
         return os.path.exists(gid_filename) and \
                os.path.exists(privkey_filename) and \
                os.path.exists(dbinfo_filename)
@@ -159,10 +163,10 @@ class Hierarchy():
 
         # create the directory to hold the files
         try:
-            os.makedirs(directory)\r
-        # if the path already exists then pass\r
-        except OSError, (errno, strerr):\r
-            if errno == 17:\r
+            os.makedirs(directory)
+        # if the path already exists then pass
+        except OSError, (errno, strerr):
+            if errno == 17:
                 pass
 
         if os.path.exists(privkey_filename):
@@ -179,7 +183,7 @@ class Hierarchy():
 
         dbinfo = get_default_dbinfo()
         dbinfo_file = file(dbinfo_filename, "w")
-        dbinfo_file.write(str(dbinfo))\r
+        dbinfo_file.write(str(dbinfo))
         dbinfo_file.close()
 
     ##