From efe5b04374a60840ef8e2acd0bfcc05c1078f51a Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Sun, 27 May 2018 21:59:42 -0700 Subject: [PATCH] salesforce: Minor improvements; imports & types. --- zulip_bots/zulip_bots/bots/salesforce/salesforce.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/salesforce/salesforce.py b/zulip_bots/zulip_bots/bots/salesforce/salesforce.py index 2024a02..071f0e3 100644 --- a/zulip_bots/zulip_bots/bots/salesforce/salesforce.py +++ b/zulip_bots/zulip_bots/bots/salesforce/salesforce.py @@ -6,7 +6,7 @@ import getpass import re import logging import json -from zulip_bots.bots.salesforce.utils import * +from zulip_bots.bots.salesforce.utils import commands, object_types, link_query, default_query base_help_text = '''Salesforce bot This bot can do simple salesforce query requests @@ -73,7 +73,7 @@ def format_result( return output -def query_salesforce(arg: str, sf: Any, command: Dict[str, Any]) -> str: +def query_salesforce(arg: str, salesforce: simple_salesforce.Salesforce, command: Dict[str, Any]) -> str: arg = arg.strip() qarg = arg.split(' -', 1)[0] split_args = [] # type: List[str] @@ -91,7 +91,7 @@ def query_salesforce(arg: str, sf: Any, command: Dict[str, Any]) -> str: if 'query' in command.keys(): query = command['query'] object_type = object_types[command['object']] - res = sf.query(query.format( + res = salesforce.query(query.format( object_type['fields'], object_type['table'], qarg, limit_num)) exclude_keys = [] # type: List[str] if 'exclude_keys' in command.keys(): @@ -136,7 +136,7 @@ class SalesforceHandler(object): def get_salesforce_response(self, content: str) -> str: content = content.strip() - if content is None or content == 'help': + if content is '' or content == 'help': return get_help_text() if content.startswith('http') and 'force' in content: return get_salesforce_link_details(content, self.sf)