Пример #1
0
    def get(self, request):
        if request.endswith(".zip") and "/" not in request:
            fileobj = File.get_by_filename(request)
        elif request.endswith(".zip") and "/" in request:
            fileobj = File.get_by_fullpath(request)
        else:
            fileobj = File.get_by_base62(request)

        if fileobj is None:
            self.write("404 Not Found")
            return self.set_status(404)

        return self.write("%s  %s" % (fileobj.filename, fileobj.md5sum))
Пример #2
0
    def get(self, request):
        request = request + ".zip"

        if request.endswith("-latest.zip"):
            device = request.replace("-latest.zip", "")
            fileobj = File.get_latest_by_device(device)
        elif "/" in request:
            fileobj = File.get_by_fullpath(request)
        elif "/" not in request:
            fileobj = File.get_by_filename(request)

        if fileobj is None and "/" not in request:
            self.write("404 Not Found")
            return self.set_status(404)
        elif fileobj is None:
            full_path = request
        else:
            full_path = fileobj.full_path

        url = self.mirrorpool.next() % full_path

        return self.redirect(url)