Skip to content

Commit

Permalink
Handle case where self.domain isn't defined and we have to default to…
Browse files Browse the repository at this point in the history
… some API version number. Use new 2013-01-01 in this case.
  • Loading branch information
Aron Rosenberg committed Apr 14, 2014
1 parent 5260282 commit 5ec8c7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion boto/cloudsearch2/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ def commit(self):
index = sdf.index(': null')
boto.log.error(sdf[index - 100:index + 100])

url = "http://%s/%s/documents/batch" % (self.endpoint, self.domain.layer1.APIVersion)
api_version = '2013-01-01'
if self.domain:
api_version = self.domain.layer1.APIVersion
url = "http://%s/%s/documents/batch" % (self.endpoint, api_version)

# Keep-alive is automatic in a post-1.0 requests world.
session = requests.Session()
Expand Down
5 changes: 4 additions & 1 deletion boto/cloudsearch2/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ def __call__(self, query):
:rtype: :class:`boto.cloudsearch2.search.SearchResults`
:return: search results
"""
url = "http://%s/%s/search" % (self.endpoint, self.domain.layer1.APIVersion)
api_version = '2013-01-01'
if self.domain:
api_version = self.domain.layer1.APIVersion
url = "http://%s/%s/search" % (self.endpoint, api_version)
params = query.to_params()

r = requests.get(url, params=params)
Expand Down

0 comments on commit 5ec8c7c

Please sign in to comment.