Verify a valid bugzilla cookie exists

Empirical evidence suggests that you will get full names instead of
email addresses for things like the assigned_to field if you haven't
logged into bugzilla.  While I'd prefer to have both, this does give a
way to see if the bugzilla cookie is valid.

So, if no '@' in the first bug's assigned_to, bail.
This commit is contained in:
Jason Tibbitts 2010-08-14 09:27:35 -05:00
parent 3634c7fe94
commit 0a091e6427

View file

@ -13,7 +13,6 @@ VERSION = "1.0"
# Package already exists in pkgdb.
# fedora-review flag isn't set (especially if it's still set to '?'
# Catch common misspellings?
# Try to do some checking on the ~/.bugzillacookies file and suggest "bugzilla login"
import bugzilla
import codecs
@ -682,6 +681,12 @@ if __name__ == '__main__':
print "Done."
print
# I think this reliably detects whether or not you've logged in
if bugs[0].assigned_to.find('@') < 0:
print "It looks as if you don't have a valid bugzilla cookie."
print "Please run 'bugzilla login' and try again."
exit(1)
# Iterate over bugs
for i in bugs:
firstfound = True