Subversion Repositories Scribus

Compare Revisions

Regard whitespace Rev 12514 → Rev 16365

50,7 → 50,7
"""Prints out a usage summary and exits."""
print "\n", 78*"#"
print """\n
Usage: [Options], version = 0.3
Usage: [Options], version = 0.4
-T, --test Test the script
91,8 → 91,8
"""Parses options and arguments passed to the script
and returns a tuple of a dictionary (opts) and a list (args)."""
from optparse import OptionParser
usage = "%prog [Options], version = %prog 0.3"
op = OptionParser(usage=usage, version='%prog 0.3')
usage = "%prog [Options], version = %prog 0.4"
op = OptionParser(usage=usage, version='%prog 0.4')
op.add_option("-T", "--test", action="store_true", dest="test", default=False, help="Test the script")
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")
126,7 → 126,6
"""Checks if the URL for the Mantis BTS instance front page could be
opened and if the title of main page corresponds to the configuration
option 'title'."""
# Get the base url from options or configuration section
url = self._getbaseurl()
134,7 → 133,6
print "Cannot open a Mantis BTS instance main page."
# basetitle is defined in the configuration section
if, mainpagetitle):
return True
190,7 → 188,6
def login(self):
"""Performs logging into a Mantis BTS instance as an authenticated
# Check if we have the credentials to login into a Mantis BTS instance.
self.loginlink ="Login")).next()
293,6 → 290,9
self._printwarning("category", self.categories)
# severity
if not self.opts.severity:
self._printwarning("severity", self.severities.keys())
if self.opts.severity and len(self.opts.severity) > 0:
if self.opts.severity in self.severities.keys():
self.severity = str(self.severities[self.opts.severity])
328,22 → 328,18
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')
bugdata = bugs[0].findAll("td")
bugno = bugdata[3].contents[0].contents[0].strip().encode('utf-8')[-4:]
# print "bug number: %s" % bugno
print "bug number: %s" % bugno
severity = bugdata[8].contents[0].contents[0].strip().encode('utf-8')
severity = bugdata[8].contents[0].strip().encode('utf-8')
severity = None
# print "severity: %s" % severity
print "severity: %s" % severity
pnumber = bugdata[4].contents[0].strip().encode('utf-8')
# print "product number: %s" % pnumber
print "product number: %s" % pnumber
reporter = bugdata[9].contents[0].strip().encode('utf-8')
# print "reporter: %s" % reporter
# print data, [bugno, reporter, severity, pnumber]
print "reporter: %s" % reporter
if [reporter, severity, pnumber] == data:
return bugno
return None
352,7 → 348,6
"""Handles submission of a bug report."""
# depends on self.checkreportopts as it sets all self.var(s)
if not self.opts.noconfirm:
369,19 → 364,6
# except:
# pass
#[<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="" alt="Update Issue" title="Update Issue" /></a></td>,
# <td>normal</td>,
# <td><a href="view.php?id=7342">0007342</a></td>,
# <td></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:
426,11 → 408,8
"""Main controller of the script. It will be called if the script is
run from a command line or can be run by an external script. No other
interface is available."""
# Check if we can access the main page of a Mantis BTS instance.
# Login into a Mantis BTS instance.
# Select and run an action.
if __name__=='__main__':