Skip to content

Commit b27a5b7

Browse files
committed
[req-changes] Improved BaseCounter.reply_names
1 parent 0e3277f commit b27a5b7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

openwisp_radius/counters/base.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ def reply_names(self):
2525
# BACKWARD COMPATIBILITY: In previous versions of openwisp-radius,
2626
# the Counter.reply_name was a string instead of a tuple. Thus,
2727
# we need to convert it to a tuple if it's a string.
28-
if not hasattr(self, "reply_name"):
28+
reply_name = getattr(self, "reply_name", None)
29+
if not reply_name:
2930
raise NotImplementedError(
3031
"Counter classes must define 'reply_names' property."
3132
)
32-
if isinstance(self.reply_name, str):
33-
return (self.reply_name,)
34-
return self.reply_name
33+
if isinstance(reply_name, str):
34+
return (reply_name,)
35+
return reply_name
3536

3637
@property
3738
@abstractmethod

0 commit comments

Comments
 (0)