def table_list_cache(self):
		if self._table_list_cache is None:
			url = self.oauth['instance_url'] + query.API_STUB + '/sobjects/'
			
			log.debug('Request API URL: %s' % url)
			response = query.handle_api_exceptions(url, self.connection.sf_session.get)
			# charset is detected from headers by requests package
			self._table_list_cache = response.json(object_pairs_hook=OrderedDict)
		return self._table_list_cache
    def table_list_cache(self):
        if self._table_list_cache is None:
            url = self.oauth["instance_url"] + query.API_STUB + "/sobjects/"

            log.debug("Request API URL: %s" % url)
            response = query.handle_api_exceptions(url, self.connection.sf_session.get)
            # charset is detected from headers by requests package
            self._table_list_cache = response.json()
        return self._table_list_cache
	def table_list_cache(self):
		if(self._table_list_cache is None):
			url = self.oauth['instance_url'] + query.API_STUB + '/sobjects/'
			
			log.debug('Request API URL: %s' % url)
			response = query.handle_api_exceptions(url, self.connection.sf_session.get)
			# charset is detected from headers by requests package
			self._table_list_cache = response.json(object_pairs_hook=OrderedDict)
		return self._table_list_cache
	def table_description_cache(self, table):
		if table not in self._table_description_cache:
			url = self.oauth['instance_url'] + query.API_STUB + ('/sobjects/%s/describe/' % table)
		
			log.debug('Request API URL: %s' % url)
			response = query.handle_api_exceptions(url, self.connection.sf_session.get)
			self._table_description_cache[table] = response.json(object_pairs_hook=OrderedDict)
			assert self._table_description_cache[table]['fields'][0]['type'] == 'id'
			assert self._table_description_cache[table]['fields'][0]['name'] == 'Id'
			del self._table_description_cache[table]['fields'][0]
		return self._table_description_cache[table]
	def table_description_cache(self, table):
		if(table not in self._table_description_cache):
			url = self.oauth['instance_url'] + query.API_STUB + ('/sobjects/%s/describe/' % table)
		
			log.debug('Request API URL: %s' % url)
			response = query.handle_api_exceptions(url, self.connection.sf_session.get)
			self._table_description_cache[table] = response.json(object_pairs_hook=OrderedDict)
			assert self._table_description_cache[table]['fields'][0]['type'] == 'id'
			assert self._table_description_cache[table]['fields'][0]['name'] == 'Id'
			del self._table_description_cache[table]['fields'][0]
		return self._table_description_cache[table]
    def table_description_cache(self, table):
        if table not in self._table_description_cache:
            url = self.oauth["instance_url"] + query.API_STUB + ("/sobjects/%s/describe/" % table)

            log.debug("Request API URL: %s" % url)
            response = query.handle_api_exceptions(url, self.connection.sf_session.get)
            self._table_description_cache[table] = response.json()
            assert self._table_description_cache[table]["fields"][0]["type"] == "id"
            assert self._table_description_cache[table]["fields"][0]["name"] == "Id"
            del self._table_description_cache[table]["fields"][0]
        return self._table_description_cache[table]
	def table_description_cache(self, table):
		if(table not in self._table_description_cache):
			url = self.oauth['instance_url'] + query.API_STUB + ('/sobjects/%s/describe/' % table)
		
			headers = dict()
			headers['Authorization'] = 'OAuth %s' % self.oauth['access_token']
			headers['Content-Type'] = 'application/json'
		
			salesforce_timeout = getattr(settings, 'SALESFORCE_QUERY_TIMEOUT', 3)
			resource = restkit.Resource(url, timeout=salesforce_timeout)
			log.debug('Request API URL: %s' % url)
			response = query.handle_api_exceptions(url, resource.get, headers=headers)
			body = response.body_string()
			jsrc = force_unicode(body).encode(settings.DEFAULT_CHARSET)
			self._table_description_cache[table] = json.loads(jsrc)
		return self._table_description_cache[table]
    def table_list_cache(self):
        if self._table_list_cache is None:
            url = self.oauth["instance_url"] + query.API_STUB + "/sobjects/"

            headers = dict()
            headers["Authorization"] = "OAuth %s" % self.oauth["access_token"]
            headers["Content-Type"] = "application/json"

            salesforce_timeout = getattr(settings, "SALESFORCE_QUERY_TIMEOUT", 3)
            resource = restkit.Resource(url, timeout=salesforce_timeout)
            log.debug("Request API URL: %s" % url)
            response = query.handle_api_exceptions(url, resource.get, headers=headers)
            body = response.body_string()
            jsrc = force_unicode(body).encode(settings.DEFAULT_CHARSET)
            self._table_list_cache = json.loads(jsrc)
        return self._table_list_cache
Exemple #9
0
	def table_list_cache(self):
		if(self._table_list_cache is None):
			url = self.oauth['instance_url'] + query.API_STUB + '/sobjects/'
			
			headers = dict()
			headers['Authorization'] = 'OAuth %s' % self.oauth['access_token']
			headers['Content-Type'] = 'application/json'
			
			salesforce_timeout = getattr(settings, 'SALESFORCE_QUERY_TIMEOUT', 3)
			resource = restkit.Resource(url, timeout=salesforce_timeout)
			log.debug('Request API URL: %s' % url)
			response = query.handle_api_exceptions(url, resource.get, headers=headers)
			body = response.body_string()
			jsrc = force_unicode(body).encode(settings.DEFAULT_CHARSET)
			self._table_list_cache = json.loads(jsrc)
		return self._table_list_cache
    def table_description_cache(self, table):
        if table not in self._table_description_cache:
            url = self.oauth["instance_url"] + query.API_STUB + ("/sobjects/%s/describe/" % table)

            headers = dict()
            headers["Authorization"] = "OAuth %s" % self.oauth["access_token"]
            headers["Content-Type"] = "application/json"

            salesforce_timeout = getattr(settings, "SALESFORCE_QUERY_TIMEOUT", 3)
            resource = restkit.Resource(url, timeout=salesforce_timeout)
            log.debug("Request API URL: %s" % url)
            response = query.handle_api_exceptions(url, resource.get, headers=headers)
            body = response.body_string()
            jsrc = force_unicode(body).encode(settings.DEFAULT_CHARSET)
            self._table_description_cache[table] = json.loads(jsrc)
            assert self._table_description_cache[table]["fields"][0]["type"] == "id"
            assert self._table_description_cache[table]["fields"][0]["name"] == "Id"
            del self._table_description_cache[table]["fields"][0]
        return self._table_description_cache[table]
Exemple #11
0
	def table_description_cache(self, table):
		if(table not in self._table_description_cache):
			url = self.oauth['instance_url'] + query.API_STUB + ('/sobjects/%s/describe/' % table)
		
			headers = dict()
			headers['Authorization'] = 'OAuth %s' % self.oauth['access_token']
			headers['Content-Type'] = 'application/json'
		
			salesforce_timeout = getattr(settings, 'SALESFORCE_QUERY_TIMEOUT', 3)
			resource = restkit.Resource(url, timeout=salesforce_timeout)
			log.debug('Request API URL: %s' % url)
			response = query.handle_api_exceptions(url, resource.get, headers=headers)
			body = response.body_string()
			jsrc = force_unicode(body).encode(settings.DEFAULT_CHARSET)
			self._table_description_cache[table] = json.loads(jsrc)
			assert self._table_description_cache[table]['fields'][0]['type'] == 'id'
			assert self._table_description_cache[table]['fields'][0]['name'] == 'Id'
			del self._table_description_cache[table]['fields'][0]
		return self._table_description_cache[table]