Ejemplo n.º 1
0
 def get_calendar_id_by_name(self, **kargs):
     res = self.list_calendar()
     result_id = utils.getIdListByName(name=kargs['name'], res=str(res))
     if kargs.has_key('one_string'):
         return result_id[0]
     if kargs.has_key('index'):
         index = int(kargs['index'])
         return result_id[index]
     return result_id
	def get_calendar_id_by_name(self, **kargs):
		res = self.list_calendar()
		result_id = utils.getIdListByName(name=kargs['name'], res=str(res))
		if kargs.has_key('one_string'):
			return result_id[0]
		if kargs.has_key('index'):
			index = int(kargs['index'])
			return result_id[index]
		return result_id
	def get_id_list_by_name(self, **kargs):
		'''
		input: name - get by "name" : "Default", ..
			   expectCnt - expect number of addressbook
			   res - list addressbook response string
		output: exception or matched addressbook ids list(all=True, or if has kargs['index'], return matched id)
		'''
		all = False
		name = ''
		if kargs.has_key('all'): all = True
		if kargs.has_key('name'): name = kargs['name']
		result_list = utils.getIdListByName(name, kargs['res'], all=all)
		if kargs.has_key('expectCnt'):
			expectCnt = int(kargs['expectCnt'])
			if len(result_list) != expectCnt:
				raise Exception('Expect count is %s, but actually got %s'%(expectCnt, len(result_list)))
			print 'Count checked!'
		if kargs.has_key('index'):
			index = int(kargs['index'])
			return result_list[index]
		return result_list
    def get_id_list_by_name(self, **kargs):
        '''
		input: name - get by "name" : "Default", ..
			   expectCnt - expect number of addressbook
			   res - list addressbook response string
		output: exception or matched addressbook ids list(all=True, or if has kargs['index'], return matched id)
		'''
        all = False
        name = ''
        if kargs.has_key('all'): all = True
        if kargs.has_key('name'): name = kargs['name']
        result_list = utils.getIdListByName(name, kargs['res'], all=all)
        if kargs.has_key('expectCnt'):
            expectCnt = int(kargs['expectCnt'])
            if len(result_list) != expectCnt:
                raise Exception('Expect count is %s, but actually got %s' %
                                (expectCnt, len(result_list)))
            print 'Count checked!'
        if kargs.has_key('index'):
            index = int(kargs['index'])
            return result_list[index]
        return result_list