GTG

Merge lp:~pcabido/gtg/hackathon into lp:~gtg/gtg/old-trunk

Proposed by Paulo Cabido
Status: Merged
Merged at revision: 1049
Proposed branch: lp:~pcabido/gtg/hackathon
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 194 lines (+58/-25)
5 files modified
GTG/gtk/preferences.py (+29/-11)
GTG/plugins/bugzilla/bug.py (+20/-10)
GTG/plugins/bugzilla/bugzilla.py (+3/-3)
GTG/plugins/bugzilla/server.py (+5/-0)
GTG/plugins/notification_area/notification_area.py (+1/-1)
To merge this branch: bzr merge lp:~pcabido/gtg/hackathon
Reviewer Review Type Date Requested Status
Izidor Matušov code Approve
Review via email: mp+83483@code.launchpad.net

Description of the change

This branch has some bug fixes including two critical bugs: bug #577111 and fixed bug #565572

To post a comment you must log in.
Revision history for this message
Izidor Matušov (izidor) wrote :

Hi,

I tried to apply your change about bugzilla plugin. I've installed

sudo apt-get install python-bugz

I've run (the small unittest)

python GTG/plugins/bugzilla/bug.py

and it does not work with your change... However, if I run the old version, I get a different traceback
<traceback>
Traceback (most recent call last):
  File "GTG/plugins/bugzilla/bug.py", line 46, in <module>
    for bug in [Bug('http://bugzilla.gnome.org', '598354'),
  File "GTG/plugins/bugzilla/bug.py", line 21, in __init__
    self.bug = Bugz(base).get(nb)
  File "/usr/lib/python2.7/dist-packages/bugz.py", line 842, in get
    etree = ElementTree.parse(fd, parser)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1177, in parse
    tree.parse(source, parser)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 653, in parse
    parser.feed(data)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1623, in feed
    except self._error, v:
AttributeError: 'ForcedEncodingXMLTreeBuilder' object has no attribute '_error'
</traceback>

I am not sure what is going on there, could you investigate it, please?

I can confirm that those bugs are solved in this branch.

Could please also remove on_plugin_about_close_foo() method?

Thanks for your contribution, setting to Needs Fixing because of that bugzilla plugin.

review: Needs Fixing (code, running)
lp:~pcabido/gtg/hackathon updated
1037. By Paulo Cabido

removed the on_plugin_about_close_foo function that had I used for debugging

1038. By Paulo Cabido

added gentoo to the server list and changed the pybugz import

1039. By Paulo Cabido

changed the default action of the bugzilla plugin to skip auth

1040. By Paulo Cabido

added one extra exception to handle python-bugz (pybugz) < 0.9

1041. By Paulo Cabido

latest changes

Revision history for this message
Izidor Matušov (izidor) wrote :

Paulo thanks for the extra work :-)

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/gtk/preferences.py'
2--- GTG/gtk/preferences.py 2011-11-19 21:41:08 +0000
3+++ GTG/gtk/preferences.py 2011-12-10 11:29:25 +0000
4@@ -83,7 +83,8 @@
5 # get lists
6 modules = plugin.missing_modules
7 dbus = plugin.missing_dbus
8-
9+ text = ""
10+
11 # convert to strings
12 if modules:
13 modules = "<small><b>%s</b></small>" % ', '.join(modules)
14@@ -137,7 +138,7 @@
15 """Constructor."""
16 self.config_obj = config_obj
17 self.req = req
18- self.config = self.config_obj.conf_dict
19+ self.config = self.config_obj.conf_dict
20 self.builder = gtk.Builder()
21 self.builder.add_from_file(ViewConfig.PREFERENCES_GLADE_FILE)
22 # store references to some objects
23@@ -158,6 +159,20 @@
24 #FIXME: this is not needed and should be removed
25 # self.tb = taskbrowser
26 self.pengine = PluginEngine()
27+ #plugin config initiation, if never used
28+ if self.config.has_key("plugins"):
29+ if self.config["plugins"].has_key("enabled") == False:
30+ self.config["plugins"]["enabled"] = []
31+
32+ if self.config["plugins"].has_key("disabled") == False:
33+ self.config["plugins"]["disabled"] = []
34+ else:
35+ if self.pengine.get_plugins():
36+ self.config["plugins"] = {}
37+ self.config["plugins"]["disabled"] = \
38+ [p.module_name for p in self.pengine.get_plugins("disabled")]
39+ self.config["plugins"]["enabled"] = \
40+ [p.module_name for p in self.pengine.get_plugins("enabled")]
41 # initialize tree models
42 self._init_backend_tree()
43 # this can't happen yet, due to the order of things in
44@@ -165,6 +180,9 @@
45 # self._init_plugin_tree()
46 pref_signals_dic = self.get_signals_dict()
47 self.builder.connect_signals(pref_signals_dic)
48+
49+ #this line enables the about dialog widget to be reused
50+ self.plugin_about_dialog.connect("delete-event", lambda w, e: self.plugin_about_dialog.hide() or True)
51
52 def _init_backend_tree(self):
53 """Initialize the BackendTree gtk.TreeView."""
54@@ -304,15 +322,6 @@
55 def on_close(self, widget, data = None):
56 """Close the preferences dialog."""
57
58- if self.pengine.get_plugins():
59- self.config["plugins"] = {}
60- self.config["plugins"]["disabled"] = \
61- [p.module_name for p in self.pengine.get_plugins("disabled")]
62- self.config["plugins"]["enabled"] = \
63- [p.module_name for p in self.pengine.get_plugins("enabled")]
64-
65- self.config_obj.save()
66-
67 self.dialog.hide()
68 return True
69
70@@ -327,6 +336,7 @@
71 return
72 plugin_id = self.plugin_store.get_value(iter, PLUGINS_COL_ID)
73 p = self.pengine.get_plugin(plugin_id)
74+
75 pad = self.plugin_about_dialog
76 pad.set_name(p.full_name)
77 pad.set_version(p.version)
78@@ -371,10 +381,18 @@
79 p.enabled = not self.plugin_store.get_value(iter, PLUGINS_COL_ENABLED)
80 if p.enabled:
81 self.pengine.activate_plugins([p])
82+ self.config["plugins"]["enabled"].append(p.module_name)
83+ if p.module_name in self.config["plugins"]["disabled"]:
84+ self.config["plugins"]["disabled"].remove(p.module_name)
85 else:
86 self.pengine.deactivate_plugins([p])
87+ self.config["plugins"]["disabled"].append(p.module_name)
88+ if p.module_name in self.config["plugins"]["enabled"]:
89+ self.config["plugins"]["enabled"].remove(p.module_name)
90 self.plugin_store.set_value(iter, PLUGINS_COL_ENABLED, p.enabled)
91 self._update_plugin_configure(p)
92+
93+ self.config_obj.save()
94
95 def toggle_preview(self, widget):
96 """Toggle previews in the task view on or off."""
97
98=== modified file 'GTG/plugins/bugzilla/bug.py'
99--- GTG/plugins/bugzilla/bug.py 2009-12-03 09:59:33 +0000
100+++ GTG/plugins/bugzilla/bug.py 2011-12-10 11:29:25 +0000
101@@ -14,11 +14,21 @@
102 # You should have received a copy of the GNU General Public License along with
103 # this program. If not, see <http://www.gnu.org/licenses/>.
104
105-from bugz import Bugz
106+#this handles old versions of pybugz as well as new ones
107+try:
108+ from bugz import bugzilla
109+except:
110+ import bugz as bugzilla
111+
112+#changed the default action to skip auth
113
114 class Bug:
115 def __init__(self, base, nb):
116- self.bug = Bugz(base).get(nb)
117+ #this also handles old versions of pybugz
118+ try:
119+ self.bug = bugzilla.Bugz(base, skip_auth=True).get(nb)
120+ except:
121+ self.bug = bugzilla.Bugz(base).get(nb)
122 if self.bug is None:
123 raise Exception('Failed to create bug')
124
125@@ -42,11 +52,11 @@
126 comment = self.bug.findall('//long_desc')[0]
127 return comment.find('.//thetext').text
128
129-if __name__ == '__main__':
130- for bug in [Bug('http://bugzilla.gnome.org', '598354'),
131- Bug('http://bugs.freedesktop.org', '24120')]:
132- print "title:", bug.get_title()
133- print "product:", bug.get_product()
134- print "component:", bug.get_component()
135- print "description:", bug.get_description()
136- print ""
137+#if __name__ == '__main__':
138+# for bug in [Bug('http://bugzilla.gnome.org', '598354'),
139+# Bug('http://bugs.freedesktop.org', '24120')]:
140+# print "title:", bug.get_title()
141+# print "product:", bug.get_product()
142+# print "component:", bug.get_component()
143+# print "description:", bug.get_description()
144+# print ""
145
146=== modified file 'GTG/plugins/bugzilla/bugzilla.py'
147--- GTG/plugins/bugzilla/bugzilla.py 2011-11-19 21:41:08 +0000
148+++ GTG/plugins/bugzilla/bugzilla.py 2011-12-10 11:29:25 +0000
149@@ -54,14 +54,14 @@
150 if server is None:
151 return
152
153- base = '%s://%s' % (r.scheme, server.name)
154-
155+ base = '%s://%s' % (r.scheme, server.name)
156+
157 # get the number of the bug
158 try:
159 nb = r.query.split('id=')[1]
160 except IndexError:
161 return
162-
163+
164 try:
165 bug = Bug(base, nb)
166 except:
167
168=== modified file 'GTG/plugins/bugzilla/server.py'
169--- GTG/plugins/bugzilla/server.py 2010-05-26 20:21:27 +0000
170+++ GTG/plugins/bugzilla/server.py 2011-12-10 11:29:25 +0000
171@@ -40,6 +40,11 @@
172 server = Server('bugzilla.samba.org')
173 server.tag = SERVER_TAG_COMPONENT
174 self.add(server)
175+
176+ # GENTOO
177+ server = Server('bugs.gentoo.org')
178+ server.tag = SERVER_TAG_COMPONENT
179+ self.add(server)
180
181 def add(self, server):
182 self.servers[server.name] = server
183
184=== modified file 'GTG/plugins/notification_area/notification_area.py'
185--- GTG/plugins/notification_area/notification_area.py 2011-08-07 08:57:59 +0000
186+++ GTG/plugins/notification_area/notification_area.py 2011-12-10 11:29:25 +0000
187@@ -85,7 +85,7 @@
188 if self.__indicator:
189 self.__indicator.set_status(appindicator.STATUS_PASSIVE)
190 else:
191- self.__status_icon.set_visible(False)
192+ self.status_icon.set_visible(False)
193
194 ## Helper methods ##############################################################
195

Subscribers

People subscribed via source and target branches

to status/vote changes: