User/Alvonruff/2to3

From ISFDB
Revision as of 15:32, 24 April 2023 by Alvonruff (talk | contribs)
Jump to navigation Jump to search
  • Use 2to3 in a manner the same as futurize. This produces results suitable for python3.
  • Update to the official MySQL User:Alvonruff/mysql.connector. There is no python3 support for MySQLdb, which is our current connector. Moving to a new connector is a prerequisite.
  • Use of md5 needs to be replaced with hashlib
  • Records that return DATETIME fields cannot simply be indexed - they must use built-in datetime methods:
    • year = field.year
    • month = field.month
    • day = field.day
  • String operator usage:
    • string.replace() must be changed to str.replace()
    • string.strip() must be changed to str.strip()
  • The new connector has no support for db.escape_string(). Since mysql.connector is DB API v2.0 compliant, you the API should automatically perform the escape without asking.
  • The following code generates the integer 110 on python2, and the float 112.0 on python3. This obviously breaks the ISBN checksum calculator:
   checksum = 112
   remainder = (checksum/10)*10