I have this change password request form.In which the user enter their oldpasswords.
this oldpassword is the md5 format.
How to compare the md5 value from db
It's not md5, it's sha1 - "sha1$xxx.
"sha1$xxx
You'd have to use sha1 functions instead. There is a documentation on this at http://docs.python.org/library/sha.html