Skip to content
jdang edited this page Apr 19, 2011 · 2 revisions

SugarError class - send back any error problem and invalid connection.

class GeneralException(Exception): pass
class InvalidConnection(Exception): pass
class InvalidLogin(Exception): pass

class sugarerror:
    def __init__(self, data = {}):
        self.name = ""
        self.msg = ""

        if is_sugar_error(data):
            self.name = data["name"]
            self.msg = data["description"]
        else:
            raise GeneralException


    def __str__(self):
        return self.name+" : "+self.msg


def is_sugar_error(data):
    try:
        return data["name"] != None and data["description"] != None
    except KeyError:
        return False

  1. SugarBean class - takes the sugarcrm API sugarbean object and converts it into a python format.
  2. SugarModule class - this class communicates with the sugarcrm server to access and modify all the entries as needed.
  3. SugarEntrylist class - A class the takes information from the sugarcrm server and converts it into a nice python format.

Clone this wiki locally