Skip to content

Commit fd407ed

Browse files
authored
Merge pull request #247 from microsoft/users/tedchamb/dev5
Move back to beta, until I can look at the two open issues.
2 parents 64d677d + 05e7893 commit fd407ed

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

azure-devops/azure/devops/client.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,24 +124,23 @@ def _create_request_message(self, http_method, location_id, route_values=None,
124124
route_values = {}
125125
route_values['area'] = location.area
126126
route_values['resource'] = location.resource_name
127-
route_template = self._remove_optional_route_parameters(location.route_template,
128-
route_values)
127+
url = self._transform_route_template(location.route_template, route_values)
129128
logger.debug('Route template: %s', location.route_template)
130-
url = self._client.format_url(route_template, **route_values)
131129
request = ClientRequest(method=http_method, url=self._client.format_url(url))
132130
if query_parameters:
133131
request.format_parameters(query_parameters)
134132
return request
135133

136134
@staticmethod
137-
def _remove_optional_route_parameters(route_template, route_values):
135+
def _transform_route_template(route_template, route_values):
138136
new_template = ''
139137
route_template = route_template.replace('{*', '{')
140138
for path_segment in route_template.split('/'):
141139
if (len(path_segment) <= 2 or not path_segment[0] == '{'
142-
or not path_segment[len(path_segment) - 1] == '}'
143-
or path_segment[1:len(path_segment) - 1] in route_values):
140+
or not path_segment[len(path_segment) - 1] == '}'):
144141
new_template = new_template + '/' + path_segment
142+
elif path_segment[1:len(path_segment) - 1] in route_values:
143+
new_template = new_template + '/' + route_values[path_segment[1:len(path_segment) - 1]]
145144
return new_template
146145

147146
def _get_resource_location(self, location_id):
@@ -222,7 +221,7 @@ def _negotiate_request_version(location, version):
222221
else:
223222
# We can send at the requested api version. Make sure the resource version
224223
# is not bigger than what the server supports
225-
negotiated_version = str(requested_api_version)
224+
negotiated_version = match.group(1)
226225
is_preview = match.group(3) is not None
227226
if is_preview:
228227
negotiated_version += '-preview'
@@ -267,7 +266,7 @@ def _handle_error(self, request, response):
267266
raise AzureDevOpsAuthenticationError(full_message_format.format(error_message=error_message,
268267
url=request.url))
269268
else:
270-
full_message_format = '{error_message}Operation returned an invalid status code of {status_code}.'
269+
full_message_format = '{error_message}Operation returned a {status_code} status code.'
271270
raise AzureDevOpsClientRequestError(full_message_format.format(error_message=error_message,
272271
status_code=response.status_code))
273272

azure-devops/azure/devops/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
# --------------------------------------------------------------------------------------------
55

6-
VERSION = "5.1.0"
6+
VERSION = "5.1.0b1"

azure-devops/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from setuptools import setup, find_packages
77

88
NAME = "azure-devops"
9-
VERSION = "5.1.0"
9+
VERSION = "5.1.0b1"
1010

1111
# To install the library, run the following
1212
#

0 commit comments

Comments
 (0)