Example #1
0
    def delete(self, conn=None, type=None):
        if conn is None:
            conn = self.__conn__

        # the record may be in any one of the read types, so we need to check them all
        types = self.get_read_types(type)

        # in the simple case of one type, just get on and issue the delete
        if len(types) == 1:
            raw.delete(conn, types[0], self.id)

        # otherwise, check all the types until we find the object, then issue the delete there
        for t in types:
            o = raw.get(conn, t, self.id)
            if o is not None:
                raw.delete(conn, t, self.id)
Example #2
0
    def delete(self, conn=None, type=None):
        if conn is None:
            conn = self.__conn__

        # the record may be in any one of the read types, so we need to check them all
        types = self.get_read_types(type)

        # in the simple case of one type, just get on and issue the delete
        if len(types) == 1:
            raw.delete(conn, types[0], self.id)

        # otherwise, check all the types until we find the object, then issue the delete there
        for t in types:
            o = raw.get(conn, t, self.id)
            if o is not None:
                raw.delete(conn, t, self.id)
Example #3
0
    def delete(self, conn=None, type=None):
        if conn is None:
            conn = self._get_connection()

        # the record may be in any one of the read types, so we need to check them all
        if type is not None:
            if isinstance(type, list):
                types = type
            else:
                types = [type]
        else:
            types = self._get_read_types()

        # in the simple case of one type, just get on and issue the delete
        if len(types) == 1:
            raw.delete(conn, types[0], self.id)

        # otherwise, check all the types until we find the object, then issue the delete there
        for t in types:
            o = raw.get(conn, t, self.id)
            if o is not None:
                raw.delete(conn, t, self.id)
Example #4
0
    def delete(self, conn=None, type=None):
        if conn is None:
            conn = self._get_connection()

        # the record may be in any one of the read types, so we need to check them all
        if type is not None:
            if isinstance(type, list):
                types = type
            else:
                types = [type]
        else:
            types = self._get_read_types()

        # in the simple case of one type, just get on and issue the delete
        if len(types) == 1:
            raw.delete(conn, types[0], self.id)

        # otherwise, check all the types until we find the object, then issue the delete there
        for t in types:
            o = raw.get(conn, t, self.id)
            if o is not None:
                raw.delete(conn, t, self.id)
Example #5
0
    def pull(cls, id_, conn=None, wrap=True, types=None):
        '''Retrieve object by id.'''
        if conn is None:
            conn = cls.__conn__

        types = cls.get_read_types(types)

        if id_ is None:
            return None
        try:
            for t in types:
                resp = raw.get(conn, t, id_)
                if resp.status_code == 404:
                    continue
                else:
                    j = raw.unpack_get(resp)
                    if wrap:
                        return cls(j)
                    else:
                        return j
            return None
        except Exception as e:
            print e.message
            return None
Example #6
0
    def pull(cls, id_, conn=None, wrap=True, types=None):
        """Retrieve object by id."""
        if conn is None:
            conn = cls.__conn__

        types = cls.get_read_types(types)

        if id_ is None:
            return None
        try:
            for t in types:
                resp = raw.get(conn, t, id_)
                if resp.status_code == 404:
                    continue
                else:
                    j = raw.unpack_get(resp)
                    if wrap:
                        return cls(j)
                    else:
                        return j
            return None
        except Exception as e:
            print e.message
            return None