Index: pykota/trunk/cgi-bin/printquota.cgi
===================================================================
--- pykota/trunk/cgi-bin/printquota.cgi (revision 3411)
+++ pykota/trunk/cgi-bin/printquota.cgi (revision 3413)
@@ -11,10 +11,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -68,5 +68,5 @@
           </tr>
         </table>"""
-    
+
 footer = """
         <table>
@@ -76,5 +76,5 @@
             </td>
           </tr>
-        </table>  
+        </table>
       </form>
     </p>
@@ -83,5 +83,5 @@
       <font size="-2">
         <a href="http://www.pykota.com/">%s</a>
-        &copy; %s %s 
+        &copy; %s %s
         <br />
         <pre>
@@ -91,5 +91,5 @@
     </p>
   </body>
-</html>"""  
+</html>"""
 
 class PyKotaReportGUI(PyKotaTool) :
@@ -104,20 +104,20 @@
                               version.__version__, _("PyKota Reports"), \
                               _("Report")) ]
-        content.append(self.body)                      
-        content.append(footer % (_("Report"), 
-                                 version.__doc__, 
-                                 version.__years__, 
-                                 version.__author__, 
+        content.append(self.body)
+        content.append(footer % (_("Report"),
+                                 version.__doc__,
+                                 version.__years__,
+                                 version.__author__,
                                  saxutils.escape(version.__gplblurb__)))
         for c in content :
             sys.stdout.write(c.encode(self.charset, "replace"))
         sys.stdout.flush()
-        
+
     def error(self, message) :
         """Adds an error message to the GUI's body."""
         if message :
             self.body = '<p><font color="red">%s</font></p>\n%s' % (message, self.body)
-        
-    def htmlListPrinters(self, selected=[], mask="*") :    
+
+    def htmlListPrinters(self, selected=[], mask="*") :
         """Displays the printers multiple selection list."""
         printers = self.storage.getMatchingPrinters(mask)
@@ -131,24 +131,24 @@
         message += '</select></td></tr></table>'
         return message
-        
-    def htmlUGNamesInput(self, value="*") :    
+
+    def htmlUGNamesInput(self, value="*") :
         """Input field for user/group names wildcard."""
         return _("User / Group names mask") + (' : <input type="text" name="ugmask" size="20" value="%s" /> <em>e.g. <strong>jo*</strong></em>' % (value or "*"))
-        
+
     def htmlGroupsCheckbox(self, isgroup=0) :
         """Groups checkbox."""
         if isgroup :
             return _("Groups report") + ' : <input type="checkbox" checked="checked" name="isgroup" />'
-        else :    
+        else :
             return _("Groups report") + ' : <input type="checkbox" name="isgroup" />'
-            
+
     def guiAction(self) :
         """Main function"""
         printers = ugmask = isgroup = None
-        remuser = os.environ.get("REMOTE_USER", "root")    
+        remuser = os.environ.get("REMOTE_USER", "root")
         # special hack to accomodate mod_auth_ldap Apache module
         try :
             remuser = remuser.split("=")[1].split(",")[0]
-        except IndexError :    
+        except IndexError :
             pass
         self.body = "<p>%s</p>\n" % _("Please click on the above button")
@@ -159,25 +159,25 @@
                     printersfield = [ printersfield ]
                 printers = [self.storage.getPrinter(p.value) for p in printersfield]
-            else :    
+            else :
                 printers = self.storage.getMatchingPrinters("*")
             if remuser == "root" :
-                if self.form.has_key("ugmask") :     
+                if self.form.has_key("ugmask") :
                     ugmask = self.form["ugmask"].value
-                else :     
+                else :
                     ugmask = "*"
-            else :        
-                if self.form.has_key("isgroup") :    
+            else :
+                if self.form.has_key("isgroup") :
                     user = self.storage.getUser(remuser)
                     if user.Exists :
                         ugmask = " ".join([ g.Name for g in self.storage.getUserGroups(user) ])
-                    else :    
+                    else :
                         ugmask = remuser # result will probably be empty, we don't care
-                else :    
+                else :
                     ugmask = remuser
-            if self.form.has_key("isgroup") :    
+            if self.form.has_key("isgroup") :
                 isgroup = 1
-            else :    
+            else :
                 isgroup = 0
-        self.body += self.htmlListPrinters(printers or [])            
+        self.body += self.htmlListPrinters(printers or [])
         self.body += "<br />"
         self.body += self.htmlUGNamesInput(ugmask)
@@ -189,32 +189,32 @@
                     self.reportingtool = openReporter(admin, "html", printers, ugmask.split(), isgroup)
                     self.body += "%s" % self.reportingtool.generateReport()
-            else :        
+            else :
                 if remuser != "root" :
                     username = remuser
-                elif self.form.has_key("username") :    
+                elif self.form.has_key("username") :
                     username = self.form["username"].value
-                else :    
+                else :
                     username = None
-                if username is not None :    
+                if username is not None :
                     user = self.storage.getUser(username)
-                else :    
+                else :
                     user = None
                 if self.form.has_key("printername") :
                     printer = self.storage.getPrinter(self.form["printername"].value)
-                else :    
+                else :
                     printer = None
-                if self.form.has_key("datelimit") :    
+                if self.form.has_key("datelimit") :
                     datelimit = self.form["datelimit"].value
-                else :    
+                else :
                     datelimit = None
-                if self.form.has_key("hostname") :    
+                if self.form.has_key("hostname") :
                     hostname = self.form["hostname"].value
-                else :    
+                else :
                     hostname = None
-                if self.form.has_key("billingcode") :    
+                if self.form.has_key("billingcode") :
                     billingcode = self.form["billingcode"].value
-                else :    
+                else :
                     billingcode = None
-                self.report = ["<h2>%s</h2>" % _("History")]    
+                self.report = ["<h2>%s</h2>" % _("History")]
                 history = self.storage.retrieveHistory(user=user, printer=printer, hostname=hostname, billingcode=billingcode, end=datelimit)
                 if not history :
@@ -232,8 +232,8 @@
                     for job in history :
                         oddeven += 1
-                        if job.JobAction == "ALLOW" :    
+                        if job.JobAction == "ALLOW" :
                             if oddeven % 2 :
                                 oddevenclass = "odd"
-                            else :    
+                            else :
                                 oddevenclass = "even"
                         else :
@@ -243,9 +243,9 @@
                         if job.JobHostName :
                             hostname_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "hostname" : job.JobHostName}), job.JobHostName)
-                        else :    
+                        else :
                             hostname_url = None
                         if job.JobBillingCode :
                             billingcode_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "billingcode" : job.JobBillingCode}), job.JobBillingCode)
-                        else :    
+                        else :
                             billingcode_url = None
                         curdate = DateTime.ISO.ParseDateTime(str(job.JobDate)[:19])
@@ -286,12 +286,12 @@
                     if printer and printer.Exists :
                         dico.update({ "printername" : printer.Name })
-                    if hostname :    
+                    if hostname :
                         dico.update({ "hostname" : hostname })
                     prevurl = "%s?%s" % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode(dico))
                     self.report.append('<a href="%s">%s</a>' % (prevurl, _("Previous page")))
-                self.body = "\n".join(self.report)    
+                self.body = "\n".join(self.report)
         except :
                 self.body += '<p><font color="red">%s</font></p>' % self.crashed("CGI Error").replace("\n", "<br />")
-            
+
 if __name__ == "__main__" :
     utils.reinitcgilocale()
@@ -303,6 +303,6 @@
     try :
         admin.storage.close()
-    except (TypeError, NameError, AttributeError) :    
+    except (TypeError, NameError, AttributeError) :
         pass
-        
+
     sys.exit(0)
Index: pykota/trunk/cgi-bin/pykotme.cgi
===================================================================
--- pykota/trunk/cgi-bin/pykotme.cgi (revision 3411)
+++ pykota/trunk/cgi-bin/pykotme.cgi (revision 3413)
@@ -11,10 +11,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -38,5 +38,5 @@
 
 from pkpgpdls import analyzer, pdlparser
-    
+
 
 header = """Content-type: text/html;charset=%s
@@ -69,5 +69,5 @@
           </tr>
         </table>"""
-    
+
 footer = """
         <table>
@@ -77,5 +77,5 @@
             </td>
           </tr>
-        </table>  
+        </table>
       </form>
     </p>
@@ -84,5 +84,5 @@
       <font size="-2">
         <a href="http://www.pykota.com/">%s</a>
-        &copy; %s %s 
+        &copy; %s %s
         <br />
         <pre>
@@ -92,5 +92,5 @@
     </p>
   </body>
-</html>"""  
+</html>"""
 
 class PyKotMeGUI(PyKotaTool) :
@@ -106,19 +106,19 @@
                         _("Quote")) ]
         content.append(self.body)
-        content.append(footer % (_("Quote"), 
-                                 version.__doc__, 
-                                 version.__years__, 
-                                 version.__author__, 
+        content.append(footer % (_("Quote"),
+                                 version.__doc__,
+                                 version.__years__,
+                                 version.__author__,
                                  saxutils.escape(version.__gplblurb__)))
         for c in content :
             sys.stdout.write(c.encode(self.charset, "replace"))
         sys.stdout.flush()
-        
+
     def error(self, message) :
         """Adds an error message to the GUI's body."""
         if message :
             self.body = '<p><font color="red">%s</font></p>\n%s' % (message, self.body)
-        
-    def htmlListPrinters(self, selected=[], mask="*") :    
+
+    def htmlListPrinters(self, selected=[], mask="*") :
         """Displays the printers multiple selection list."""
         printers = self.storage.getMatchingPrinters(mask)
@@ -132,5 +132,5 @@
         message += '</select></td></tr></table>'
         return message
-        
+
     def guiAction(self) :
         """Main function"""
@@ -143,11 +143,11 @@
                     printersfield = [ printersfield ]
                 printers = [self.storage.getPrinter(p.value) for p in printersfield]
-            else :    
+            else :
                 printers = self.storage.getMatchingPrinters("*")
-            if self.form.has_key("inputfile") :    
+            if self.form.has_key("inputfile") :
                 inputfile = self.form["inputfile"].value
-                
-        if os.environ.get("REMOTE_USER") is not None :        
-            self.body += self.htmlListPrinters(printers or [])            
+
+        if os.environ.get("REMOTE_USER") is not None :
+            self.body += self.htmlListPrinters(printers or [])
             self.body += "<br />"
         self.body += _("Filename") + " : "
@@ -158,25 +158,25 @@
                 parser = analyzer.PDLAnalyzer(cStringIO.StringIO(inputfile))
                 jobsize = parser.getJobSize()
-            except pdlparser.PDLParserError, msg :    
+            except pdlparser.PDLParserError, msg :
                 self.body += '<p><font color="red">%s</font></p>' % msg
                 jobsize = 0 # unknown file format ?
-            else :    
+            else :
                 self.body += "<p>%s</p>" % (_("Job size : %i pages") % jobsize)
-                
+
             remuser = os.environ.get("REMOTE_USER")
             # special hack to accomodate mod_auth_ldap Apache module
             try :
                 remuser = remuser.split("=")[1].split(",")[0]
-            except :    
+            except :
                 pass
-            if not remuser :    
+            if not remuser :
                 self.body += "<p>%s</p>" % _("The exact cost of a print job can only be determined for a particular user. Please retry while logged-in.")
-            else :    
-                try :    
+            else :
+                try :
                     user = self.storage.getUser(remuser)
                     if user.Exists :
                         if user.LimitBy == "noprint" :
                             self.body += "<p>%s</p>" % _("Your account settings forbid you to print at this time.")
-                        else :    
+                        else :
                             for printer in printers :
                                 upquota = self.storage.getUserPQuota(user, printer)
@@ -184,15 +184,15 @@
                                     if printer.MaxJobSize and (jobsize > printer.MaxJobSize) :
                                         msg = _("You are not allowed to print so many pages on printer %s at this time.") % printer.Name
-                                    else :    
+                                    else :
                                         cost = upquota.computeJobPrice(jobsize)
                                         msg = _("Cost on printer %s : %.2f") % (printer.Name, cost)
                                         if printer.PassThrough :
                                             msg = "%s (%s)" % (msg, _("won't be charged, printer is in passthrough mode"))
