Index: /pykota/trunk/setup.py
===================================================================
--- /pykota/trunk/setup.py (revision 870)
+++ /pykota/trunk/setup.py (revision 872)
@@ -17,4 +17,10 @@
 #
 # $Log$
+# Revision 1.5  2003/03/29 13:08:28  jalet
+# Configuration is now expected to be found in /etc/pykota.conf instead of
+# in /etc/cups/pykota.conf
+# Installation script can move old config files to the new location if needed.
+# Better error handling if configuration file is absent.
+#
 # Revision 1.4  2003/03/29 09:47:00  jalet
 # More powerful installation script.
@@ -81,8 +87,28 @@
     
 if "install" in sys.argv :
+    # checks if Python version is correct, we need >= 2.1
     if not (sys.version > "2.1") :
         sys.stderr.write("PyKota needs at least Python v2.1 !\nYour version seems to be older than that, please update.\nAborted !\n")
         sys.exit(-1)
         
+    # checks if a configuration file is present in the old location
+    if os.path.isfile("/etc/cups/pykota.conf") :
+        if not os.path.isfile("/etc/pykota.conf") :
+            sys.stdout.write("From version 1.02 on, PyKota expects to find its configuration file in /etc instead of /etc/cups.\n")
+            sys.stdout.write("It seems that you've got a configuration file in the old location, so it will not be used anymore, and no configuration file in the new location.\n")
+            answer = raw_input("Do you want me to move your configuration file to the new location in /etc (y/N) ? ")
+            if answer[0:1].upper() == 'Y' :
+                try :
+                    os.rename("/etc/cups/pykota.conf", "/etc/pykota.conf")
+                except OSError :    
+                    sys.stderr.write("ERROR : An error occured while moving /etc/cups/pykota.conf to /etc/pykota.conf\nAborted !\n")
+                    sys.exit(-1)
+            else :
+                sys.stderr.write("WARNING : Configuration file /etc/cups/pykota.conf won't be used ! Move it to /etc instead.\n")
+                sys.stderr.write("PyKota installation will continue anyway, but the software won't run until you put a proper configuration file in /etc\n")
+        else :        
+            sys.stderr.write("WARNING : Configuration file /etc/cups/pykota.conf will not be used !\nThe file /etc/pykota.conf will be used instead.\n")
+    
+    # checks if some needed Python modules are there or not.
     modulestocheck = [("PygreSQL", "pg"), ("mxDateTime", "mx.DateTime")]
     commandstocheck = [("SNMP Tools", "snmpget")]
@@ -93,4 +119,5 @@
             sys.exit(-1)
             
+    # checks if some software are there or not.
     for (name, command) in commandstocheck :
         action = checkWithPrompt(name, command=command)
Index: /pykota/trunk/pykota/tool.py
===================================================================
--- /pykota/trunk/pykota/tool.py (revision 852)
+++ /pykota/trunk/pykota/tool.py (revision 872)
@@ -15,4 +15,10 @@
 #
 # $Log$
+# Revision 1.28  2003/03/29 13:08:28  jalet
+# Configuration is now expected to be found in /etc/pykota.conf instead of
+# in /etc/cups/pykota.conf
+# Installation script can move old config files to the new location if needed.
+# Better error handling if configuration file is absent.
+#
 # Revision 1.27  2003/03/15 23:01:28  jalet
 # New mailto option in configuration file added.
@@ -144,5 +150,5 @@
         # pykota specific stuff
         self.documentation = doc
-        self.config = config.PyKotaConfig(os.environ.get("CUPS_SERVERROOT", "/etc/cups"))
+        self.config = config.PyKotaConfig("/etc")
         self.logger = logger.openLogger(self.config)
         self.storage = storage.openConnection(self.config, asadmin=(not isfilter))
Index: /pykota/trunk/pykota/config.py
===================================================================
--- /pykota/trunk/pykota/config.py (revision 854)
+++ /pykota/trunk/pykota/config.py (revision 872)
@@ -15,4 +15,10 @@
 #
 # $Log$
