aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo/cgi/submit.py
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageialinux-online.org>2015-10-10 09:16:26 +0200
committerPapoteur <papoteur@mageialinux-online.org>2015-10-10 09:16:26 +0200
commit142d404aa8cffc9f4785e5347f26036463dedcd4 (patch)
treec58f4d5c692c945eb10180baadb123d2c3762ad3 /MgaRepo/cgi/submit.py
parent3e3e90e699192df60eeafb2ec7a9e087aff97195 (diff)
downloadmgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar
mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.gz
mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.bz2
mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.tar.xz
mgarepo-142d404aa8cffc9f4785e5347f26036463dedcd4.zip
Apply 2to3-3.4
Diffstat (limited to 'MgaRepo/cgi/submit.py')
-rw-r--r--MgaRepo/cgi/submit.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/MgaRepo/cgi/submit.py b/MgaRepo/cgi/submit.py
index cba5977..e06ae07 100644
--- a/MgaRepo/cgi/submit.py
+++ b/MgaRepo/cgi/submit.py
@@ -55,7 +55,7 @@ def get_targetoptions():
def show(msg="", error=0):
if error:
msg = '<font color="red">%s</font>' % msg
- print TEMPLATE % {"message":msg, "targetoptions":get_targetoptions()}
+ print(TEMPLATE % {"message":msg, "targetoptions":get_targetoptions()})
def submit_packages(packager):
form = cgi.FieldStorage()
@@ -64,25 +64,25 @@ def submit_packages(packager):
if not packageurl:
show()
elif not packagerev:
- raise CgiError, "No revision provided!"
+ raise CgiError("No revision provided!")
else:
targetname = form.getfirst("target")
if not targetname:
- raise CgiError, "No target selected!"
+ raise CgiError("No target selected!")
for target in get_targets():
if target.name == targetname:
break
else:
- raise CgiError, "Target not found!"
+ raise CgiError("Target not found!")
try:
tmp = int(packagerev)
except ValueError:
- raise CgiError, "Invalid revision provided!"
+ raise CgiError("Invalid revision provided!")
for allowed in target.allowed:
if packageurl.startswith(allowed):
break
else:
- raise CgiError, "%s is not allowed for this target!" % packageurl
+ raise CgiError("%s is not allowed for this target!" % packageurl)
get_srpm(packageurl,
revision=packagerev,
targetdirs=target.target,
@@ -93,10 +93,10 @@ def submit_packages(packager):
show("Package submitted!")
def main():
- if not os.environ.has_key('REQUEST_METHOD'):
+ if 'REQUEST_METHOD' not in os.environ:
sys.stderr.write("error: this program is meant to be used as a cgi\n")
sys.exit(1)
- print "Content-type: text/html\n\n"
+ print("Content-type: text/html\n\n")
try:
username = os.environ.get("REMOTE_USER")
method = os.environ.get("REQUEST_METHOD")
@@ -105,12 +105,11 @@ def main():
else:
useremail = config.get("users", username)
if not useremail:
- raise CgiError, \
- "Your email was not found. Contact the administrator!"
+ raise CgiError("Your email was not found. Contact the administrator!")
submit_packages(useremail)
- except CgiError, e:
+ except CgiError as e:
show(str(e), error=1)
- except Error, e:
+ except Error as e:
error = str(e)
show(error[0].upper()+error[1:], error=1)
except: