Skip to content

Commit 9b90a6e

Browse files
committed
Use init in super class
1 parent 4d5a414 commit 9b90a6e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

blazar/enforcement/filters/base_filter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
@six.add_metaclass(abc.ABCMeta)
2121
class BaseFilter:
2222

23+
enforcement_opts = []
24+
25+
def __init__(self, conf=None):
26+
self.conf = conf
27+
28+
for opt in self.enforcement_opts:
29+
self.conf.register_opt(opt, 'enforcement')
30+
2331
@abc.abstractmethod
2432
def check_create(self, context, lease_values):
2533
pass

blazar/enforcement/filters/max_reservation_length_filter.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,7 @@ class MaxReservationLengthFilter(base_filter.BaseFilter):
6161
]
6262

6363
def __init__(self, conf=None):
64-
65-
self.conf = conf
66-
67-
for opt in self.enforcement_opts:
68-
self.conf.enforcement.register_opt(opt, 'enforcement')
69-
64+
super(MaxReservationLengthFilter, self).__init__(conf=conf)
7065

7166
def check_for_length_violation(self, start_date, end_date):
7267
lease_length = (end_date - start_date).total_seconds()

0 commit comments

Comments
 (0)