Merge lp:~nacl/wicd/1.6-access-denied into lp:wicd/1.6

Proposed by Andrew Psaltis
Status: Merged
Approved by: Adam Blackburn
Approved revision: 423
Merged at revision: not available
Proposed branch: lp:~nacl/wicd/1.6-access-denied
Merge into: lp:wicd/1.6
Diff against target: None lines
To merge this branch: bzr merge lp:~nacl/wicd/1.6-access-denied
Reviewer Review Type Date Requested Status
Dan O'Reilly Needs Fixing
Robby Workman (community) Approve
Review via email: mp+7698@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Andrew Psaltis (nacl) wrote :

This resolves bug 333867, although at the moment, I am not too sure about the message in the dialog that wicd-client generates. I wasn't too sure if it should be much like the one I stuck into wicd-curses: "wicd-curses was denied access to the wicd daemon, please check that your user is in the group '%WICDGROUP%'."

lp:~nacl/wicd/1.6-access-denied updated
421. By Andrew Psaltis

Use the ANSI escape sequences to print colors instead of fetching them using tput(1) in wicd-curses.

422. By Andrew Psaltis

Made the wicd-curses "access denied" string translatable, and updated wicd-curses.py to use it.

Revision history for this message
Robby Workman (rworkman) wrote :

Looks good to me, but to be nitpicky:
"wicd-curses was denied access to the wicd daemon: please check that your user is in the '%WICDGROUP%' group."

review: Approve
Revision history for this message
Dan O'Reilly (oreilldf) wrote :

The "except Exception as e" is new in Python 2.6. We have to be 2.5 compatible.

review: Needs Fixing
Revision history for this message
Dan O'Reilly (oreilldf) wrote :

Also, you should use the subprocess module (subprocess.call() would probably work here) instead of os.system().

lp:~nacl/wicd/1.6-access-denied updated
423. By Andrew Psaltis

Restore python 2.5 compatibility in both clients.

Revision history for this message
Andrew Psaltis (nacl) wrote :

Robby: The text has been changed in the translator.

Dan: I made the fix to restore python 2.5 compatibility. Also, I no longer use os.system() in wicd-curses, the diff here just doesn't show it.

Revision history for this message
Adam Blackburn (adamblackburn) wrote :

Looks like the above issues are fixed, approved.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'curses/wicd-curses.py'
2--- curses/wicd-curses.py 2009-06-05 02:19:33 +0000
3+++ curses/wicd-curses.py 2009-06-19 22:48:39 +0000
4@@ -38,7 +38,6 @@
5 import warnings
6 warnings.filterwarnings("ignore","The popen2 module is deprecated. Use the subprocess module.")
7 # UI stuff
8-# This library is the only reason why I wrote this program.
9 import urwid
10
11 # DBus communication stuff
12@@ -64,6 +63,7 @@
13 from netentry_curses import WirelessSettingsDialog, WiredSettingsDialog,AdvancedSettingsDialog
14
15 from optparse import OptionParser
16+from os import system
17
18 # Stuff about getting the script configurer running
19 #from grp import getgrgid
20@@ -72,7 +72,7 @@
21 #import logging
22 #import logging.handler
23
24-CURSES_REVNO=wpath.curses_revision
25+CURSES_REV=wpath.curses_revision
26
27 # Fix strings in wicd-curses
28 from wicd.translations import language
29@@ -1047,7 +1047,17 @@
30 ##### MAIN ENTRY POINT
31 ########################################
32 if __name__ == '__main__':
33- parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REVNO,daemon.Hello()))
34+ try:
35+ parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello()))
36+ except Exception as e:
37+ if "DBus.Error.AccessDenied" in e.get_dbus_name():
38+ print ""
39+ system("\
40+echo ERROR: wicd-curses was denied access to the wicd daemon, please check that \
41+your user is in the group \\'$(tput bold)$(tput setaf 4)"+ wpath.wicd_group+"$(tput sgr0)\\'.")
42+ sys.exit(1)
43+ else:
44+ raise
45 parser.set_defaults(screen='raw',debug=False)
46 parser.add_option("-r", "--raw-screen",action="store_const",const='raw'
47 ,dest='screen',help="use urwid's raw screen controller (default)")
48
49=== modified file 'wicd/wicd-client.py'
50--- wicd/wicd-client.py 2009-05-22 19:43:14 +0000
51+++ wicd/wicd-client.py 2009-06-19 22:59:30 +0000
52@@ -86,9 +86,10 @@
53 def wrapper(*args, **kwargs):
54 try:
55 return func(*args, **kwargs)
56- except DBusException, e:
57- if "DBus.Error.AccessDenied" in e:
58+ except DBusException as e:
59+ if e.get_dbus_name() != None and "DBus.Error.AccessDenied" in e.get_dbus_name():
60 error(None, language['access_denied'])
61+ #raise
62 raise DBusException(e)
63 else:
64 print "warning: ignoring exception %s" % e

Subscribers

People subscribed via source and target branches

to status/vote changes: