From 171b0320eec2c960805d5683dbff31bd4ce556d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volkan=20=C5=9Eahin?= Date: Mon, 21 Mar 2016 12:00:45 +0200 Subject: [PATCH] toString and toJson added to model classes --- opt/ahenk/base/model/Plugin.py | 6 ++++++ opt/ahenk/base/model/Policy.py | 6 ++++++ opt/ahenk/base/model/Profile.py | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/opt/ahenk/base/model/Plugin.py b/opt/ahenk/base/model/Plugin.py index 1350205..eaba0b5 100644 --- a/opt/ahenk/base/model/Plugin.py +++ b/opt/ahenk/base/model/Plugin.py @@ -23,3 +23,9 @@ class Plugin(object): @property def description(self): return self.plugin['description'] + + def to_string(self): + return str(self.plugin) + + def to_json(self): + return json.load(self.plugin) diff --git a/opt/ahenk/base/model/Policy.py b/opt/ahenk/base/model/Policy.py index 5f47e31..07ba396 100644 --- a/opt/ahenk/base/model/Policy.py +++ b/opt/ahenk/base/model/Policy.py @@ -35,3 +35,9 @@ class Policy(object): for p in self.policy['userprofiles']: profiles.append(Profile(p)) return profiles + + def to_string(self): + return str(self.policy) + + def to_json(self): + return json.load(self.policy) diff --git a/opt/ahenk/base/model/Profile.py b/opt/ahenk/base/model/Profile.py index 4c4014c..c0f9d3d 100644 --- a/opt/ahenk/base/model/Profile.py +++ b/opt/ahenk/base/model/Profile.py @@ -48,3 +48,10 @@ class Profile(object): @property def plugin(self): return Plugin(self.profile['plugin']) + + def to_string(self): + return str(self.profile) + + def to_json(self): + return json.load(self.profile) +