-                                        elif user.LimitBy == "nochange" :    
+                                        elif user.LimitBy == "nochange" :
                                             msg = "%s (%s)" % (msg, _("won't be charged, your account is immutable"))
                                     self.body += "<p>%s</p>" % msg
                 except :
                     self.body += '<p><font color="red">%s</font></p>' % self.crashed("CGI Error").replace("\n", "<br />")
-            
+
 if __name__ == "__main__" :
     utils.reinitcgilocale()
@@ -204,6 +204,6 @@
     try :
         admin.storage.close()
-    except (TypeError, NameError, AttributeError) :    
+    except (TypeError, NameError, AttributeError) :
         pass
-        
+
     sys.exit(0)
Index: pykota/trunk/cgi-bin/README
===================================================================
--- pykota/trunk/cgi-bin/README (revision 3275)
+++ pykota/trunk/cgi-bin/README (revision 3413)
@@ -24,5 +24,5 @@
 Be sure to restrict access to these CGI scripts as necessary.
 
-If you protect access to printquota.cgi or dumpykota.cgi with 
+If you protect access to printquota.cgi or dumpykota.cgi with
 username+password authentication, the REMOTE_USER CGI environment variable
 is honored, so an user can only see his own datas, but not
@@ -36,7 +36,7 @@
 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 
+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.
 
@@ -45,7 +45,7 @@
 PyKota's pykotadmin.conf configuration file is necessary though.
 
-The web server doesn't need to be a print server nor a PyKota 
-Storage Backend server, but it must contain a correctly configured 
-PyKota installation. 
+The web server doesn't need to be a print server nor a PyKota
+Storage Backend server, but it must contain a correctly configured
+PyKota installation.
 
 ====================================================================
Index: pykota/trunk/cgi-bin/dumpykota.cgi
===================================================================
--- pykota/trunk/cgi-bin/dumpykota.cgi (revision 3411)
+++ pykota/trunk/cgi-bin/dumpykota.cgi (revision 3413)
@@ -11,10 +11,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -42,5 +42,5 @@
     <script type="text/javascript">
     <!--
-      function checkvalues() 
+      function checkvalues()
       {
           if ((document.mainform.format.value == "cups") && (document.mainform.datatype.value != "history"))
@@ -49,5 +49,5 @@
               return false;
           }
-          
+
           if (document.mainform.sum.checked && (document.mainform.datatype.value != "payments") && (document.mainform.datatype.value != "history"))
           {
@@ -55,5 +55,5 @@
               return false;
           }
-          
+
           if (document.mainform.sum.checked && (document.mainform.format.value == "cups"))
           {
@@ -61,5 +61,5 @@
               return false;
           }
-          
+
           return true;
       }
@@ -92,5 +92,5 @@
           %s
         </p>"""
-    
+
 footer = """
         <table>
@@ -100,12 +100,12 @@
             </td>
           </tr>
-        </table>  
+        </table>
       </form>
-    </p>  
+    </p>
     <hr width="25%%" />
     <p>
       <font size="-2">
         <a href="http://www.pykota.com/">%s</a>
-        &copy; %s %s 
+        &copy; %s %s
         <br />
         <pre>
@@ -115,5 +115,5 @@
     </p>
   </body>
-</html>"""  
+</html>"""
 
 class PyKotaDumperGUI(DumPyKota) :
@@ -137,14 +137,14 @@
         content.append(u"<br />")
         content.append(self.htmlSumCheckbox(self.options.sum))
-        content.append(footer % (_("Dump"), 
-                                 version.__doc__, 
-                                 version.__years__, 
-                                 version.__author__, 
+        content.append(footer % (_("Dump"),
+                                 version.__doc__,
+                                 version.__years__,
+                                 version.__author__,
                                  saxutils.escape(version.__gplblurb__)))
         for c in content :
             sys.stdout.write(c.encode(self.charset, "replace"))
         sys.stdout.flush()
-        
-    def htmlListDataTypes(self, selected="") :    
+
+    def htmlListDataTypes(self, selected="") :
         """Displays the datatype selection list."""
         message = '<table><tr><td valign="top">%s :</td><td valign="top"><select name="datatype">' % _("Data Type")
@@ -156,6 +156,6 @@
         message += '</select></td></tr></table>'
         return message
-        
-    def htmlListFormats(self, selected="") :    
+
+    def htmlListFormats(self, selected="") :
         """Displays the formats selection list."""
         message = '<table><tr><td valign="top">%s :</td><td valign="top"><select name="format">' % _("Output Format")
@@ -167,24 +167,24 @@
         message += '</select></td></tr></table>'
         return message
-        
-    def htmlFilterInput(self, value="") :    
+
+    def htmlFilterInput(self, value="") :
         """Input the optional dump filter."""
         return _("Filter") + (' : <input type="text" name="filter" size="40" value="%s" /> <em>e.g. <strong>username=jerome printername=HP2100 start=today-30</strong></em>' % (value or ""))
-        
-    def htmlOrderbyInput(self, value="") :    
+
+    def htmlOrderbyInput(self, value="") :
         """Input the optional ordering."""
         return _("Ordering") + (' : <input type="text" name="orderby" size="40" value="%s" /> <em>e.g. <strong>+username,-printername</strong></em>' % (value or ""))
-        
-    def htmlSumCheckbox(self, checked="") :    
+
+    def htmlSumCheckbox(self, checked="") :
         """Input the optional Sum option."""
         return _("Summarize") + (' : <input type="checkbox" name="sum" %s /> <em>%s</em>' % ((checked and 'checked="checked"'), _("only for payments or history")))
-        
+
     def guiAction(self) :
         """Main function"""
         try :
             wantreport = self.form.has_key("report")
-        except TypeError :    
+        except TypeError :
             pass # WebDAV request probably, seen when trying to open a csv file in OOo
-        else :    
+        else :
             if wantreport :
                 try :
@@ -193,18 +193,18 @@
                     if self.form.has_key("format") :
                         self.options.format = self.form["format"].value
-                    if self.form.has_key("filter") :    
+                    if self.form.has_key("filter") :
                         self.arguments = self.form["filter"].value.split()
-                    if self.form.has_key("sum") :    
+                    if self.form.has_key("sum") :
                         self.options.sum = self.form["sum"].value
-                    if self.form.has_key("orderby") :    
+                    if self.form.has_key("orderby") :
                         self.options.orderby = self.form["orderby"].value
-                    # when no authentication is done, or when the remote username    
+                    # when no authentication is done, or when the remote username
                     # is 'root' (even if not run as root of course), then unrestricted
                     # dump is allowed.
-                    remuser = os.environ.get("REMOTE_USER", "root")    
+                    remuser = os.environ.get("REMOTE_USER", "root")
                     # special hack to accomodate mod_auth_ldap Apache module
                     try :
                         remuser = remuser.split("=")[1].split(",")[0]
-                    except IndexError :    
+                    except IndexError :
                         pass
                     if remuser != "root" :
@@ -214,6 +214,6 @@
                         if self.options.data not in ["printers", "pmembers", "groups", "gpquotas"] :
                             self.arguments.append("username=%s" % remuser)
-                        
-                    fname = "error"    
+
+                    fname = "error"
                     ctype = "text/plain"
                     if self.options.format in ("csv", "ssv") :
@@ -231,14 +231,14 @@
                         ctype = "text/plain"
                         fname = "page_log"
-                    print "Content-type: %s" % ctype    
-                    print "Content-disposition: attachment; filename=%s" % fname 
+                    print "Content-type: %s" % ctype
+                    print "Content-disposition: attachment; filename=%s" % fname
                     print
                     self.main(self.arguments, self.options, restricted=0)
                 except :
                     print 'Content-type: text/html\n\n<html><head><title>CGI Error</title></head><body><p><font color="red">%s</font></p></body></html>' % self.crashed("CGI Error").replace("\n", "<br />")
-            else :        
+            else :
                 self.guiDisplay()
-            
-class FakeCommandLineOptions :            
+
+class FakeCommandLineOptions :
     """A class to fake command line options."""
     output = "-"
@@ -247,5 +247,5 @@
     sum = None
     orderby = None
-    
+
 if __name__ == "__main__" :
     utils.reinitcgilocale()
@@ -258,6 +258,6 @@
     try :
         admin.storage.close()
-    except (TypeError, NameError, AttributeError) :    
+    except (TypeError, NameError, AttributeError) :
         pass
-        
+
     sys.exit(0)
