Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 12501 → Rev 12502

/tools/mantisctl/mantisctl.py
27,9 → 27,9
# USER CONFIGURATION - edit for your site if necessary. #
##############################################################################
basetitle = "^Mantis Issue Tracker"
#baseurl = None
#username = None
#password = None
username = None
password = None
baseurl = None
##############################################################################
 
class Mantisctl:
41,12 → 41,12
self.br = Browser()
self.br.set_handle_redirect(True)
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, honor_time=True)
# 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):
def _usage(self):
"""Prints out a usage summary and exits."""
print "\n", 78*"#"
print """\n
148,7 → 148,6
self.printdata(msg)
yes = ['y', 'Y']
var = raw_input("Press 'y' to submit the report or any other key to abort and hit ENTER: ")
print var
if var in yes:
print "Submitting your bug report..."
else:
327,6 → 326,28
self.br.form["summary"] = self.summary
self.br.form["description"] = self.description
 
def comparebugdata(self, soup, data):
bugs = soup.findAll("table", id="buglist")[0].findAll("tr")[3:-1]
for bug in bugs:
bugdata = bug.findAll("td")
# print bugdata
# bugno = data[0].contents[0].attrs[2][1].strip().encode('utf-8')
bugno = bugdata[3].contents[0].contents[0].strip().encode('utf-8')[-4:]
# print "bug number: %s" % bugno
try:
severity = bugdata[8].contents[0].contents[0].strip().encode('utf-8')
except:
severity = None
# print "severity: %s" % severity
pnumber = bugdata[4].contents[0].strip().encode('utf-8')
# print "product number: %s" % pnumber
reporter = bugdata[9].contents[0].strip().encode('utf-8')
# print "reporter: %s" % reporter
# print data, [bugno, reporter, severity, pnumber]
if [reporter, severity, pnumber] == data:
return bugno
return None
 
def reportbug(self):
"""Handles submission of a bug report."""
self.setreportdata()
335,20 → 356,38
self.filloutreportform()
if not self.opts.noconfirm:
self.askconfirm()
try:
#TODO
response = self.br.submit()
# response.seek(0)
# reportsoup = BeautifulSoup(response)
# print reportsoup
except:
pass
# try:
# import sys, logging
# logger = logging.getLogger("mechanize")
# logger.addHandler(logging.StreamHandler(sys.stdout))
# logger.setLevel(logging.DEBUG)
self.br.set_handle_refresh(True, max_time=2.0, honor_time=True)
response = self.br.submit()
response.seek(0)
reportsoup = BeautifulSoup(response)
# print reportsoup
# except:
# pass
self.br.close()
msg = "\nBug report submission appears to be successful! The following data have been submitted:\n"
#[<td><input type="checkbox" name="bug_arr[]" value="7342" /></td>,
# <td><a href="bug_update_page.php?bug_id=7342"><img border="0" width="16" height="16" src="http://bugs.scribus.net/images/update.png" alt="Update Issue" title="Update Issue" /></a></td>,
# <td>normal</td>,
# <td><a href="view.php?id=7342">0007342</a></td>,
# <td>1.3.3.12</td>,
# <td></td>,
# <td class="center">&nbsp;</td>,
# <td class="center">Canvas</td>,
# <td class="center"><span class="bold">major</span></td>,
# <td class="center">malex</td>,
# <td class="center"><span class="issue-status" title="open">assigned</span> (malex)</td>,
# <td class="center"><span class="bold">08-08-30</span></td>,
# <td class="left">Summary</td>]
data = [self.username, self.opts.severity, self.pversion]
bugno = self.comparebugdata(reportsoup, data)
if bugno != None:
msg = "\nBug report number %s submission appears to be successful! The following data have been submitted:\n" % bugno
else:
msg = "\nCannot find the bug report. Please check the BTS directly.\n"
self.printdata(msg)
sys.exit(0)