mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-22 21:22:21 +03:00
toString and toJson added to model classes
This commit is contained in:
parent
98c02648f8
commit
171b0320ee
3 changed files with 19 additions and 0 deletions
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue