From aaa354a9603233b42c8a7554d4f34a41cc8e9137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Volkan=20=C5=9Eahin?= Date: Wed, 13 Jul 2016 17:30:27 +0300 Subject: [PATCH] bug fix --- opt/ahenk/base/messaging/Messaging.py | 4 ++-- opt/ahenk/base/model/modes/init_mode.py | 12 ++++++++++ opt/ahenk/base/model/{ => modes}/safe_mode.py | 5 ++--- opt/ahenk/plugins/sample/safe.py | 22 ------------------- 4 files changed, 16 insertions(+), 27 deletions(-) create mode 100644 opt/ahenk/base/model/modes/init_mode.py rename opt/ahenk/base/model/{ => modes}/safe_mode.py (77%) delete mode 100644 opt/ahenk/plugins/sample/safe.py diff --git a/opt/ahenk/base/messaging/Messaging.py b/opt/ahenk/base/messaging/Messaging.py index 9fc57e1..16e9d7d 100644 --- a/opt/ahenk/base/messaging/Messaging.py +++ b/opt/ahenk/base/messaging/Messaging.py @@ -35,7 +35,7 @@ class Messaging(object): data['responseCode'] = response.get_code() data['responseMessage'] = response.get_message() response_data = None - if data['responseData'] is not None: + if response.get_data() is not None: response_data = json.loads(str(response.get_data())) data['responseData'] = response_data data['contentType'] = response.get_content_type() @@ -54,7 +54,7 @@ class Messaging(object): data['responseMessage'] = response.get_message() response_data = None - if data['responseData'] is not None: + if response.get_data() is not None: response_data = json.loads(str(response.get_data())) data['responseData'] = response_data diff --git a/opt/ahenk/base/model/modes/init_mode.py b/opt/ahenk/base/model/modes/init_mode.py new file mode 100644 index 0000000..4af94e6 --- /dev/null +++ b/opt/ahenk/base/model/modes/init_mode.py @@ -0,0 +1,12 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# Author: Volkan Şahin + + +class InitMode(object): + def __init__(self): + pass + + @property + def obj_name(self): + return "INIT_MODE" diff --git a/opt/ahenk/base/model/safe_mode.py b/opt/ahenk/base/model/modes/safe_mode.py similarity index 77% rename from opt/ahenk/base/model/safe_mode.py rename to opt/ahenk/base/model/modes/safe_mode.py index 2baa555..ac3e9d1 100644 --- a/opt/ahenk/base/model/safe_mode.py +++ b/opt/ahenk/base/model/modes/safe_mode.py @@ -4,10 +4,9 @@ class SafeMode(object): - - def __init__(self,username): + def __init__(self, username): self.username = username @property def obj_name(self): - return "SAFE_MODE" \ No newline at end of file + return "SAFE_MODE" diff --git a/opt/ahenk/plugins/sample/safe.py b/opt/ahenk/plugins/sample/safe.py deleted file mode 100644 index 2d4cad5..0000000 --- a/opt/ahenk/plugins/sample/safe.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: utf-8 -*- - -from base.plugin.abstract_plugin import AbstractPlugin - - -class Sample(AbstractPlugin): - def __init__(self, username, context): - super(Sample, self).__init__() - self.username = username - self.context = context - self.logger = self.get_logger() - - def handle_safe_mode(self): - # TODO Do what do you want to do! - pass - - -def handle_safe_mode(username, context): - print('Sample Plugin Safe') - sample = Sample(username, context) - sample.handle_safe_mode()