summaryrefslogtreecommitdiffstats
path: root/support/schema
diff options
context:
space:
mode:
authorcanyonknight <canyonknight@gmail.com>2012-05-23 19:22:27 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2012-07-06 11:25:41 +0200
commita4ed3a3b3bd4f47cc842e7f909c34f4e41a4655e (patch)
treea1334dcb40eab2c59c28f741af74dc50625c2126 /support/schema
parentcf2b82239dbfe4909dd391f4a7bae4e82dabb598 (diff)
downloadaur-a4ed3a3b3bd4f47cc842e7f909c34f4e41a4655e.tar.gz
aur-a4ed3a3b3bd4f47cc842e7f909c34f4e41a4655e.tar.xz
gendummydata.py: Change variable to string to eliminate redundant code
There is no reason the MaintainerUID can't be treated as a string within this script. By changing to a string an "if" statement can be eliminated. Signed-off-by: canyonknight <canyonknight@gmail.com> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'support/schema')
-rwxr-xr-xsupport/schema/gendummydata.py16
1 files changed, 5 insertions, 11 deletions
diff --git a/support/schema/gendummydata.py b/support/schema/gendummydata.py
index b7e31107..f996e937 100755
--- a/support/schema/gendummydata.py
+++ b/support/schema/gendummydata.py
@@ -187,20 +187,14 @@ for p in list(seen_pkgs.keys()):
else:
muid = trustedusers[random.randrange(0,len(trustedusers))]
if count % 20 == 0: # every so often, there are orphans...
- muid = 0
+ muid = "NULL"
uuid = genUID() # the submitter/user
- if muid == 0:
- s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
- " SubmittedTS, SubmitterUID, MaintainerUID) VALUES"
- " (%d, '%s', '%s', %d, %d, %d, NULL);\n")
- s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid)
- else:
- s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
- " SubmittedTS, SubmitterUID, MaintainerUID) VALUES "
- " (%d, '%s', '%s', %d, %d, %d, %d);\n")
- s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid)
+ s = ("INSERT INTO Packages (ID, Name, Version, CategoryID,"
+ " SubmittedTS, SubmitterUID, MaintainerUID) VALUES "
+ " (%d, '%s', '%s', %d, %d, %d, %s);\n")
+ s = s % (seen_pkgs[p], p, genVersion(), genCategory(), NOW, uuid, muid)
out.write(s)
count += 1