tests/readlink.py
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Thu, 31 Jan 2013 22:30:52 +0100
branchstable
changeset 18521 0af2fe7b3274
parent 10282 08a0f04b56bd
child 25660 328739ea70c3
permissions -rwxr-xr-x
hgweb: returns 404 for unknow revision instead of 500 I noticed that access to filtered revision returned HTTP 500 code (internal server error). Investigation shown that it was the case for unknown revision too. That wrong and we now properly return a 404 for revision not found.

#!/usr/bin/env python

import errno, os, sys

for f in sys.argv[1:]:
    try:
        print f, '->', os.readlink(f)
    except OSError, err:
        if err.errno != errno.EINVAL:
            raise
        print f, 'not a symlink'

sys.exit(0)