+# Revision 1.20  2003/03/29 13:08:28  jalet
+# Configuration is now expected to be found in /etc/pykota.conf instead of
+# in /etc/cups/pykota.conf
+# Installation script can move old config files to the new location if needed.
+# Better error handling if configuration file is absent.
+#
 # Revision 1.19  2003/03/16 09:56:52  jalet
 # Mailto option now accepts some additional values which all mean that
@@ -108,4 +114,6 @@
         """Reads and checks the configuration file."""
         self.filename = os.path.join(directory, "pykota.conf")
+        if not os.path.isfile(self.filename) :
+            raise PyKotaConfigError, _("Configuration file %s not found.") % self.filename
         self.config = ConfigParser.ConfigParser()
         self.config.read([self.filename])
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 871)
+++ /pykota/trunk/NEWS (revision 872)
@@ -22,4 +22,10 @@
           wants to continue with the installation or abort it.
           
+        - The configuration file pykota.conf is now expected to be 
+          found in /etc instead of in /etc/cups
+          The installation script prompts the user to see if he
+          wants to move an old configuration file to the new location
+          if needed.
+          
         - Improved documentation.
         
@@ -27,6 +33,5 @@
           Server is listening, see sample configuration file for details.
         
-        - Better error handling if PygreSQL is not installed or not 
-          available.
+        - Better general error handling.
         
     - 1.01 :
Index: /pykota/trunk/po/en/pykota.po
===================================================================
--- /pykota/trunk/po/en/pykota.po (revision 852)
+++ /pykota/trunk/po/en/pykota.po (revision 872)
@@ -15,4 +15,10 @@
 #
 # $Log$
+# Revision 1.11  2003/03/29 13:08:28  jalet
+# Configuration is now expected to be found in /etc/pykota.conf instead of
+# in /etc/cups/pykota.conf
+# Installation script can move old config files to the new location if needed.
+# Better error handling if configuration file is absent.
+#
 # Revision 1.10  2003/03/15 23:01:28  jalet
 # New mailto option in configuration file added.
@@ -226,2 +232,5 @@
 msgid "Option mailto in section %s only supports values in %s"
 msgstr ""
+
+msgid "Configuration file %s not found."
+msgstr ""
Index: /pykota/trunk/po/fr/pykota.po
===================================================================
--- /pykota/trunk/po/fr/pykota.po (revision 852)
+++ /pykota/trunk/po/fr/pykota.po (revision 872)
@@ -15,4 +15,10 @@
 #
 # $Log$
+# Revision 1.9  2003/03/29 13:08:28  jalet
+# Configuration is now expected to be found in /etc/pykota.conf instead of
+# in /etc/cups/pykota.conf
+# Installation script can move old config files to the new location if needed.
+# Better error handling if configuration file is absent.
+#
 # Revision 1.8  2003/03/15 23:01:28  jalet
 # New mailto option in configuration file added.
@@ -234,2 +240,5 @@
 msgid "Option mailto in section %s only supports values in %s"
 msgstr "L'option mailto dans la section %s supporte seulement les valeurs %s"
+
+msgid "Configuration file %s not found."
+msgstr "Fichier de configuration %s non trouv�
Index: /pykota/trunk/po/pykota.pot
===================================================================
--- /pykota/trunk/po/pykota.pot (revision 852)
+++ /pykota/trunk/po/pykota.pot (revision 872)
@@ -15,4 +15,10 @@
 #
 # $Log$
+# Revision 1.11  2003/03/29 13:08:28  jalet
+# Configuration is now expected to be found in /etc/pykota.conf instead of
+# in /etc/cups/pykota.conf
+# Installation script can move old config files to the new location if needed.
+# Better error handling if configuration file is absent.
+#
 # Revision 1.10  2003/03/15 23:01:28  jalet
 # New mailto option in configuration file added.
@@ -226,2 +232,5 @@
 msgid "Option mailto in section %s only supports values in %s"
 msgstr ""
+
+msgid "Configuration file %s not found."
+msgstr ""
