mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
Fix API packages with no arguments
This commit is contained in:
parent
c0112828eb
commit
912b917a47
@ -404,10 +404,10 @@ class Package(db.Model):
|
||||
"type": self.type.toName(),
|
||||
}
|
||||
|
||||
def getAsDictionaryShort(self, base_url, version=None, release_id=None):
|
||||
def getAsDictionaryShort(self, base_url, version=None, release_id=None, no_load=False):
|
||||
tnurl = self.getThumbnailURL(1)
|
||||
|
||||
if release_id is None:
|
||||
if release_id is None and no_load == False:
|
||||
release = self.getDownloadRelease(version=version)
|
||||
release_id = release and release.id
|
||||
|
||||
|
@ -89,8 +89,8 @@ class QueryBuilder:
|
||||
releases[package_id] = release_id
|
||||
|
||||
def toJson(package: Package):
|
||||
release_id = releases[package.id]
|
||||
return package.getAsDictionaryShort(current_app.config["BASE_URL"], release_id=release_id)
|
||||
release_id = releases.get(package.id)
|
||||
return package.getAsDictionaryShort(current_app.config["BASE_URL"], release_id=release_id, no_load=True)
|
||||
|
||||
return [toJson(pkg) for pkg in packages]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user