"Fossies" - the Fresh Open Source Software Archive

Member "svnchecker-0.3/modules/Mantis.py" (12 Mar 2008, 2502 Bytes) of package /linux/privat/old/svnchecker-0.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "Mantis.py" see the Fossies "Dox" file reference documentation.

    1 # Copyright 2008 German Aerospace Center (DLR)
    2 #
    3 # Licensed under the Apache License, Version 2.0 (the "License");
    4 # you may not use this file except in compliance with the License.
    5 # You may obtain a copy of the License at
    6 #
    7 #     http://www.apache.org/licenses/LICENSE-2.0
    8 #
    9 # Unless required by applicable law or agreed to in writing, software
   10 # distributed under the License is distributed on an "AS IS" BASIS,
   11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12 # See the License for the specific language governing permissions and
   13 # limitations under the License.
   14 
   15 """ Class that handles access to the mantis bug tracker. """
   16 
   17 import SOAPpy
   18 
   19 class Mantis:
   20     
   21     def __init__(self, config):
   22         """ Initialize the MantisModule object. """
   23         url = config.getString('Mantis.URL')
   24         self.service = SOAPpy.SOAPProxy(url)
   25         self.user = config.getString('Mantis.User')
   26         self.pw = config.getString('Mantis.Password')
   27 
   28     def issueExists(self, bugID):
   29         """ Return whether a bug exists. """
   30         result = self.service.mc_issue_exists(self.user, self.pw, bugID)
   31         if result == 0:
   32             return False
   33         else:
   34             return True
   35             
   36     def issueGetStatus(self, bugID):
   37         """ Return the status of a bug. """
   38         result = self.service.mc_issue_get(self.user, self.pw, bugID)
   39         return result.status[1]
   40     
   41     def issueGetHandler(self, bugID):
   42         """ Return the handler of a bug. """
   43         result = self.service.mc_issue_get(self.user, self.pw, bugID)
   44         return result.handler.name
   45     
   46     def issueAddNote(self, bugID, note):
   47         """ Adds a note to a bug. """
   48         self.service.mc_issue_note_add(self.user, self.pw, bugID, {'text': note})
   49         
   50     def issueSetCustomFieldIfExists(self, bugID, name, value):
   51         """ Sets the value of a field. """
   52         """
   53         TODO: Currently does not work.
   54         
   55         result = self.service.mc_issue_get(self.user, self.pw, bugID)
   56         
   57         if result.custom_fields:
   58             for i in range(len(result.custom_fields)):
   59                 if result.custom_fields[i]['field']['name'] == name:
   60                     result.custom_fields[i].value = value
   61                     result.reporter.id = 0
   62                     result.reporter.name = ""
   63                     result.reporter.email = ""
   64                     break
   65         
   66         self.service.mc_issue_update(self.user, self.pw, bugID, result)
   67         """
   68         pass