Skip to content

Commit ec6625f

Browse files
[bugfix] in introspect_constants
1 parent 63069a0 commit ec6625f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

swig/openscap_api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,15 @@ def introspect(self):
220220
funcs[k]=v
221221
return funcs
222222

223-
def introspect_constants(value=None, prefix=None):
223+
def introspect_constants(self, value=None, prefix=None):
224224
'''
225225
Returns constants names / values, given a value and/or a name filter (regex)
226226
Example, introspect_constants(1, "XCCDF_RESULT") returns {XCCDF_RESULT_PASS: 1}
227+
228+
!!! constants are here designated by C enums (=> numeric value)
227229
'''
228-
return {k: v for k, v in points.items() if (value is None or v == value) and
229-
(prefix is None or k.startswith(prefix))}
230+
return {k: v for k, v in OSCAP.__dict__.items() if (value is None or v == value) and
231+
(isinstance(v, int)) and (prefix is None or k.startswith(prefix))}
230232

231233
def __getattr__(self, name):
232234
""" Called when an attribute lookup has not found the attribute in the usual places (i.e.

0 commit comments

Comments
 (0)