Index: pykota/trunk/pykota/storages/sql.py
===================================================================
--- pykota/trunk/pykota/storages/sql.py (revision 1358)
+++ pykota/trunk/pykota/storages/sql.py (revision 1451)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.38  2004/05/06 12:37:47  jalet
+# pkpgcounter : comments
+# pkprinters : when --add is used, existing printers are now skipped.
+#
 # Revision 1.37  2004/02/23 22:53:21  jalet
 # Don't retrieve data when it's not needed, to avoid database queries
@@ -63,4 +67,5 @@
             fields = result[0]
             user.ident = fields.get("id")
+            user.Name = fields.get("username", username)
             user.LimitBy = fields.get("limitby")
             user.AccountBalance = fields.get("balance")
@@ -77,4 +82,5 @@
             fields = result[0]
             group.ident = fields.get("id")
+            group.Name = fields.get("groupname", groupname)
             group.LimitBy = fields.get("limitby")
             result = self.doSearch("SELECT SUM(balance) AS balance, SUM(lifetimepaid) AS lifetimepaid FROM users WHERE id IN (SELECT userid FROM groupsmembers WHERE groupid=%s)" % self.doQuote(group.ident))
@@ -93,4 +99,5 @@
             fields = result[0]
             printer.ident = fields.get("id")
+            printer.Name = fields.get("printername", printername)
             printer.PricePerJob = fields.get("priceperjob")
             printer.PricePerPage = fields.get("priceperpage")
Index: pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- pykota/trunk/pykota/storages/ldapstorage.py (revision 1393)
+++ pykota/trunk/pykota/storages/ldapstorage.py (revision 1451)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.63  2004/05/06 12:37:46  jalet
+# pkpgcounter : comments
+# pkprinters : when --add is used, existing printers are now skipped.
+#
 # Revision 1.62  2004/03/05 14:31:58  jalet
 # Improvement on strange history entries
@@ -444,8 +448,9 @@
         """Extracts user information given its name."""
         user = StorageUser(self, username)
-        result = self.doSearch("(&(objectClass=pykotaAccount)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["userrdn"], username), ["pykotaLimitBy", self.info["usermail"]], base=self.info["userbase"])
+        result = self.doSearch("(&(objectClass=pykotaAccount)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["userrdn"], username), ["pykotaUserName", "pykotaLimitBy", self.info["usermail"]], base=self.info["userbase"])
         if result :
             fields = result[0][1]
             user.ident = result[0][0]
+            user.Name = fields.get("pykotaUserName", [username])[0] 
             user.Email = fields.get(self.info["usermail"])
             if user.Email is not None :
@@ -478,8 +483,9 @@
         """Extracts group information given its name."""
         group = StorageGroup(self, groupname)
-        result = self.doSearch("(&(objectClass=pykotaGroup)(|(pykotaGroupName=%s)(%s=%s)))" % (groupname, self.info["grouprdn"], groupname), ["pykotaLimitBy"], base=self.info["groupbase"])
+        result = self.doSearch("(&(objectClass=pykotaGroup)(|(pykotaGroupName=%s)(%s=%s)))" % (groupname, self.info["grouprdn"], groupname), ["pykotaGroupName", "pykotaLimitBy"], base=self.info["groupbase"])
         if result :
             fields = result[0][1]
             group.ident = result[0][0]
+            group.Name = fields.get("pykotaGroupName", [groupname])[0] 
             group.LimitBy = fields.get("pykotaLimitBy")
             if group.LimitBy is not None :
@@ -495,10 +501,11 @@
        
     def getPrinterFromBackend(self, printername) :        
-        """Extracts printer information given its name."""
+        """Extracts printer information given its name : returns first matching printer."""
         printer = StoragePrinter(self, printername)
-        result = self.doSearch("(&(objectClass=pykotaPrinter)(|(pykotaPrinterName=%s)(%s=%s)))" % (printername, self.info["printerrdn"], printername), ["pykotaPricePerPage", "pykotaPricePerJob", "uniqueMember"], base=self.info["printerbase"])
-        if result :
-            fields = result[0][1]
+        result = self.doSearch("(&(objectClass=pykotaPrinter)(|(pykotaPrinterName=%s)(%s=%s)))" % (printername, self.info["printerrdn"], printername), ["pykotaPrinterName", "pykotaPricePerPage", "pykotaPricePerJob", "uniqueMember"], base=self.info["printerbase"])
+        if result :
+            fields = result[0][1]       # take only first matching printer, ignore the rest
             printer.ident = result[0][0]
+            printer.Name = fields.get("pykotaPrinterName", [printername])[0] 
             printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0] or 0.0)
             printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0)
Index: pykota/trunk/pykota/version.py
===================================================================
--- pykota/trunk/pykota/version.py (revision 1447)
+++ pykota/trunk/pykota/version.py (revision 1451)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.19alpha4_unofficial"
+__version__ = "1.19alpha5_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
Index: pykota/trunk/bin/pkpgcounter
===================================================================
--- pykota/trunk/bin/pkpgcounter (revision 1449)
+++ pykota/trunk/bin/pkpgcounter (revision 1451)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.5  2004/05/06 12:37:29  jalet
+# pkpgcounter : comments
+# pkprinters : when --add is used, existing printers are now skipped.
+#
 # Revision 1.4  2004/05/04 12:21:55  jalet
 # Now uses mmap in PCL mode
@@ -88,10 +92,26 @@
     # Backported from C to Python by Jerome Alet, then enhanced
     # with more PCL tags detected. I think all the necessary PCL tags
-    # are recognized to correctly handle PCL5e files wrt their number
-    # of pages
-    # 
+    # are recognized to correctly handle PCL5 files wrt their number
+    # of pages. The documentation used for this was :
+    #
+    # HP PCL/PJL Reference Set
+    # PCL5 Printer Language Technical Quick Reference Guide
+    # http://h20000.www2.hp.com/bc/docs/support/SupportManual/bpl13205/bpl13205.pdf 
+    #
     infileno = infile.fileno()
     infile = mmap.mmap(infileno, os.fstat(infileno).st_size, access=mmap.ACCESS_READ)
-    tagsends = { "&n" : "W", "&b": "W", "*i" : "W", "*l" : "W", "*m" : "W", "*v": "W", "*c" : "W", "(f" : "W", "*b" : "VW", "(s" : "W", ")s" : "W", "&p" : "X", "&l" : "X" } 
+    tagsends = { "&n" : "W", 
+                 "&b" : "W", 
+                 "*i" : "W", 
+                 "*l" : "W", 
+                 "*m" : "W", 
+                 "*v" : "W", 
+                 "*c" : "W", 
+                 "(f" : "W", 
+                 "*b" : "VW",
+                 "(s" : "W", 
+                 ")s" : "W", 
+                 "&p" : "X", 
+                 "&l" : "X" } 
     copies = 1
     pagecount = 0
Index: pykota/trunk/bin/pkprinters
===================================================================
--- pykota/trunk/bin/pkprinters (revision 1438)
+++ pykota/trunk/bin/pkprinters (revision 1451)
@@ -24,4 +24,8 @@
 #
 # $Log$
+# Revision 1.6  2004/05/06 12:37:29  jalet
+# pkpgcounter : comments
+# pkprinters : when --add is used, existing printers are now skipped.
+#
 # Revision 1.5  2004/04/16 16:52:09  jalet
 # Better formatting
@@ -163,12 +167,15 @@
             for pname in names :
                 printer = self.storage.getPrinter(pname)
-                if not printer.Exists :
+                if printer.Exists :
+                    self.logger.log_message(_("Printer %s already exists, skipping.") % printer.Name, "warn")
+                else :
                     if self.isValidName(pname) :
                         printer = self.storage.addPrinter(pname)
                         if not printer.Exists :
                             raise PyKotaToolError, _("Impossible to add printer %s") % pname
+                        else :    
+                            printers.append(printer)
                     else :    
                         raise PyKotaToolError, _("Invalid printer name %s") % pname
-                printers.append(printer)
         else :        
             printers = self.storage.getMatchingPrinters(",".join(names))
Index: pykota/trunk/NEWS
===================================================================
--- pykota/trunk/NEWS (revision 1450)
+++ pykota/trunk/NEWS (revision 1451)
@@ -22,4 +22,9 @@
 PyKota NEWS :
 
+    - 1.19alpha5 :
+    
+        - pkprinters --add now completely skips existing printers, but
+          logs a warning.
+          
     - 1.19alpha4 :
     
@@ -27,5 +32,7 @@
           is now fixed.
           
-        - improved PCL support in pkpgcounter.  
+        - improved PCL support in pkpgcounter, with the use of
+          HP PCL/PJL Reference Set
+          PCL5 Printer Language Technical Quick Reference Guide
         
         - pkpgcounter now uses mmap to speed things up : duration
Index: pykota/trunk/po/en/pykota.po
===================================================================
--- pykota/trunk/po/en/pykota.po (revision 1437)
+++ pykota/trunk/po/en/pykota.po (revision 1451)
@@ -446,2 +446,7 @@
 msgid "in"
 msgstr ""
+
+#, python-format
+msgid "Printer %s already exists, skipping."
+msgstr ""
+
Index: pykota/trunk/po/br/pykota.po
===================================================================
--- pykota/trunk/po/br/pykota.po (revision 1437)
+++ pykota/trunk/po/br/pykota.po (revision 1451)
@@ -482,2 +482,7 @@
 msgid "in"
 msgstr "em"
+
+#, python-format
+msgid "Printer %s already exists, skipping."
+msgstr ""
+
Index: pykota/trunk/po/pt/pykota.po
===================================================================
--- pykota/trunk/po/pt/pykota.po (revision 1437)
+++ pykota/trunk/po/pt/pykota.po (revision 1451)
@@ -482,2 +482,7 @@
 msgid "in"
 msgstr "em"
+
+#, python-format
+msgid "Printer %s already exists, skipping."
+msgstr ""
+
Index: pykota/trunk/po/es/pykota.po
===================================================================
--- pykota/trunk/po/es/pykota.po (revision 1437)
+++ pykota/trunk/po/es/pykota.po (revision 1451)
@@ -486,2 +486,7 @@
 msgid "in"
 msgstr "en"
+
+#, python-format
+msgid "Printer %s already exists, skipping."
+msgstr ""
+
Index: pykota/trunk/po/fr/pykota.po
===================================================================
--- pykota/trunk/po/fr/pykota.po (revision 1437)
+++ pykota/trunk/po/fr/pykota.po (revision 1451)
@@ -473,2 +473,7 @@
 msgid "in"
 msgstr "dans"
+
+#, python-format
+msgid "Printer %s already exists, skipping."
+msgstr "L'imprimante %s existe d�, ignor�"
+
Index: pykota/trunk/po/se/pykota.po
===================================================================
--- pykota/trunk/po/se/pykota.po (revision 1413)
+++ pykota/trunk/po/se/pykota.po (revision 1451)
@@ -478,2 +478,7 @@
 msgid "Problem modifying LDAP entry (%s, %s)"
 msgstr "Problem med att modifiera LDAP post (%s, %s)"
+
+#, python-format
+msgid "Printer %s already exists, skipping."
+msgstr ""
+
Index: pykota/trunk/po/pykota.pot
===================================================================
--- pykota/trunk/po/pykota.pot (revision 1437)
+++ pykota/trunk/po/pykota.pot (revision 1451)
@@ -446,2 +446,7 @@
 msgid "in"
 msgstr ""
+
+#, python-format
+msgid "Printer %s already exists, skipping."
+msgstr ""
+
Index: pykota/trunk/po/it/pykota.po
===================================================================
--- pykota/trunk/po/it/pykota.po (revision 1413)
+++ pykota/trunk/po/it/pykota.po (revision 1451)
@@ -479,2 +479,7 @@
 msgid "Problem modifying LDAP entry (%s, %s)"
 msgstr "Errore avvenuto durante la modifica della entry LDAP (%s, %s)"
+
+#, python-format
+msgid "Printer %s already exists, skipping."
+msgstr ""
+
Index: pykota/trunk/po/genmo.sh
===================================================================
--- pykota/trunk/po/genmo.sh (revision 1451)
+++ pykota/trunk/po/genmo.sh (revision 1451)
@@ -0,0 +1,20 @@
+#! /bin/sh
+#
+# PyKota - Print Quotas for CUPS and LPRng
+#
+# (c) 2003-2004 Jerome Alet <alet@librelogiciel.com>
+# You're welcome to redistribute this software under the
+# terms of the GNU General Public Licence version 2.0
+# or, at your option, any higher version.
+#
+# You can read the complete GNU GPL in the file COPYING
+# which should come along with this software, or visit
+# the Free Software Foundation's WEB site http://www.fsf.org
+#
+# $Id$
+#
+for dir in br en es fr it pt se ; do 
+    cd $dir ;
+    msgfmt -o pykota.mo pykota.po ;
+    cd .. ;
+done
