1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-07-08 10:10:10 +02:00

use var naming scheme in KnownApks (apk --> apkName)

Everywhere else, the file name of the APK is called apkName.
This commit is contained in:
Hans-Christoph Steiner 2017-06-01 10:27:35 +02:00
parent 9471bf2731
commit 6105f8a184

View File

@ -1582,6 +1582,11 @@ def natural_key(s):
class KnownApks:
"""permanent store of existing APKs with the date they were added
This is currently the only way to permanently store the "updated"
date of APKs.
"""
def __init__(self):
self.path = os.path.join('stats', 'known_apks.txt')
@ -1615,17 +1620,17 @@ class KnownApks:
for line in sorted(lst, key=natural_key):
f.write(line + '\n')
def recordapk(self, apk, app, default_date=None):
def recordapk(self, apkName, app, default_date=None):
'''
Record an apk (if it's new, otherwise does nothing)
Returns the date it was added as a datetime instance
'''
if apk not in self.apks:
if apkName not in self.apks:
if default_date is None:
default_date = datetime.utcnow()
self.apks[apk] = (app, default_date)
self.apks[apkName] = (app, default_date)
self.changed = True
_, added = self.apks[apk]
_, added = self.apks[apkName]
return added
# Look up information - given the 'apkname', returns (app id, date added/None).