Merge lp:~deejay1/lernid/keyring-integration into lp:lernid

Proposed by Łukasz Jernaś
Status: Needs review
Proposed branch: lp:~deejay1/lernid/keyring-integration
Merge into: lp:lernid
Diff against target: 98 lines (+33/-2)
2 files modified
lernid/ConnectDialog.py (+3/-0)
lernid/EventManager.py (+30/-2)
To merge this branch: bzr merge lp:~deejay1/lernid/keyring-integration
Reviewer Review Type Date Requested Status
John S. Gruber Disapprove
Michael Budde Pending
Review via email: mp+20265@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Łukasz Jernaś (deejay1) wrote :

Works for me...

Revision history for this message
John S. Gruber (jsjgruber) wrote :

I'm sorry it took so long for anyone to get back to you. I recognize that you put significant effort into learning the python gnome keyring interface, and then coding and testing your patch. Michael is no longer maintaining Lernid and the project was without anyone to look after its code for a while. I just started.

I reviewed your code and then tried it. I'm afraid that I have significant reservations about what it is doing (and, I guess, about the validity of the bug for Lernid).

It seems to me that Lernid should, first and foremost, care for students inexperienced with Ubuntu and #ubuntu-classroom. It goes to some pains to negotiate an acceptable nick for them that is like the one they requested. It seems to me that the additional password panel is an enhancement for the experienced user who has figured out how to use other irc clients, and who has negotiated how to set a nickserv password. That sounds like you and me, but not like our inexperienced students.

The bug is about an enhancement to that password enhancement, and it has costs:

1. As I understand it, once a student has entered a password he or she must thereafter enter what should be a high complexity password to unlock the default keyring for Lernid to retrieve the nick password. This *might* happen just once a login session, saving the student who really wants to use his or her registered nick some effort for subsequent launches of Lernid during the same login session. If it is the result of a less experienced student who tried entering a password on a lark, they are stuck entering their gnome password at least once a signon session, and maybe more, for the life of their keyring.

2. It adds a dependency to the package.

3. It adds code and complexity

It simply doesn't seem worth it to me.

The basic problem here is not your code--I think your code is sound. The problem is the nature of the enhancement requested in bug LP: #527370. I think I'll wait a couple of days and then mark the bug "won't fix".

I regret that you have waited over a year for a response, much less for a response like this, and I regret that this is the nature of our first contact. I sincerely I hope that I haven't put you off Lernid with my opinion.

review: Disapprove

Unmerged revisions

183. By Łukasz Jernaś

Fix exceptions, remove unnecessary dictionary

182. By Łukasz Jernaś

