Index: pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- pykota/trunk/pykota/storages/ldapstorage.py (revision 3363)
+++ pykota/trunk/pykota/storages/ldapstorage.py (revision 3364)
@@ -320,5 +320,5 @@
         result = self.doSearch(ldapfilter, ["pykotaBillingCode"], base=self.info["billingcodebase"])
         if result :
-            return [databaseToUnicode(bc) for bc in self.filterNames(result, "pykotaBillingCode", billingcode)]
+            return self.filterNames(result, "pykotaBillingCode", billingcode)
         else :    
             return []
@@ -365,5 +365,5 @@
             user.ident = result[0][0]
             user.Description = databaseToUnicode(fields.get("description", [None])[0])
-            user.Email = fields.get(self.info["usermail"], [None])[0]
+            user.Email = databaseToUnicode(fields.get(self.info["usermail"], [None])[0])
             user.LimitBy = databaseToUnicode(fields.get("pykotaLimitBy", ["quota"])[0])
             result = self.doSearch("(&(objectClass=pykotaAccountBalance)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["balancerdn"], username), ["pykotaBalance", "pykotaLifeTimePaid", "pykotaPayments", "pykotaOverCharge"], base=self.info["balancebase"])
@@ -412,5 +412,5 @@
             fields = result[0][1]
             group.ident = result[0][0]
-            group.Name = fields.get("pykotaGroupName", [databaseToUnicode(groupname)])[0] 
+            group.Name = databaseToUnicode(fields.get("pykotaGroupName", [groupname])[0])
             group.Description = databaseToUnicode(fields.get("description", [None])[0])
             group.LimitBy = databaseToUnicode(fields.get("pykotaLimitBy", ["quota"])[0])
@@ -437,5 +437,5 @@
             fields = result[0][1]       # take only first matching printer, ignore the rest
             printer.ident = result[0][0]
-            printer.Name = fields.get("pykotaPrinterName", [databaseToUnicode(printername)])[0] 
+            printer.Name = databaseToUnicode(fields.get("pykotaPrinterName", [printername])[0])
             printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0])
             printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0])
@@ -592,5 +592,5 @@
                 fields = result[0][1]
                 lastjob.ident = result[0][0]
-                lastjob.JobId = fields.get("pykotaJobId")[0]
+                lastjob.JobId = databaseToUnicode(fields.get("pykotaJobId")[0])
                 lastjob.UserName = databaseToUnicode(fields.get("pykotaUserName")[0])
                 lastjob.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter", [0])[0])
@@ -603,13 +603,13 @@
                 except ValueError :    
                     lastjob.JobPrice = None
-                lastjob.JobAction = fields.get("pykotaAction", [""])[0]
+                lastjob.JobAction = databaseToUnicode(fields.get("pykotaAction", [""])[0])
                 lastjob.JobFileName = databaseToUnicode(fields.get("pykotaFileName", [""])[0]) 
                 lastjob.JobTitle = databaseToUnicode(fields.get("pykotaTitle", [""])[0]) 
                 lastjob.JobCopies = int(fields.get("pykotaCopies", [0])[0])
                 lastjob.JobOptions = databaseToUnicode(fields.get("pykotaOptions", [""])[0]) 
-                lastjob.JobHostName = fields.get("pykotaHostName", [""])[0]
+                lastjob.JobHostName = databaseToUnicode(fields.get("pykotaHostName", [""])[0])
                 lastjob.JobSizeBytes = fields.get("pykotaJobSizeBytes", [0L])[0]
                 lastjob.JobBillingCode = databaseToUnicode(fields.get("pykotaBillingCode", [None])[0])
-                lastjob.JobMD5Sum = fields.get("pykotaMD5Sum", [None])[0]
+                lastjob.JobMD5Sum = databaseToUnicode(fields.get("pykotaMD5Sum", [None])[0])
                 lastjob.JobPages = fields.get("pykotaPages", [""])[0]
                 try :
@@ -621,5 +621,5 @@
                 except ValueError :    
                     lastjob.PrecomputedJobPrice = None
-                if lastjob.JobTitle == lastjob.JobFileName == lastjob.JobOptions == "hidden" :
+                if lastjob.JobTitle == lastjob.JobFileName == lastjob.JobOptions == u"hidden" :
                     (lastjob.JobTitle, lastjob.JobFileName, lastjob.JobOptions) = (_("Hidden because of privacy concerns"),) * 3
                 date = fields.get("createTimestamp", ["19700101000000Z"])[0] # It's in UTC !
@@ -745,5 +745,5 @@
                     user = StorageUser(self, username)
                     user.ident = userid
-                    user.Email = fields.get(self.info["usermail"], [None])[0]
+                    user.Email = databaseToUnicode(fields.get(self.info["usermail"], [None])[0])
                     user.LimitBy = databaseToUnicode(fields.get("pykotaLimitBy", ["quota"])[0])
                     user.Description = databaseToUnicode(fields.get("description", [""])[0]) 
@@ -812,5 +812,5 @@
                     group = StorageGroup(self, groupname)
                     group.ident = groupid
-                    group.Name = fields.get("pykotaGroupName", [groupname])[0] 
+                    group.Name = databaseToUnicode(fields.get("pykotaGroupName", [groupname])[0]) 
                     group.LimitBy = databaseToUnicode(fields.get("pykotaLimitBy", ["quota"])[0])
                     group.Description = databaseToUnicode(fields.get("description", [""])[0]) 
@@ -923,5 +923,5 @@
                        "pykotaLimitBy" : unicodeToDatabase(user.LimitBy or u"quota"),
                        "description" : unicodeToDatabase(user.Description or ""),
-                       self.info["usermail"] : user.Email or "",
+                       self.info["usermail"] : unicodeToDatabase(user.Email or ""),
                     }   
                        
@@ -1207,5 +1207,5 @@
         if self.privacy :    
             # For legal reasons, we want to hide the title, filename and options
-            title = filename = options = "hidden"
+            title = filename = options = u"hidden"
         fields = {
                    "objectClass" : ["pykotaObject", "pykotaJob"],
@@ -1213,7 +1213,7 @@
                    "pykotaUserName" : uname,
                    "pykotaPrinterName" : pname,
-                   "pykotaJobId" : jobid,
+                   "pykotaJobId" : unicodeToDatabase(jobid),
                    "pykotaPrinterPageCounter" : str(pagecounter),
-                   "pykotaAction" : action,
+                   "pykotaAction" : unicodeToDatabase(action),
                    "pykotaFileName" : ((filename is None) and "None") or unicodeToDatabase(filename), 
                    "pykotaTitle" : ((title is None) and "None") or unicodeToDatabase(title), 
@@ -1222,5 +1222,5 @@
                    "pykotaHostName" : str(clienthost), 
                    "pykotaJobSizeBytes" : str(jobsizebytes),
-                   "pykotaMD5Sum" : str(jobmd5sum),
+                   "pykotaMD5Sum" : unicodeToDatabase(jobmd5sum),
                    "pykotaPages" : jobpages,            # don't add this attribute if it is not set, so no string conversion
                    "pykotaBillingCode" : unicodeToDatabase(jobbilling), # don't add this attribute if it is not set, so no string conversion
@@ -1354,5 +1354,5 @@
                 job = StorageJob(self)
                 job.ident = ident
-                job.JobId = fields.get("pykotaJobId")[0]
+                job.JobId = databaseToUnicode(fields.get("pykotaJobId")[0])
                 job.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter", [0])[0] or 0)
                 try :
@@ -1364,13 +1364,13 @@
                 except ValueError :
                     job.JobPrice = None
-                job.JobAction = fields.get("pykotaAction", [""])[0]
+                job.JobAction = databaseToUnicode(fields.get("pykotaAction", [""])[0])
                 job.JobFileName = databaseToUnicode(fields.get("pykotaFileName", [""])[0]) 
                 job.JobTitle = databaseToUnicode(fields.get("pykotaTitle", [""])[0]) 
                 job.JobCopies = int(fields.get("pykotaCopies", [0])[0])
                 job.JobOptions = databaseToUnicode(fields.get("pykotaOptions", [""])[0]) 
-                job.JobHostName = fields.get("pykotaHostName", [""])[0]
+                job.JobHostName = databaseToUnicode(fields.get("pykotaHostName", [""])[0])
                 job.JobSizeBytes = fields.get("pykotaJobSizeBytes", [0L])[0]
                 job.JobBillingCode = databaseToUnicode(fields.get("pykotaBillingCode", [None])[0])
-                job.JobMD5Sum = fields.get("pykotaMD5Sum", [None])[0]
+                job.JobMD5Sum = databaseToUnicode(fields.get("pykotaMD5Sum", [None])[0])
                 job.JobPages = fields.get("pykotaPages", [""])[0]
                 try :
@@ -1382,5 +1382,5 @@
                 except ValueError :
                     job.PrecomputedJobPrice = None
-                if job.JobTitle == job.JobFileName == job.JobOptions == "hidden" :
+                if job.JobTitle == job.JobFileName == job.JobOptions == u"hidden" :
                     (job.JobTitle, job.JobFileName, job.JobOptions) = (_("Hidden because of privacy concerns"),) * 3
                 date = fields.get("createTimestamp", ["19700101000000Z"])[0] # It's in UTC !
