Index: /pykota/trunk/bin/pykotme
===================================================================
--- /pykota/trunk/bin/pykotme (revision 2216)
+++ /pykota/trunk/bin/pykotme (revision 2232)
@@ -104,19 +104,20 @@
                 self.printInfo(msg)
             
-        # get current user
-        username = pwd.getpwuid(os.geteuid())[0]
+        printers = self.storage.getMatchingPrinters(options["printer"])
+        if not printers :
+            raise PyKotaToolError, _("There's no printer matching %s") % options["printer"]
+            
+        username = pwd.getpwuid(os.getuid())[0]
         user = self.storage.getUser(username)
         if user.Exists and user.LimitBy and (user.LimitBy.lower() == "balance"):
             print _("Your account balance : %.2f") % (user.AccountBalance or 0.0)
             
-        printers = self.storage.getMatchingPrinters(options["printer"])
-        if not printers :
-            raise PyKotaToolError, _("There's no printer matching %s") % options["printer"]
-            
         print _("Job size : %i pages") % totalsize    
-        for printer in printers :
-            userpquota = self.storage.getUserPQuota(user, printer)
-            cost = userpquota.computeJobPrice(totalsize)
-            print _("Cost on printer %s : %.2f") % (printer.Name, cost)
+        if user.Exists :
+            for printer in printers :
+                userpquota = self.storage.getUserPQuota(user, printer)
+                if userpquota.Exists :
+                    cost = userpquota.computeJobPrice(totalsize)
+                    print _("Cost on printer %s : %.2f") % (printer.Name, cost)
             
 if __name__ == "__main__" : 
Index: /pykota/trunk/bin/pykosd
===================================================================
--- /pykota/trunk/bin/pykosd (revision 2216)
+++ /pykota/trunk/bin/pykosd (revision 2232)
@@ -117,5 +117,5 @@
         savecolor = color
         
-        uname = pwd.getpwuid(os.geteuid())[0]
+        uname = pwd.getpwuid(os.getuid())[0]
         while 1 :
             color = savecolor
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 2229)
+++ /pykota/trunk/NEWS (revision 2232)
@@ -24,4 +24,8 @@
     - 1.22beta :
     
+        - Improved stability in pykotme and pykotme.cgi.
+        
+        - Fixed a permission problem in pykotme and pykosd.
+        
         - Fixed an inconsitency between SQL and LDAP backends'
           behavior in edpykota.
Index: /pykota/trunk/cgi-bin/pykotme.cgi
===================================================================
--- /pykota/trunk/cgi-bin/pykotme.cgi (revision 2229)
+++ /pykota/trunk/cgi-bin/pykotme.cgi (revision 2232)
@@ -145,8 +145,10 @@
                 try :    
                     user = self.storage.getUser(remuser)
-                    for printer in printers :
-                        upquota = self.storage.getUserPQuota(user, printer)
-                        cost = upquota.computeJobPrice(jobsize)
-                        self.body += "<p>%s</p>" % (_("Cost on printer %s : %.2f") % (printer.Name, cost))
+                    if user.Exists :
+                        for printer in printers :
+                            upquota = self.storage.getUserPQuota(user, printer)
+                            if upquota.Exists :
+                                cost = upquota.computeJobPrice(jobsize)
+                                self.body += "<p>%s</p>" % (_("Cost on printer %s : %.2f") % (printer.Name, cost))
                 except :
                     self.body += '<p><font color="red">%s</font></p>' % self.crashed("CGI Error").replace("\n", "<br />")
Index: /pykota/trunk/cgi-bin/README
===================================================================
--- /pykota/trunk/cgi-bin/README (revision 2153)
+++ /pykota/trunk/cgi-bin/README (revision 2232)
@@ -25,6 +25,4 @@
 Be sure to restrict access to these CGI scripts as necessary.
 
-For now, pykotme.cgi doesn't need any restriction.
-
 If you protect access to printquota.cgi or dumpykota.cgi with 
 username+password authentication, the REMOTE_USER CGI environment variable
@@ -35,4 +33,12 @@
 If no username+password authentication takes place, then access
 is completely unrestricted.
+
+If you don't protect access to pykotme.cgi with username+password
+authentication, then only the job's size will be displayed
+to you. This is due to the cost of a print job on a particular printer
+depending on the user because of the overcharging factor's value. 
+So if you want pykotme.cgi to produce complete web quotes, you must 
+ensure that the user logs in from his web browser whenever he uses 
+this CGI script.
 
 You must ensure that the user your web server runs as can read
