Show More
@@ -80,11 +80,7 class bugzilla_2_16(object): | |||
|
80 | 80 | self.conn = MySQLdb.connect(host=host, user=user, passwd=passwd, |
|
81 | 81 | db=db, connect_timeout=timeout) |
|
82 | 82 | self.cursor = self.conn.cursor() |
|
83 | self.run('select fieldid from fielddefs where name = "longdesc"') | |
|
84 | ids = self.cursor.fetchall() | |
|
85 | if len(ids) != 1: | |
|
86 | raise util.Abort(_('unknown database schema')) | |
|
87 | self.longdesc_id = ids[0][0] | |
|
83 | self.longdesc_id = self.get_longdesc_id() | |
|
88 | 84 | self.user_ids = {} |
|
89 | 85 | |
|
90 | 86 | def run(self, *args, **kwargs): |
@@ -96,6 +92,14 class bugzilla_2_16(object): | |||
|
96 | 92 | self.ui.note(_('failed query: %s %s\n') % (args, kwargs)) |
|
97 | 93 | raise |
|
98 | 94 | |
|
95 | def get_longdesc_id(self): | |
|
96 | '''get identity of longdesc field''' | |
|
97 | self.run('select fieldid from fielddefs where name = "longdesc"') | |
|
98 | ids = self.cursor.fetchall() | |
|
99 | if len(ids) != 1: | |
|
100 | raise util.Abort(_('unknown database schema')) | |
|
101 | return ids[0][0] | |
|
102 | ||
|
99 | 103 | def filter_real_bug_ids(self, ids): |
|
100 | 104 | '''filter not-existing bug ids from list.''' |
|
101 | 105 | self.run('select bug_id from bugs where bug_id in %s' % buglist(ids)) |
@@ -182,11 +186,26 class bugzilla_2_16(object): | |||
|
182 | 186 | values (%s, %s, %s, %s)''', |
|
183 | 187 | (bugid, userid, now, self.longdesc_id)) |
|
184 | 188 | |
|
189 | class bugzilla_3_0(bugzilla_2_16): | |
|
190 | '''support for bugzilla 3.0 series.''' | |
|
191 | ||
|
192 | def __init__(self, ui): | |
|
193 | bugzilla_2_16.__init__(self, ui) | |
|
194 | ||
|
195 | def get_longdesc_id(self): | |
|
196 | '''get identity of longdesc field''' | |
|
197 | self.run('select id from fielddefs where name = "longdesc"') | |
|
198 | ids = self.cursor.fetchall() | |
|
199 | if len(ids) != 1: | |
|
200 | raise util.Abort(_('unknown database schema')) | |
|
201 | return ids[0][0] | |
|
202 | ||
|
185 | 203 | class bugzilla(object): |
|
186 | 204 | # supported versions of bugzilla. different versions have |
|
187 | 205 | # different schemas. |
|
188 | 206 | _versions = { |
|
189 | 207 | '2.16': bugzilla_2_16, |
|
208 | '3.0': bugzilla_3_0 | |
|
190 | 209 | } |
|
191 | 210 | |
|
192 | 211 | _default_bug_re = (r'bugs?\s*,?\s*(?:#|nos?\.?|num(?:ber)?s?)?\s*' |
General Comments 0
You need to be logged in to leave comments.
Login now