aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikraman Choudhury <vikraman.choudhury@gmail.com>2011-08-21 19:35:17 +0530
committerVikraman Choudhury <vikraman.choudhury@gmail.com>2011-08-21 19:35:17 +0530
commit947a32fd61b09af5fb214ed1170823326138a457 (patch)
tree536aaa0fc0e7dee76eaaac0adaab997fa62a0a8c /client/gentoostats/payload.py
parentadd license (diff)
downloadgentoostats-947a32fd61b09af5fb214ed1170823326138a457.tar.gz
gentoostats-947a32fd61b09af5fb214ed1170823326138a457.tar.bz2
gentoostats-947a32fd61b09af5fb214ed1170823326138a457.zip
commented client code
Diffstat (limited to 'client/gentoostats/payload.py')
-rw-r--r--client/gentoostats/payload.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/client/gentoostats/payload.py b/client/gentoostats/payload.py
index 1e98b75..b2c459f 100644
--- a/client/gentoostats/payload.py
+++ b/client/gentoostats/payload.py
@@ -7,8 +7,14 @@ from gentoostats.packages import Packages
from gentoostats.metadata import Metadata
class Payload(object):
+ """
+ A class that encapsulates payload operations
+ """
def __init__(self, configfile):
+ """
+ Initialize the payload using the config file
+ """
self.config = ConfigParser.ConfigParser()
if len(self.config.read(configfile)) == 0:
sys.stderr.write('Cannot read ' + configfile)
@@ -19,6 +25,9 @@ class Payload(object):
self.update()
def __masked(self, section, item):
+ """
+ Check the mask status of payload
+ """
try:
return not self.config.getboolean(section, item)
except ConfigParser.NoOptionError:
@@ -28,6 +37,9 @@ class Payload(object):
sys.exit(1)
def update(self):
+ """
+ Read and update the payload
+ """
env = Environment()
self.payload['PLATFORM'] = 'Unknown' if self.__masked('ENV', 'PLATFORM') else env.getPlatform()
self.payload['LASTSYNC'] = 'Unknown' if self.__masked('ENV', 'LASTSYNC') else env.getLastSync()
@@ -55,9 +67,15 @@ class Payload(object):
self.payload['PACKAGES'][cpv] = p
def get(self):
+ """
+ Return currently read payload
+ """
return self.payload
def dump(self, human=False):
+ """
+ Dump payload
+ """
if human:
pprint.pprint(self.payload)
else: