Changeset 3364
- Timestamp:
- 04/01/08 18:15:33 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r3363 r3364 320 320 result = self.doSearch(ldapfilter, ["pykotaBillingCode"], base=self.info["billingcodebase"]) 321 321 if result : 322 return [databaseToUnicode(bc) for bc in self.filterNames(result, "pykotaBillingCode", billingcode)]322 return self.filterNames(result, "pykotaBillingCode", billingcode) 323 323 else : 324 324 return [] … … 365 365 user.ident = result[0][0] 366 366 user.Description = databaseToUnicode(fields.get("description", [None])[0]) 367 user.Email = fields.get(self.info["usermail"], [None])[0]367 user.Email = databaseToUnicode(fields.get(self.info["usermail"], [None])[0]) 368 368 user.LimitBy = databaseToUnicode(fields.get("pykotaLimitBy", ["quota"])[0]) 369 369 result = self.doSearch("(&(objectClass=pykotaAccountBalance)(|(pykotaUserName=%s)(%s=%s)))" % (username, self.info["balancerdn"], username), ["pykotaBalance", "pykotaLifeTimePaid", "pykotaPayments", "pykotaOverCharge"], base=self.info["balancebase"]) … … 412 412 fields = result[0][1] 413 413 group.ident = result[0][0] 414 group.Name = fields.get("pykotaGroupName", [databaseToUnicode(groupname)])[0]414 group.Name = databaseToUnicode(fields.get("pykotaGroupName", [groupname])[0]) 415 415 group.Description = databaseToUnicode(fields.get("description", [None])[0]) 416 416 group.LimitBy = databaseToUnicode(fields.get("pykotaLimitBy", ["quota"])[0]) … … 437 437 fields = result[0][1] # take only first matching printer, ignore the rest 438 438 printer.ident = result[0][0] 439 printer.Name = fields.get("pykotaPrinterName", [databaseToUnicode(printername)])[0]439 printer.Name = databaseToUnicode(fields.get("pykotaPrinterName", [printername])[0]) 440 440 printer.PricePerJob = float(fields.get("pykotaPricePerJob", [0.0])[0]) 441 441 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0]) … … 592 592 fields = result[0][1] 593 593 lastjob.ident = result[0][0] 594 lastjob.JobId = fields.get("pykotaJobId")[0]594 lastjob.JobId = databaseToUnicode(fields.get("pykotaJobId")[0]) 595 595 lastjob.UserName = databaseToUnicode(fields.get("pykotaUserName")[0]) 596 596 lastjob.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter", [0])[0]) … … 603 603 except ValueError : 604 604 lastjob.JobPrice = None 605 lastjob.JobAction = fields.get("pykotaAction", [""])[0]605 lastjob.JobAction = databaseToUnicode(fields.get("pykotaAction", [""])[0]) 606 606 lastjob.JobFileName = databaseToUnicode(fields.get("pykotaFileName", [""])[0]) 607 607 lastjob.JobTitle = databaseToUnicode(fields.get("pykotaTitle", [""])[0]) 608 608 lastjob.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 609 609 lastjob.JobOptions = databaseToUnicode(fields.get("pykotaOptions", [""])[0]) 610 lastjob.JobHostName = fields.get("pykotaHostName", [""])[0]610 lastjob.JobHostName = databaseToUnicode(fields.get("pykotaHostName", [""])[0]) 611 611 lastjob.JobSizeBytes = fields.get("pykotaJobSizeBytes", [0L])[0] 612 612 lastjob.JobBillingCode = databaseToUnicode(fields.get("pykotaBillingCode", [None])[0]) 613 lastjob.JobMD5Sum = fields.get("pykotaMD5Sum", [None])[0]613 lastjob.JobMD5Sum = databaseToUnicode(fields.get("pykotaMD5Sum", [None])[0]) 614 614 lastjob.JobPages = fields.get("pykotaPages", [""])[0] 615 615 try : … … 621 621 except ValueError : 622 622 lastjob.PrecomputedJobPrice = None 623 if lastjob.JobTitle == lastjob.JobFileName == lastjob.JobOptions == "hidden" :623 if lastjob.JobTitle == lastjob.JobFileName == lastjob.JobOptions == u"hidden" : 624 624 (lastjob.JobTitle, lastjob.JobFileName, lastjob.JobOptions) = (_("Hidden because of privacy concerns"),) * 3 625 625 date = fields.get("createTimestamp", ["19700101000000Z"])[0] # It's in UTC ! … … 745 745 user = StorageUser(self, username) 746 746 user.ident = userid 747 user.Email = fields.get(self.info["usermail"], [None])[0]747 user.Email = databaseToUnicode(fields.get(self.info["usermail"], [None])[0]) 748 748 user.LimitBy = databaseToUnicode(fields.get("pykotaLimitBy", ["quota"])[0]) 749 749 user.Description = databaseToUnicode(fields.get("description", [""])[0]) … … 812 812 group = StorageGroup(self, groupname) 813 813 group.ident = groupid 814 group.Name = fields.get("pykotaGroupName", [groupname])[0]814 group.Name = databaseToUnicode(fields.get("pykotaGroupName", [groupname])[0]) 815 815 group.LimitBy = databaseToUnicode(fields.get("pykotaLimitBy", ["quota"])[0]) 816 816 group.Description = databaseToUnicode(fields.get("description", [""])[0]) … … 923 923 "pykotaLimitBy" : unicodeToDatabase(user.LimitBy or u"quota"), 924 924 "description" : unicodeToDatabase(user.Description or ""), 925 self.info["usermail"] : u ser.Email or "",925 self.info["usermail"] : unicodeToDatabase(user.Email or ""), 926 926 } 927 927 … … 1207 1207 if self.privacy : 1208 1208 # For legal reasons, we want to hide the title, filename and options 1209 title = filename = options = "hidden"1209 title = filename = options = u"hidden" 1210 1210 fields = { 1211 1211 "objectClass" : ["pykotaObject", "pykotaJob"], … … 1213 1213 "pykotaUserName" : uname, 1214 1214 "pykotaPrinterName" : pname, 1215 "pykotaJobId" : jobid,1215 "pykotaJobId" : unicodeToDatabase(jobid), 1216 1216 "pykotaPrinterPageCounter" : str(pagecounter), 1217 "pykotaAction" : action,1217 "pykotaAction" : unicodeToDatabase(action), 1218 1218 "pykotaFileName" : ((filename is None) and "None") or unicodeToDatabase(filename), 1219 1219 "pykotaTitle" : ((title is None) and "None") or unicodeToDatabase(title), … … 1222 1222 "pykotaHostName" : str(clienthost), 1223 1223 "pykotaJobSizeBytes" : str(jobsizebytes), 1224 "pykotaMD5Sum" : str(jobmd5sum),1224 "pykotaMD5Sum" : unicodeToDatabase(jobmd5sum), 1225 1225 "pykotaPages" : jobpages, # don't add this attribute if it is not set, so no string conversion 1226 1226 "pykotaBillingCode" : unicodeToDatabase(jobbilling), # don't add this attribute if it is not set, so no string conversion … … 1354 1354 job = StorageJob(self) 1355 1355 job.ident = ident 1356 job.JobId = fields.get("pykotaJobId")[0]1356 job.JobId = databaseToUnicode(fields.get("pykotaJobId")[0]) 1357 1357 job.PrinterPageCounter = int(fields.get("pykotaPrinterPageCounter", [0])[0] or 0) 1358 1358 try : … … 1364 1364 except ValueError : 1365 1365 job.JobPrice = None 1366 job.JobAction = fields.get("pykotaAction", [""])[0]1366 job.JobAction = databaseToUnicode(fields.get("pykotaAction", [""])[0]) 1367 1367 job.JobFileName = databaseToUnicode(fields.get("pykotaFileName", [""])[0]) 1368 1368 job.JobTitle = databaseToUnicode(fields.get("pykotaTitle", [""])[0]) 1369 1369 job.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 1370 1370 job.JobOptions = databaseToUnicode(fields.get("pykotaOptions", [""])[0]) 1371 job.JobHostName = fields.get("pykotaHostName", [""])[0]1371 job.JobHostName = databaseToUnicode(fields.get("pykotaHostName", [""])[0]) 1372 1372 job.JobSizeBytes = fields.get("pykotaJobSizeBytes", [0L])[0] 1373 1373 job.JobBillingCode = databaseToUnicode(fields.get("pykotaBillingCode", [None])[0]) 1374 job.JobMD5Sum = fields.get("pykotaMD5Sum", [None])[0]1374 job.JobMD5Sum = databaseToUnicode(fields.get("pykotaMD5Sum", [None])[0]) 1375 1375 job.JobPages = fields.get("pykotaPages", [""])[0] 1376 1376 try : … … 1382 1382 except ValueError : 1383 1383 job.PrecomputedJobPrice = None 1384 if job.JobTitle == job.JobFileName == job.JobOptions == "hidden" :1384 if job.JobTitle == job.JobFileName == job.JobOptions == u"hidden" : 1385 1385 (job.JobTitle, job.JobFileName, job.JobOptions) = (_("Hidden because of privacy concerns"),) * 3 1386 1386 date = fields.get("createTimestamp", ["19700101000000Z"])[0] # It's in UTC !