def __setProperties(self):
        # Fix for OS X where wx.DEFAULT isn't sane
        pointSize = wx.DEFAULT

        if Platform.IsOSX():
            pointSize = 12

        self.info1.SetFont(wx.Font(pointSize, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        self.info3.SetFont(wx.Font(pointSize, wx.DEFAULT, wx.NORMAL, wx.BOLD))
        self.info5.SetFont(wx.Font(pointSize, wx.DEFAULT, wx.NORMAL, wx.BOLD))
Exemple #2
0
def SubmitBug(comment, profile, email, logFile=VENUE_CLIENT_LOG):
    """
    Submits a bug to bugzilla. 

    **Parameters**
      *comment* = Bug description from reporter
      *profile* = Client Profile describing reporter
      *email* = Entered email address for support information. If the email
                is blank, the reporter does not want to be contacted.
    """

    url = "http://bugzilla.mcs.anl.gov/accessgrid/post_bug.cgi"
    args = {}

    bugzilla_login = '******'
    bugzilla_password = '******'

    args['Bugzilla_login'] = bugzilla_login
    args['Bugzilla_password'] = bugzilla_password
    version = '%s %s' % (str(GetVersion()), str(GetStatus()))
    version = version.strip()
    args['version'] = version
    args['rep_platform'] = "Other"

    #
    # This detection can get beefed up a lot; I say
    # NT because I can't tell if it's 2000 or XP and better
    # to not assume there.
    #
    # cf http://www.lemburg.com/files/python/platform.py
    #

    if Platform.IsLinux():
        args['op_sys'] = "Linux"
        args['rep_platform'] = "All"  # Need a better check for this.
    elif Platform.IsWindows():
        args['op_sys'] = "Windows NT"
        args['rep_platform'] = "PC"
    elif Platform.IsOSX():
        args['op_sys'] = "MacOS X"
        args['rep_platform'] = "Macintosh"
    else:
        args['op_sys'] = "other"

    args['priority'] = "P2"
    args['bug_severity'] = "normal"
    args['bug_status'] = "NEW"
    args['assigned_to'] = ""
    args['cc'] = "*****@*****.**"  # email to be cc'd
    args['bug_file_loc'] = "http://"

    args['submit'] = "    Commit    "
    args['form_name'] = "enter_bug"

    # Combine comment, profile, and log file information

    userConfig = Config.UserConfig.instance()

    # Get config information
    configData = "\n%s" % userConfig
    configData += "\n%s\n" % Config.SystemConfig.instance()

    # Defaults.
    args['product'] = "Virtual Venues Client Software"
    args['component'] = "Client UI"
    logToSearch = None

    if profile:
        # Always set profile email to empty string so we don't write
        # to wrong email address.
        profile.email = ""
        profileString = str(profile)

    else:
        profileString = "This reporter does not have a client profile"

    if email == "":
        # This reporter does not want to be contacted. Do not submit
        # email address.
        email = "This reporter does not want to be contacted.  No email address specified."

    def AppendNodeLogs(text):
        text = text +"\n\n--- ServiceManager.log INFORMATION ---\n\n"+ \
               GetLogText(2000, "ServiceManager.log")\

        logDir = userConfig.GetLogDir()
        otherServiceLogs = os.listdir(logDir)

        for serviceLog in otherServiceLogs:
            if serviceLog.endswith('Service.log'):
                text = text \
                       +"\n\n--- %s INFORMATION ---\n\n" % (serviceLog,)    \
                       +GetLogText(2000, serviceLog)

        return text

    commentAndLog = "\n\n--- EMAIL TO CONTACT REPORTER ---\n\n" + str(email) \
                +"\n\n--- REPORTER CLIENT PROFILE --- \n\n" + profileString \
                +"\n\n--- COMMENT FROM REPORTER --- \n\n" + comment

    logText = None

    if logFile == NO_LOG:
        args['short_desc'] = "Feature or bug report from menu option"

    elif logFile == VENUE_MANAGEMENT_LOG:
        args['short_desc'] = "Automatic Bug Report - Venue Management"

        args['product'] = "Virtual Venue Server Software"
        args['component'] = "Management UI"

        logText = GetLogText(10000, "VenueManagement.log")
        commentAndLog = commentAndLog \
            +"\n\n--- VenueManagement.log INFORMATION ---\n\n"+ logText

    elif logFile == NODE_SETUP_WIZARD_LOG:
        args['short_desc'] = "Automatic Bug Report - Node Setup Wizard"

        args['product'] = "Node Management Software"
        args['component'] = "NodeSetupWizard"

        logText = GetLogText(10000, "NodeSetupWizard.log")
        commentAndLog = commentAndLog \
            +"\n\n--- NodeSetupWizard.log INFORMATION ---\n\n"+ logText

        commentAndLog = AppendNodeLogs(commentAndLog)

    else:
        args['short_desc'] = "Automatic Bug Report - Venue Client"
        logToSearch = GetLogText(10000, "VenueClient.log")

        commentAndLog = commentAndLog \
             +"\n\n--- VenueClient.log INFORMATION ---\n\n"+ logToSearch \

        commentAndLog = AppendNodeLogs(commentAndLog)

    # If we've got a logToSearch, look at it to find a exception
    # at the end.  If it has one, mark the component as Certificate
    # Management.

    if logToSearch:
        loc = logToSearch.rfind("Traceback")
        if loc >= 0:
            m = re.search(".*Exception.*", logToSearch[loc:])
            if m:
                args['component'] = "Certificate Management"

        logToSearch = None

    # Look at the end of the log and guess whether we need to mark this
    args['comment'] = configData + "\n\n" + commentAndLog

    # Now submit to the form.
    params = urllib.urlencode(args)

    f = urllib.urlopen(url, params)

    # And read the output.
    out = f.read()
    f.close()

    o = open("out.html", "w")
    o.write(out)
    o.close()