diff options
author | 2011-06-23 16:49:09 +0530 | |
---|---|---|
committer | 2011-06-23 16:49:09 +0530 | |
commit | 5f953a0c1c54257d5ba50c4c9a9502f38295afe2 (patch) | |
tree | f54120f79576df37e1a1975adb4281cc827e8df0 /server | |
parent | update ebuild (diff) | |
download | gentoostats-5f953a0c1c54257d5ba50c4c9a9502f38295afe2.tar.gz gentoostats-5f953a0c1c54257d5ba50c4c9a9502f38295afe2.tar.bz2 gentoostats-5f953a0c1c54257d5ba50c4c9a9502f38295afe2.zip |
allow masking payload fields
Diffstat (limited to 'server')
-rw-r--r-- | server/helpers.py | 14 | ||||
-rw-r--r-- | server/host.py | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/server/helpers.py b/server/helpers.py index ebd53a3..386d73c 100644 --- a/server/helpers.py +++ b/server/helpers.py @@ -37,6 +37,8 @@ def pkgsplit(pkgname): # lookup key and insert if not found def get_kwkey(db, keyword): + if keyword is None: + return None db_keyword = db.select('KEYWORDS', vars={'keyword':keyword}, where='KEYWORD=$keyword') if len(db_keyword): kwkey = db_keyword[0]['KWKEY'] @@ -45,6 +47,8 @@ def get_kwkey(db, keyword): return kwkey def get_lkey(db, lang): + if lang is None: + return None db_lang = db.select('LANG', vars={'lang':lang}, where='LANG=$lang') if len(db_lang): lkey = db_lang[0]['LKEY'] @@ -53,6 +57,8 @@ def get_lkey(db, lang): return lkey def get_fkey(db, feature): + if feature is None: + return None db_feature = db.select('FEATURES', vars={'feature':feature}, where='FEATURE=$feature') if len(db_feature): fkey = db_feature[0]['FKEY'] @@ -61,6 +67,8 @@ def get_fkey(db, feature): return fkey def get_mkey(db, mirror): + if mirror is None: + return None db_mirror = db.select('GENTOO_MIRRORS', vars={'mirror':mirror}, where='MIRROR=$mirror') if len(db_mirror): mkey = db_mirror[0]['MKEY'] @@ -69,6 +77,8 @@ def get_mkey(db, mirror): return mkey def get_ukey(db, useflag): + if useflag is None: + return None db_useflag = db.select('USEFLAGS', vars={'useflag':useflag}, where='USEFLAG=$useflag') if len(db_useflag): ukey = db_useflag[0]['UKEY'] @@ -77,6 +87,8 @@ def get_ukey(db, useflag): return ukey def get_pkey(db, package): + if package is None: + return None cpv = pkgsplit(package) db_package = db.select('PACKAGES', vars=cpv, where='CAT=$cat and PKG=$pkg and VER=$ver') if len(db_package): @@ -86,6 +98,8 @@ def get_pkey(db, package): return pkey def get_rkey(db, repo): + if repo is None: + return None db_repo = db.select('REPOSITORIES', vars={'repo':repo}, where='REPO=$repo') if len(db_repo): rkey = db_repo[0]['RKEY'] diff --git a/server/host.py b/server/host.py index f737a6d..b0d9235 100644 --- a/server/host.py +++ b/server/host.py @@ -115,9 +115,10 @@ class Host(object): post_data_pkg = post_data['PACKAGES'][package] kwkey = helpers.get_kwkey(db, post_data_pkg['KEYWORD']) rkey = helpers.get_rkey(db, post_data_pkg['REPO']) + build_time = int(post_data_pkg['BUILD_TIME']) if post_data_pkg['BUILD_TIME'] else None # Insert in INSTALLED_PACKAGES - ipkey = db.insert('INSTALLED_PACKAGES', UUID=uuid, PKEY=pkey, BUILD_TIME=int(post_data_pkg['BUILD_TIME']), + ipkey = db.insert('INSTALLED_PACKAGES', UUID=uuid, PKEY=pkey, BUILD_TIME=build_time, COUNTER=post_data_pkg['COUNTER'], KWKEY=kwkey, RKEY=rkey, SIZE=post_data_pkg['SIZE']) # Insert in PLUS_USEFLAGS |