diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-01-12 14:51:05 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-01-12 14:51:31 -0500 |
commit | 7f9e958f70d4d82bf2a683ffb93a6da2b8fe2b82 (patch) | |
tree | 5794fd8a2656864b62a479fc5e08df5162f31cbf /src/lib/Server/Plugin.py | |
parent | 39f6fc4893bb838bdf3ae80b8474f75215a90669 (diff) | |
download | bcfg2-7f9e958f70d4d82bf2a683ffb93a6da2b8fe2b82.tar.gz bcfg2-7f9e958f70d4d82bf2a683ffb93a6da2b8fe2b82.tar.bz2 bcfg2-7f9e958f70d4d82bf2a683ffb93a6da2b8fe2b82.zip |
added __str__ and __repr__ to FileBacked plugins to make bcfg2-info showclient Properties output prettier
Diffstat (limited to 'src/lib/Server/Plugin.py')
-rw-r--r-- | src/lib/Server/Plugin.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 61e6d273d..d491d1609 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -372,6 +372,12 @@ class FileBacked(object): """Update local data structures based on current file state""" pass + def __repr__(self): + return "%s: %s" % (self.__class__.__name__, str(self)) + + def __str__(self): + return "%s: %s" % (self.name, self.data) + class DirectoryBacked(object): """This object is a coherent cache for a filesystem hierarchy of files.""" @@ -567,6 +573,9 @@ class XMLFileBacked(FileBacked): def __iter__(self): return iter(self.entries) + def __str__(self): + return "%s: %s" % (self.name, lxml.etree.tostring(self.xdata)) + class SingleXMLFileBacked(XMLFileBacked): """This object is a coherent cache for an independent XML file.""" |