Skip to content

Commit 5d7b625

Browse files
committed
Fix _can_read_filename
Contained `self`, from old OO version of this library.
1 parent 3b2748b commit 5d7b625

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

atd/atd.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,20 @@ def clear(queue = False):
125125
if not atjobs: return True # No jobs, queue already clear.
126126
return atrm(*atjobs)
127127

128-
def _can_read_file(self, filename):
128+
def _can_read_file(filename):
129129
""" On many installations, at.allow and at.deny are not readable by non-root
130130
users. Assure that they are. """
131131
if not os.access(filename, os.F_OK): # No file there
132-
return False
132+
raise OSError("No file {0}. Make sure path is right.".format(filename))
133133

134134
if not os.access(filename, os.R_OK): # Can't read file
135-
raise OSError('No permission to use {0}. Try the ' +
136-
'command `chown 644 {0}` as root.').format(filename)
135+
raise OSError("No permission to use {0}. Try the " +
136+
"command `chmod 644 {0}` as root.".format(filename))
137137

138138
def _enumerate_users(filename):
139139
""" Enumerate users in a at.allow or at.deny file, and return them as a
140140
list() for the user. """
141-
if not _can_read_file(filename): # No file there
142-
return []
141+
_can_read_file(filename)
143142

144143
fd = open(filename, 'r')
145144
users = fd.readlines()

0 commit comments

Comments
 (0)