mirror of
https://github.com/Yubico/yubiadmin.git
synced 2025-02-20 14:54:30 +01:00
Use MutableMapping instead of DictMixin.
This commit is contained in:
parent
97de3abbdb
commit
6eefc09cae
@ -28,7 +28,7 @@
|
||||
import os
|
||||
import re
|
||||
import logging as log
|
||||
from UserDict import DictMixin
|
||||
from collections import MutableMapping
|
||||
|
||||
__all__ = [
|
||||
'RegexHandler',
|
||||
@ -112,7 +112,7 @@ class RegexHandler(object):
|
||||
return self.inserter(content, self.writer(value))
|
||||
|
||||
|
||||
class FileConfig(DictMixin, object):
|
||||
class FileConfig(MutableMapping):
|
||||
"""
|
||||
Maps key-value pairs to a backing config file.
|
||||
You can manually edit the file by modifying self.content.
|
||||
@ -139,6 +139,13 @@ class FileConfig(DictMixin, object):
|
||||
def add_param(self, key, handler):
|
||||
self.params[key] = handler
|
||||
|
||||
def __iter__(self):
|
||||
for x in self.mylist:
|
||||
yield x
|
||||
|
||||
def __len__(self):
|
||||
return len(self.mylist)
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.params[key].read(self.content)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user