Пример #1
0
    def get(self):
        device = self.request.arguments.get('device', [None])[0]
        type = self.request.arguments.get('type', [None])[0]
        files = File.browse(device, type)

        try:
            devicemap = eval(open("/usr/local/share/devices.dict").read())
        except:
            devicemap = {}

        for fileobj in files:
            fileobj.base62 = base62_encode(fileobj.id)

        devicelist = Device.get_all()
        namelist = {}
        for codename in devicelist:
           if codename in devicemap:
               namelist[codename] = devicemap[codename]
           else:
               namelist[codename] = codename

        def respond(builds):
            return self.render("browse.mako", {'request_type': type, 'request_device': device, 'devices': devicelist,  'devicenames': namelist, 'files': files, 'builds': builds})

        #self.stats.incr('view_browse')
        #return self.activebuilds.get(respond)
        return respond([])
Пример #2
0
    def get(self):
        device = self.request.arguments.get('device', [None])[0]
        type = self.request.arguments.get('type', [None])[0]
        files = File.browse(device, type)

        for fileobj in files:
            fileobj.base62 = base62_encode(fileobj.id)

        def respond(builds):
            return self.render("browse.mako", {'request_type': type, 'request_device': device, 'devices': Device.get_all(), 'files': files, 'builds': builds})

        self.stats.incr('view_browse')
        return self.activebuilds.get(respond)
Пример #3
0
    def method_get_all_builds(self):
        channels = self.params.get('channels', None)
        device = self.params.get('device', None)
        limit = int(self.params.get('limit', 3))
        if not channels or not device:
            self.set_status(500)
            return self.fail("Invalid Parameters")

        result = []
        for channel in channels:
            files = File.browse(device, channel, limit)
            for file_obj in files:
                if file_obj is not None:
                    changesfile = re.sub(file_obj.filename,"CHANGES.txt",file_obj.full_path)
                    result.append({
                        'channel': channel,
                        'filename': file_obj.filename,
                        'url': "http://get.cm/get/%s" % file_obj.full_path,
                        'changes': "http://get.cm/get/%s" % changesfile,
                        'md5sum': file_obj.md5sum,
                        'timestamp': file_obj.date_created.strftime('%s')
                    })

        return self.success(result)
Пример #4
0
 def get(self):
     device = self.request.arguments.get('device', [None])[0]
     type = self.request.arguments.get('type', [None])[0]
     files = File.browse(device, type, 100)
     self.set_header('Content-Type', "application/xml; charset=utf-8")
     self.render("rss.mako", {'files': files})
Пример #5
0
 def get(self):
     files = File.browse(None, None, 100)
     self.set_header('Content-Type', "application/xml; charset=utf-8")
     self.render("rss.mako", {'files': files})