Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 12494 → Rev 12495

/tools/mantisctl/mantisctl.py
40,8 → 40,10
def __init__(self):
self.br = Browser()
self.br.set_handle_redirect(True)
self.br.set_handle_refresh(True, max_time=30.0, honor_time=False)
self.br.set_handle_referer(True)
self.br.set_handle_refresh(True, max_time=10.0, honor_time=False)
# self.br.set_handle_refresh(True, max_time=10.0)
# self.br.set_handle_refresh(True, honor_time=False)
(self.opts, self.args) = self.parseopts()
 
def usage(self):
95,9 → 97,9
op.add_option("-L", "--list", action="store_true", dest="list", default=False, help="List the Mantis options")
op.add_option("-r", "--report", action="store_true", dest="report", default=False, help="Report a new bug")
op.add_option("-n", "--noconfirm", action="store_true", dest="noconfirm", default=False, help="Do not ask for confirmation before submitting a report")
op.add_option("-b", "--baseurl", dest="baseurl", default=baseurl, help="Base URL for a Mantis BTS instance [optional if you set it in the script configuration section]. [default: %default]")
op.add_option("-u", "--username", dest="username", default=username, help="User name [optional if you set it in the script itself]. [default: %default]")
op.add_option("-w", "--password", dest="password", default=password, help="User password [optional if you set it in the script itself]. [default: %default]")
op.add_option("-b", "--baseurl", dest="baseurl", help="Base URL for a Mantis BTS instance [optional if you set it in the script configuration section].")
op.add_option("-u", "--username", dest="username", help="User name [optional if you set it in the script itself]. [default: %default]")
op.add_option("-w", "--password", dest="password", help="User password [optional if you set it in the script itself]. [default: %default]")
op.add_option("-a", "--assignto", dest="assignto", help="Assign to [optional]")
op.add_option("-c", "--category", dest="category", help="Bug category <mandatory>")
op.add_option("-y", "--severity", dest="severity", help="Bug severity <mandatory>")
110,15 → 112,15
def _getbaseurl(self):
"""Returns the Base URL for a Mantis BTS instance from options or
configuration. Will exit if basurl is not provided either as an option
or in the confguration section."""
or in the configuration section."""
if not self.opts.baseurl:
try:
url = baseurl
except:
sys.exit("Base URL is not provided either as an option or in the confguration section.")
sys.exit("Base URL is not provided either as an option or in the configuration section.")
else:
url = self.opts.baseurl
return baseurl
return url
 
def checkbts(self):
"""Checks if the URL for the Mantis BTS instance front page could be
334,9 → 336,17
if not self.opts.noconfirm:
self.askconfirm()
try:
self.br.submit()
#TODO
response = self.br.submit()
# response.seek(0)
# reportsoup = BeautifulSoup(response)
# print reportsoup
except:
pass
# import sys, logging
# logger = logging.getLogger("mechanize")
# logger.addHandler(logging.StreamHandler(sys.stdout))
# logger.setLevel(logging.DEBUG)
self.br.close()
msg = "\nBug report submission appears to be successful! The following data have been submitted:\n"
self.printdata(msg)