feedvalidator
feedvalidator copied to clipboard
Python 3
I looked into what it would take to convert to 3, since 2 is no longer supported.
The short list is:
- Run
2to3 -wn . - Add
#!/usr/bin/env python3where appropriate - change
rfc822toemail.utilsinsrc/feedvalidator/validators.py - change
new.instgancemethodtotypes.methodTypeinsrc/validtest.py - explicitly set encoding for the XML file when opening in
src/validtest.py'sgetDescription - change
UnicodeErrortoUnicodeDecodeErrororUnicodeEncodeErroras appropriate - explicitly convert the result of
.encode('idna')back to a string (various places) - in
src/tests/testXmlEncoding.py, change many things to binary literals - avoid using
xmlEncoding.asUTF8insrc/feedvalidator/__init__.py
Where I got stuck was in how the code uses object inheritance so extensively; thanks to the switch to new-style objects, this doesn't work any more, and the trivial fix (removing things like validatorBase to avoid duplication) seems to mess with the processing model, causing many errors. E.g.,
TypeError: Cannot create a consistent method resolution
order (MRO) for bases text, rfc2396_full
Fixing this looks pretty invasive, and I'm not confident enough in this codebase to make the necessary changes. If someone is interested in helping out, I can do a PR for the things above and work with them on the solution.
Go for it! I will try to answer any questions, and may even make some fixes.