Keep NickServ password in GNOME keyring

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lernid/ConnectDialog.py'
--- lernid/ConnectDialog.py 2010-02-13 15:43:30 +0000
+++ lernid/ConnectDialog.py 2010-02-27 09:35:21 +0000
@@ -99,6 +99,9 @@
99 def get_password(self):99 def get_password(self):
100 return self.builder.get_object('password').get_text()100 return self.builder.get_object('password').get_text()
101101
102 def set_password(self, password):
103 return self.builder.get_object('password').set_text(password)
104
102 def is_valid_nick(self, nick_te):105 def is_valid_nick(self, nick_te):
103 alpha = 'abcdefghijklmnopqrstuvwxyz'106 alpha = 'abcdefghijklmnopqrstuvwxyz'
104 alpha = alpha + alpha.upper()107 alpha = alpha + alpha.upper()
105108
=== modified file 'lernid/EventManager.py'
--- lernid/EventManager.py 2010-02-13 15:43:30 +0000
+++ lernid/EventManager.py 2010-02-27 09:35:21 +0000
@@ -23,6 +23,7 @@
23import ConfigParser23import ConfigParser
24import urllib24import urllib
25import logging25import logging
26import gnomekeyring
2627
27from lernid import ConnectDialog28from lernid import ConnectDialog
28from lernid.PasswordDialog import PasswordDialog29from lernid.PasswordDialog import PasswordDialog
@@ -59,6 +60,8 @@
59 self._passworddialog = None60 self._passworddialog = None
60 self._widgets = {}61 self._widgets = {}
61 self._read_config()62 self._read_config()
63
64 self._keyring = gnomekeyring.get_default_keyring_sync()
6265
63 @classmethod66 @classmethod
64 def get_instance(cls):67 def get_instance(cls):
@@ -96,7 +99,29 @@
96 Statusbar.push_message(_('Connecting to event'), duration=10)99 Statusbar.push_message(_('Connecting to event'), duration=10)
97 self._isconnected = True100 self._isconnected = True
98 self.emit('event-connect', self._event)101 self.emit('event-connect', self._event)
102
103 # Checks the GNOME keyring for a password for the specified nick
104 def get_keyring_password(self, nick):
105 try:
106 # Reads only the first entry, because the search shouldn't return more
107 password = gnomekeyring.find_network_password_sync(nick, None, 'irc.freenode.net',
108 'Lernid', 'irc')[0]['password']
109 return password
110 except gnomekeyring.NoMatchError:
111 return ''
112 except gnomekeyring.DeniedError:
113 logging.debug('Failed to read from keyring')
114 return ''
115 return ''
99116
117 # Sets or updates keyring password for the specified nick
118 def set_keyring_password(self, nick, password):
119 keyring_data = {'user': nick, 'server': 'irc.freenode.net', 'protocol': 'irc', 'object': 'Lernid'}
120 try:
121 gnomekeyring.item_create_sync(self._keyring, gnomekeyring.ITEM_NETWORK_PASSWORD,'Lernid', keyring_data, password, True)
122 except gnomekeyring.DeniedError:
123 logging.debug('Failed to add keyring item')
124
100 def _identify_nick(self, nick, password):125 def _identify_nick(self, nick, password):
101 server = Server.get_server('irc.freenode.net', nick)126 server = Server.get_server('irc.freenode.net', nick)
102 identifier = server.identify_nick(password)127 identifier = server.identify_nick(password)
@@ -108,10 +133,10 @@
108 self._passworddialog = PasswordDialog.new()133 self._passworddialog = PasswordDialog.new()
109 password = self._passworddialog.run()134 password = self._passworddialog.run()
110 if password != None:135 if password != None:
136 self.set_keyring_password(nick,password)
111 identifier.retry(password)137 identifier.retry(password)
112 identifier.connect('invalid-password', retry)138 identifier.connect('invalid-password', retry)
113139
114
115 def connect_dialog(self, widget=None, parent=None):140 def connect_dialog(self, widget=None, parent=None):
116 """Show the connect dialog and connect to the resources."""141 """Show the connect dialog and connect to the resources."""
117 if not self._connectdialog:142 if not self._connectdialog:
@@ -119,6 +144,7 @@
119 self._connectdialog.set_transient_for(parent)144 self._connectdialog.set_transient_for(parent)
120 self._connectdialog.connect('response', self._connect_dialog_reponse)145 self._connectdialog.connect('response', self._connect_dialog_reponse)
121 self._connectdialog.set_nick(Preferences.get('nick'))146 self._connectdialog.set_nick(Preferences.get('nick'))
147 self._connectdialog.set_password(self.get_keyring_password(Preferences.get('nick')))
122 self._connectdialog.set_transient_for(widget)148 self._connectdialog.set_transient_for(widget)
123 self._connectdialog.show()149 self._connectdialog.show()
124150
@@ -130,6 +156,7 @@
130 self._connect_event(event, nick)156 self._connect_event(event, nick)
131 password = self._connectdialog.get_password()157 password = self._connectdialog.get_password()
132 if password:158 if password:
159 self.set_keyring_password(nick, password)
133 self._identify_nick(nick, password)160 self._identify_nick(nick, password)
134161
135 def disconnect(self):162 def disconnect(self):
@@ -159,3 +186,4 @@
159 return self._widgets[name]186 return self._widgets[name]
160 return None187 return None
161188
189

Subscribers

People subscribed via source and target branches