Suggestion:

    if filename.lower().endswith(ImgPage.EXT_IMG) and not filename.lower().endswith(ImgPage.EXT_THUMB)