Changeset 1790 for pykota/trunk/pykota/storages/ldapstorage.py
- Timestamp:
- 10/07/04 23:14:28 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r1777 r1790 22 22 # 23 23 # $Log$ 24 # Revision 1.83 2004/10/07 21:14:28 jalet 25 # Hopefully final fix for data encoding to and from the database 26 # 24 27 # Revision 1.82 2004/10/05 09:59:20 jalet 25 28 # Restore compatibility with Python 2.1 … … 592 595 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) 593 596 printer.uniqueMember = fields.get("uniqueMember", []) 594 printer.Description = unicode(fields.get("description", [""])[0], "UTF-8").encode(self.tool.getCharset())597 printer.Description = self.databaseToUserCharset(fields.get("description", [""])[0]) 595 598 printer.Exists = 1 596 599 return printer … … 693 696 lastjob.JobPrice = None 694 697 lastjob.JobAction = fields.get("pykotaAction", [""])[0] 695 lastjob.JobFileName = unicode(fields.get("pykotaFileName", [""])[0], "UTF-8").encode(self.tool.getCharset())696 lastjob.JobTitle = unicode(fields.get("pykotaTitle", [""])[0], "UTF-8").encode(self.tool.getCharset())698 lastjob.JobFileName = self.databaseToUserCharset(fields.get("pykotaFileName", [""])[0]) 699 lastjob.JobTitle = self.databaseToUserCharset(fields.get("pykotaTitle", [""])[0]) 697 700 lastjob.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 698 lastjob.JobOptions = unicode(fields.get("pykotaOptions", [""])[0], "UTF-8").encode(self.tool.getCharset())701 lastjob.JobOptions = self.databaseToUserCharset(fields.get("pykotaOptions", [""])[0]) 699 702 lastjob.JobHostName = fields.get("pykotaHostName", [""])[0] 700 703 lastjob.JobSizeBytes = fields.get("pykotaJobSizeBytes", [0L])[0] … … 769 772 printer.PricePerPage = float(fields.get("pykotaPricePerPage", [0.0])[0] or 0.0) 770 773 printer.uniqueMember = fields.get("uniqueMember", []) 771 printer.Description = unicode(fields.get("description", [""])[0], "UTF-8").encode(self.tool.getCharset())774 printer.Description = self.databaseToUserCharset(fields.get("description", [""])[0]) 772 775 printer.Exists = 1 773 776 printers.append(printer) … … 981 984 """Write the printer's description back into the storage.""" 982 985 fields = { 983 "description" : unicode(str(printer.Description), self.tool.getCharset()).encode("UTF-8"),986 "description" : self.userCharsetToDatabase(str(printer.Description)), 984 987 } 985 988 self.doModify(printer.ident, fields) … … 1080 1083 "pykotaPrinterPageCounter" : str(pagecounter), 1081 1084 "pykotaAction" : action, 1082 "pykotaFileName" : ((filename is None) and "None") or unicode(filename, self.tool.getCharset()).encode("UTF-8"),1083 "pykotaTitle" : ((title is None) and "None") or unicode(title, self.tool.getCharset()).encode("UTF-8"),1085 "pykotaFileName" : ((filename is None) and "None") or self.userCharsetToDatabase(filename), 1086 "pykotaTitle" : ((title is None) and "None") or self.userCharsetToDatabase(title), 1084 1087 "pykotaCopies" : str(copies), 1085 "pykotaOptions" : ((options is None) and "None") or unicode(options, self.tool.getCharset()).encode("UTF-8"),1088 "pykotaOptions" : ((options is None) and "None") or self.userCharsetToDatabase(options), 1086 1089 "pykotaHostName" : str(clienthost), 1087 1090 "pykotaJobSizeBytes" : str(jobsizebytes), … … 1182 1185 job.JobPrice = None 1183 1186 job.JobAction = fields.get("pykotaAction", [""])[0] 1184 job.JobFileName = unicode(fields.get("pykotaFileName", [""])[0], "UTF-8").encode(self.tool.getCharset())1185 job.JobTitle = unicode(fields.get("pykotaTitle", [""])[0], "UTF-8").encode(self.tool.getCharset())1187 job.JobFileName = self.databaseToUserCharset(fields.get("pykotaFileName", [""])[0]) 1188 job.JobTitle = self.databaseToUserCharset(fields.get("pykotaTitle", [""])[0]) 1186 1189 job.JobCopies = int(fields.get("pykotaCopies", [0])[0]) 1187 job.JobOptions = unicode(fields.get("pykotaOptions", [""])[0], "UTF-8").encode(self.tool.getCharset())1190 job.JobOptions = self.databaseToUserCharset(fields.get("pykotaOptions", [""])[0]) 1188 1191 job.JobHostName = fields.get("pykotaHostName", [""])[0] 1189 1192 job.JobSizeBytes = fields.get("pykotaJobSizeBytes", [0L])[0]