Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:iboss32
awn-extras
903-mail-fix-io-error.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 903-mail-fix-io-error.patch of Package awn-extras
------------------------------------------------------------ revno: 1395 [merge] fixes bug(s): https://launchpad.net/bugs/581075 https://launchpad.net/bugs/610088 committer: Gabor Karsay <gabor.karsay@gmx.at> branch nick: awn-extras timestamp: Wed 2010-09-15 22:12:17 +0200 message: Mail: unlock keyring on startup ------------------------------------------------------------ === modified file 'applets/maintained/mail/mail.py' Index: awn-extras-0.4.1/applets/maintained/mail/mail.py =================================================================== --- awn-extras-0.4.1.orig/applets/maintained/mail/mail.py 2010-09-24 17:17:31.000000000 +0200 +++ awn-extras-0.4.1/applets/maintained/mail/mail.py 2010-09-24 17:17:37.000000000 +0200 @@ -83,7 +83,7 @@ """ Login. Try to login from saved key, if this does not exist or force is True, show login dialog - + """ self.awn.theme.icon("login") @@ -107,6 +107,9 @@ key = self.awn.keyring.from_token(token) + if not self.awn.keyring.unlock(): + return self.login(True) + self.perform_login(key) def logout(self): @@ -116,9 +119,8 @@ self.awn.settings["login-token"] = 0 def perform_login(self, key): -# if key.token == 0: -# self.__dialog.login_form(True, "Both username and password must be specified.") -# return + if key.token == 0: + return try: self.mail = self.back(key) # Login @@ -210,11 +212,11 @@ """ states = { - "error" : "error", - "login" : "login", - "read" : "mail-read", - "unread": "mail-unread" - } + "error": "error", + "login": "login", + "read": "mail-read", + "unread": "mail-unread"} + self.awn.theme.set_states(states) theme = self.awn.settings["theme"] if self.awn.settings["theme"] != system_theme_name else None self.awn.theme.theme(theme) @@ -280,7 +282,7 @@ def email_list(self): """ Creates a dialog with mail subjects and 3-4 buttons - + """ self.__remove_current() self.__current_type = "email_list" @@ -301,7 +303,7 @@ # This'll be the "show web interface" button b = gtk.Button() - b.set_relief(gtk.RELIEF_NONE) # Found it; that's a relief + b.set_relief(gtk.RELIEF_NONE) # Found it; that's a relief b.set_image(gtk.image_new_from_stock(gtk.STOCK_NETWORK, gtk.ICON_SIZE_BUTTON)) b.set_tooltip_text(_("Open Web Mail")) @@ -405,7 +407,7 @@ def login_form(self, error=False, message=_("Wrong username or password")): """ Creates a dialog the login form - + """ self.__remove_current() self.__current_type = "login_form" @@ -473,6 +475,7 @@ gtk.ICON_SIZE_BUTTON) submit_button = gtk.Button(label=_("Log In"), use_underline=False) submit_button.set_image(image_login) + def onsubmit(widget): self.__parent.perform_login( t["callback"](t["widgets"], self.__parent.awn)) @@ -506,7 +509,7 @@ def update(self): - if not self.key.attrs.has_key("username"): + if not "username" in self.key.attrs: raise RuntimeError(_("Could not log in: No username")) return @@ -528,8 +531,8 @@ self.subjects.append(i.title) def __cleanGmailSubject(self, n): - n = re.sub(r"^[^>]*\\>", "", n) # "sadf\>fdas" -> "fdas" - n = re.sub(r"\\[^>]*\\>$", "", n) # "asdf\afdsasdf\>" -> "asdf" + n = re.sub(r"^[^>]*\\>", "", n) # "sadf\>fdas" -> "fdas" + n = re.sub(r"\\[^>]*\\>$", "", n) # "asdf\afdsasdf\>" -> "asdf" n = n.replace(""", "\"") n = n.replace("&", "&") n = n.replace(" ", "") @@ -543,7 +546,7 @@ def __cleanMsg(self, n): n = re.sub("\n\s*\n", "\n", n) n = re.sub("&[#x(0x)]?\w*;", " ", n) - n = re.sub("\<[^\<\>]*?\>", "", n) # "<h>asdf<a></h>" -> "asdf" + n = re.sub("\<[^\<\>]*?\>", "", n) # "<h>asdf<a></h>" -> "asdf" f = False h = [] @@ -569,8 +572,8 @@ def update(self): - if not self.key.attrs.has_key("username") or \ - not self.key.attrs.has_key("domain"): + if not "username" in self.key.attrs or \ + not "domain" in self.key.attrs: raise RuntimeError(_("Could not log in: No username or domain")) return @@ -593,8 +596,8 @@ self.subjects.append(i.title) def __cleanGmailSubject(self, n): - n = re.sub(r"^[^>]*\\>", "", n) # "sadf\>fdas" -> "fdas" - n = re.sub(r"\\[^>]*\\>$", "", n) # "asdf\afdsasdf\>" -> "asdf" + n = re.sub(r"^[^>]*\\>", "", n) # "sadf\>fdas" -> "fdas" + n = re.sub(r"\\[^>]*\\>$", "", n) # "asdf\afdsasdf\>" -> "asdf" n = n.replace(""", "\"") n = n.replace("&", "&") n = n.replace(" ", "") @@ -608,7 +611,7 @@ def __cleanMsg(self, n): n = re.sub("\n\s*\n", "\n", n) n = re.sub("&[#x(0x)]?\w*;", " ", n) - n = re.sub("\<[^\<\>]*?\>", "", n) # "<h>asdf<a></h>" -> "asdf" + n = re.sub("\<[^\<\>]*?\>", "", n) # "<h>asdf<a></h>" -> "asdf" f = False h = [] @@ -653,6 +656,7 @@ except: pass else: + class UnixSpool: title = _("Unix Spool") @@ -699,6 +703,7 @@ except: pass else: + class POP: title = "POP" @@ -715,7 +720,7 @@ raise RuntimeError(_("Could not log in: ") + str(message)) else: - if not key.attrs.has_key("username"): + if not "username" in key.attrs: raise RuntimeError(_("Could not log in: No username")) self.server.user(key.attrs["username"]) try: @@ -787,6 +792,7 @@ except: pass else: + class IMAP: title = "IMAP" @@ -823,7 +829,7 @@ s = self.server.fetch(i, '(BODY[HEADER.FIELDS (SUBJECT)])')[1][0] if s is not None: - self.subjects.append(s[1][9:].replace("\r\n", "\n").replace("\n", "")) # Don't ask + self.subjects.append(s[1][9:].replace("\r\n", "\n").replace("\n", "")) # Don't ask else: mboxs = [re.search("(\W*) (\W*) (.*)", i).groups()[2][1:-1] for i in self.server.list()[1]] mboxs = [i for i in mboxs if i not in ("Sent", "Trash") and i[:6] != "[Gmail]"] @@ -843,7 +849,7 @@ s = self.server.fetch(i, '(BODY[HEADER.FIELDS (SUBJECT)])')[1][0] if s is not None: - self.subjects.append(s[1][9:].replace("\r\n", "\n").replace("\n", "")) # Don't ask + self.subjects.append(s[1][9:].replace("\r\n", "\n").replace("\n", "")) # Don't ask @classmethod def drawLoginWindow(cls, *groups): Index: awn-extras-0.4.1/shared/python/awnlib.py =================================================================== --- awn-extras-0.4.1.orig/shared/python/awnlib.py 2010-08-29 13:19:23.000000000 +0200 +++ awn-extras-0.4.1/shared/python/awnlib.py 2010-09-24 17:17:37.000000000 +0200 @@ -568,6 +568,7 @@ def set_error_icon_and_click_to_restart(self): self.__parent.icon.theme("dialog-error") + def crash_applet(widget=None, event=None): gtk.main_quit() self.__parent.connect("clicked", crash_applet) @@ -594,7 +595,7 @@ error_type = type(error).__name__ error = str(error) if traceback is not None: - print "\n".join(["-"*80, traceback, "-"*80]) + print "\n".join(["-" * 80, traceback, "-" * 80]) summary = "%s in %s: %s" % (error_type, self.__parent.meta["name"], error) if self.__parent.meta["version"] == __version__: args["message"] = "Visit Launchpad and report the bug by following these steps:\n\n" \ @@ -637,6 +638,7 @@ copy_summary_button.connect("clicked", clicked_cb, summary) if callable(callback): + def response_cb(widget, response): if response < 0: callback() @@ -782,7 +784,7 @@ """ self.__config_object = None - + type_client = type(client) if client is None: self.__client = awn.config_get_default(awn.PANEL_ID_DEFAULT) @@ -932,6 +934,33 @@ k.token = token return k + def unlock(self): + """Unlock keyring. + + @return: True if keyring is unlocked, False if locked. + + """ + + info = gnomekeyring.get_info_sync(None) + if not info.get_is_locked(): + return True + + # The straight way would be: + # gnomekeyring.unlock_sync(None, None) + # But this results in a type error, see launchpad bugs #432882. + # We set a dummy key instead and delete it immediately, + # this triggers a user dialog to unlock the keyring. + try: + tmp = gnomekeyring.item_create_sync(None, \ + gnomekeyring.ITEM_GENERIC_SECRET, "awn-extras dummy", \ + {"dummy_attr": "none"}, "dummy_pwd", True) + except gnomekeyring.CancelledError: + return False + gnomekeyring.item_delete_sync(None, tmp) + + info = gnomekeyring.get_info_sync(None) + return not info.get_is_locked() + class Key(object): def __init__(self, token=0): @@ -966,8 +995,11 @@ else: # Generic included type = gnomekeyring.ITEM_GENERIC_SECRET - self.token = gnomekeyring.item_create_sync(None, type, name, \ - attrs, pwd, True) + try: + self.token = gnomekeyring.item_create_sync(None, type, name, \ + attrs, pwd, True) + except gnomekeyring.CancelledError: + self.token = 0 def delete(self): """Delete the current key. Will also reset the token. Note that @@ -1220,7 +1252,7 @@ self.__notification.set_timeout(timeout * 1000) def show(self): - self.__notification.show() + self.__notification.show() class Meta:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor