'Returns the path to the media file on disk for the given URL.
The passed URL is assumed to begin with ADMIN_MEDIA_PREFIX.  If the
resultant file path is outside the media directory, then a ValueError
is raised.'

def file_path(self, url):

    relative_url = url[len(self.media_url):]
    relative_path = urllib.url2pathname(relative_url)
    return safe_join(self.media_dir, relative_path)
