toString and toJson added to model classes

This commit is contained in:
Volkan Şahin 2016-03-21 12:00:45 +02:00
parent 98c02648f8
commit 171b0320ee
3 changed files with 19 additions and 0 deletions

View file

@ -23,3 +23,9 @@ class Plugin(object):
@property @property
def description(self): def description(self):
return self.plugin['description'] return self.plugin['description']
def to_string(self):
return str(self.plugin)
def to_json(self):
return json.load(self.plugin)

View file

@ -35,3 +35,9 @@ class Policy(object):
for p in self.policy['userprofiles']: for p in self.policy['userprofiles']:
profiles.append(Profile(p)) profiles.append(Profile(p))
return profiles return profiles
def to_string(self):
return str(self.policy)
def to_json(self):
return json.load(self.policy)

View file

@ -48,3 +48,10 @@ class Profile(object):
@property @property
def plugin(self): def plugin(self):
return Plugin(self.profile['plugin']) return Plugin(self.profile['plugin'])
def to_string(self):
return str(self.profile)
def to_json(self):
return json.load(self.profile)