Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for p in project_ids.split(','):
ids.append(self.project(p).id)
project_ids = ','.join(ids)
payload['name'] = name
if isinstance(project_ids, string_types):
project_ids = project_ids.split(',')
payload['projectIds'] = project_ids
payload['preset'] = preset
url = self._get_url(
'rapidview/create/presets', base=self.AGILE_BASE_URL)
r = self._session.post(
url, data=json.dumps(payload))
raw_issue_json = json_loads(r)
return Board(self._options, self._session, raw=raw_issue_json)
When old GreenHopper private API is used, paging is not enabled and all parameters are ignored.
"""
params = {}
if type:
params['type'] = type
if name:
params['name'] = name
if self._options['agile_rest_path'] == GreenHopperResource.GREENHOPPER_REST_PATH:
# Old, private API did not support pagination, all records were present in response,
# and no parameters were supported.
if startAt or maxResults or params:
warnings.warn('Old private GreenHopper API is used, all parameters will be ignored.', Warning)
r_json = self._get_json('rapidviews/list', base=self.AGILE_BASE_URL)
boards = [Board(self._options, self._session, raw_boards_json) for raw_boards_json in r_json['views']]
return ResultList(boards, 0, len(boards), len(boards), True)
else:
return self._fetch_pages(Board, 'values', 'board', startAt, maxResults, params, base=self.AGILE_BASE_URL)
r"issueLink/[^/]+$": IssueLink,
r"issueLinkType/[^/]+$": IssueLinkType,
r"issuetype/[^/]+$": IssueType,
r"priority/[^/]+$": Priority,
r"project/[^/]+$": Project,
r"project/[^/]+/role/[^/]+$": Role,
r"resolution/[^/]+$": Resolution,
r"securitylevel/[^/]+$": SecurityLevel,
r"status/[^/]+$": Status,
r"statuscategory/[^/]+$": StatusCategory,
r"user\?(username|accountId).+$": User,
r"group\?groupname.+$": Group,
r"version/[^/]+$": Version,
# GreenHopper specific resources
r"sprints/[^/]+$": Sprint,
r"views/[^/]+$": Board,
}
class UnknownResource(Resource):
"""A Resource from JIRA that is not (yet) supported."""
def __init__(self, options, session, raw=None):
Resource.__init__(self, "unknown{0}", options, session)
if raw:
self._parse_raw(raw)
def cls_for_resource(resource_literal):
for resource in resource_class_map:
if re.search(resource, resource_literal):
return resource_class_map[resource]
def delete_board(self, id):
"""Delete an agile board."""
board = Board(self._options, self._session, raw={'id': id})
board.delete()
if type:
params['type'] = type
if name:
params['name'] = name
if self._options['agile_rest_path'] == GreenHopperResource.GREENHOPPER_REST_PATH:
# Old, private API did not support pagination, all records were present in response,
# and no parameters were supported.
if startAt or maxResults or params:
warnings.warn('Old private GreenHopper API is used, all parameters will be ignored.', Warning)
r_json = self._get_json('rapidviews/list', base=self.AGILE_BASE_URL)
boards = [Board(self._options, self._session, raw_boards_json) for raw_boards_json in r_json['views']]
return ResultList(boards, 0, len(boards), len(boards), True)
else:
return self._fetch_pages(Board, 'values', 'board', startAt, maxResults, params, base=self.AGILE_BASE_URL)