1
2
3
4 """
5 Base class for bug tracker abstractions.
6 """
7
8 import sys
9
10 from moap.util import log, util
11
13 """
14 Detect which bug tracker is being used at the given URL.
15
16 @returns: an instance of a subclass of L{BugTracker}, or None.
17 """
18 log.debug('bug', 'detecting bug tracker at %s' % URL)
19 systems = util.getPackageModules('moap.bug', ignore=['bug', ])
20
21 for s in systems:
22 m = util.namedModule('moap.bug.%s' % s)
23
24 try:
25 ret = m.detect(URL)
26 except AttributeError:
27 sys.stderr.write('moap.bug.%s is missing detect()\n' % s)
28 continue
29
30 if ret:
31 try:
32 o = m.BugClass(ret)
33 except AttributeError:
34 sys.stderr.write('moap.bug.%s is missing BugClass()\n' % s)
35 continue
36
37 return o
38 log.debug('bug', 'did not find %s' % s)
39
40 return None
41
45
47 return '<%s instance at %s>' % (str(self.__class__), self.URL)
48
50 """
51 Get the Bug identified by the given id.
52 """
53 raise NotImplementedError
54
55 - def query(self, queryString):
56 """
57 Query the database using the given query string.
58
59 @rtype: list of L{Bug}
60 """
61
62
63 -class Bug(log.Loggable):
64 """
65 I am a bug in a bug tracker.
66
67 @type id: str
68 @type summary: str
69 """
70 id = None
71 summary = None
72
76
78 """
79 The bug with the given id was not found.
80 """
84