PlanetPlanet vs Python 2.6

• 本文约 78 字,阅读大致需要 1 分钟 | Development | #compatiblity | #feed parser | #PlanetPlanet | #porting | #Python

On Python 2.6 we have a new ‘hashlib’ module, which superseded older ‘md5’ ‘sha1’ modules.

Therefore, importing ‘md5’ would give the following warnings:

DeprecationWarning: the md5 module is deprecated; use hashlib instead

This is quite annoying if you run PlanetPlanet in a cron(8) job and receive e-mail reports. In order to solve that, we can do some simple sed(1) replace over PlanetPlanet’s __init__.py:

s/import md5/import hashlib/g

s/md5\.new/hashlib.md5/g

That’s it! And PlanetPlanet will now happily work with Python 2.6.