resolve OperationalError in modeltests.basic

Create issue
Issue #5 resolved
Johan Harjono created an issue

No description provided.

Comments (7)

  1. Dave Weber

    The error lies in the function typecast_timestamp(s), in file backends/util.py, in the line s = s.decode("ascii"). s is a str with value '2005-07-28 00:00:00'. s does not have a decode method. Will now find a fix.

  2. Dave Weber

    If I simply comment out the line, s = s.decode("ascii"), in the aforementioned function, then all OperationErrors will be fixed. There is a comment in the function that "# XXX should the database pass in Unicode here already?". I don't think the conversion is necessary and it will break Python 3 code.

  3. Martin von Löwis

    Does it still work on Python 2? Perhaps skipping the decoding should be dependent on the type of the string?

  4. Dave Weber

    The code still works in Python 2, based on the test casee will still pass. Skipping the decoding could be dependant on the string type, but the internal documentation in the Django code alludes to the fact that the string type should not need to be decoded - that's why I have it removed, instead of making it conditional.

  5. Log in to comment