def ChangeSet(self,arch,source_version,target_version): out = '' arches = self.request.get('arches') if arches: oarch,narch = (int(_) for _ in arches.split('|')[:2]) else: oarch = version_arch(source_version) narch = version_arch(target_version) if oarch is None: oarch = arch if narch is None: narch = arch omanifest = fetcher.fetch(oarch,source_version,'manifest.xml') nmanifest = fetcher.fetch(narch,target_version,'manifest.xml') if omanifest is not None: #Version(value=source_version,key_name=source_version).put() version_ok(oarch,source_version) if nmanifest is not None: #Version(value=target_version,key_name=target_version).put() version_ok(narch,target_version) if omanifest is None: out += ('Sorry, could not fetch manifest for %s' % source_version) elif nmanifest is None: out += ('Sorry, could not fetch manifest for %s' % target_version) else: omanifest = Manifest(omanifest) nmanifest = Manifest(nmanifest) changeset = Changeset(omanifest,nmanifest) changes = ( {'path' : f, 'old_version' : omanifest.files[f]['version'], \ 'new_version' : nmanifest.files[f]['version'] } for f in changeset.changes ) adds = ( {'path' : f, \ 'new_version' : nmanifest.files[f]['version'] } for f in changeset.adds ) dels = ( {'path' : f, 'old_version' : omanifest.files[f]['version']\ } for f in changeset.dels ) template_values = { 'source_version': source_version, 'target_version': target_version, 'changes': changes, 'adds' : adds, 'dels' : dels, 'base_url' : fetcher.get_base_url(arch), 'base_url2' : fetcher.get_base_url(arch, 1), 'arches' : '|'.join([str(_) for _ in [oarch,narch]]), } template = templates.get_template('changeset.html') return template.render(template_values) self.response.out.write(out) return None
def get_page(self,arch,version,path,fpath): manifest = fetcher.fetch(arch,version,'manifest.xml') if manifest is not None: #Version(value=version,key_name=version).put() version_ok(arch,version) else: self.response.out.write("Sorry, could not fetch manifest for {0} version".format(version)) return manifest = Manifest(manifest) path = path[1:] if fpath != '': print 'file requested!' else: if path == '': nodes = manifest.files.keys() else: l = len(path) nodes = [f[l:] for f in manifest.files.keys() if f.startswith(path)] dirs = [] files = [] for x in nodes: n = x.split('/') if len(n) == 1: x = path + x f = { 'path' : n[0] , 'version' : fetcher.normalize_ver(manifest.files[x]['version']), 'size' : manifest.files[x]['size'] } f['lang'] = get_lang(n[0]) f['fullpath'] = x files.append(f) else: dirs.append(n[0]) dirs = frozenset(dirs) if path != '': up_url = '..' else: up_url = '' template_values = { 'version': version, 'path': path, 'dirs': sorted(list(dirs)), 'files' : files, 'up_url' : up_url, 'base_url' : fetcher.get_base_url(arch), 'base_url2' : fetcher.get_base_url(arch, 1), } template = templates.get_template('folder.html') return template.render(template_values)