Remove page_size_maximum
This patch removes maximum page size from all API calls. I've realized that it is not for the API to force the clients to implement paging. Some clients may find it easier to grab single, large requests, while others want to filter and page their requests. There are cases in which result limits are beneficial, and some in which they are not - it is up to the client to decide which use case is best for them. Furthermore, this patch sets the minimum size of a page to 0. This is to support queries for information only (how much do I have). Change-Id: Ie6c45fad43756dae762b8f973b30439c3340f558
This commit is contained in:
parent
77e93d15a5
commit
1820d78603
|
@ -38,7 +38,6 @@ lock_path = $state_path/lock
|
|||
# bind_port = 8080
|
||||
|
||||
# List paging configuration options.
|
||||
# page_size_maximum = 500
|
||||
# page_size_default = 20
|
||||
|
||||
# Enable notifications. This feature drives deferred processing, reporting,
|
||||
|
|
|
@ -22,10 +22,6 @@ app = {
|
|||
}
|
||||
|
||||
cfg.CONF.register_opts([
|
||||
cfg.IntOpt('page_size_maximum',
|
||||
default=500,
|
||||
help='The maximum number of results to allow a user to request '
|
||||
'from the API'),
|
||||
cfg.IntOpt('page_size_default',
|
||||
default=20,
|
||||
help='The maximum number of results to allow a user to request '
|
||||
|
|
|
@ -81,7 +81,7 @@ class BranchesController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_branch = branches_api.branch_get(marker)
|
||||
|
|
|
@ -81,7 +81,7 @@ class MilestonesController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_milestone = milestones_api.milestone_get(marker)
|
||||
|
|
|
@ -131,7 +131,7 @@ class ProjectGroupsController(rest.RestController):
|
|||
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_group = project_groups.project_group_get(marker)
|
||||
|
|
|
@ -100,7 +100,7 @@ class ProjectsController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_project = projects_api.project_get(marker)
|
||||
|
|
|
@ -94,7 +94,7 @@ class StoriesController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_story = stories_api.story_get(marker)
|
||||
|
|
|
@ -108,7 +108,7 @@ class SubscriptionEventsController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_sub = subscription_events_api.subscription_events_get(marker)
|
||||
|
|
|
@ -101,7 +101,7 @@ class SubscriptionsController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Sanity check on user_id
|
||||
current_user = user_api.user_get(request.current_user_id)
|
||||
|
|
|
@ -39,7 +39,7 @@ class TaskStatusesController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
statuses = tasks_api.task_get_statuses()
|
||||
task_statuses = []
|
||||
|
|
|
@ -146,7 +146,7 @@ class TasksPrimaryController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_task = tasks_api.task_get(marker)
|
||||
|
@ -346,7 +346,7 @@ class TasksNestedController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_task = tasks_api.task_get(marker)
|
||||
|
|
|
@ -136,7 +136,7 @@ class TeamsController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_team = teams_api.team_get(marker)
|
||||
|
|
|
@ -81,7 +81,7 @@ class TimeLineEventsController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Sanity check on event types.
|
||||
if event_type:
|
||||
|
@ -155,7 +155,7 @@ class CommentsController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_event = None
|
||||
|
|
|
@ -72,7 +72,7 @@ class UserTokensController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_token = token_api.user_token_get(marker)
|
||||
|
|
|
@ -74,7 +74,7 @@ class UsersController(rest.RestController):
|
|||
# Boundary check on limit.
|
||||
if limit is None:
|
||||
limit = CONF.page_size_default
|
||||
limit = min(CONF.page_size_maximum, max(1, limit))
|
||||
limit = max(0, limit)
|
||||
|
||||
# Resolve the marker record.
|
||||
marker_user = users_api.user_get(marker)
|
||||
|
|
Loading…
Reference in New Issue