def create_new_version(self): latest_version = self.get_latest_version() if latest_version is not None: return m.Version(branch=latest_version.branch, project=latest_version.project, version=int(latest_version.version) + 1).save() else: return m.Version(branch=latest_version.branch, project=latest_version.project, version=0).save()
def GetOrCreateVersion(self, version_str): query = models.Version.all() query.filter("version = ", version_str) versions = query.fetch(1) if versions: return versions[0] version = models.Version(version=version_str) version.put() return version
def import_version(self, version_file_path): pattern = "UniProtKB/(?P<knowledgebase>Swiss-Prot|TrEMBL) Release" \ " (?P<release_name>\\d{4}_\\d{2}) of (?P<release_date>\\d{2}-\\w{3}-\\d{4})" with open(version_file_path) as fd: content = fd.read() for knowledgebase, release_name, release_date_str in re.findall( pattern, content): release_date = datetime.strptime(release_date_str, '%d-%b-%Y') version = models.Version(knowledgebase=knowledgebase, release_name=release_name, release_date=release_date) self.session.add(version) self.session.commit()
def post(self): new_version = models.Version( platform=self.request.get('platform'), revision=self.request.get('revision'), version=self.request.get('version'), signature=self.request.get('signature'), download_link=self.request.get('download_link'), changelog_link=self.request.get('changelog_link'), bundle_size=int(self.request.get('bundle_size', 0)), min_version=self.request.get('min_version'), ) if new_version.put(): # Delete the memcache entry so it's recreated on the next request. memcache.delete(SPARKLE_MEMCACHE_KEY % self.request.get('platform')) self.redirect("/versions")