diff --git a/etc/storyboard.conf.sample b/etc/storyboard.conf.sample index 4f37fd7b..427037df 100644 --- a/etc/storyboard.conf.sample +++ b/etc/storyboard.conf.sample @@ -37,9 +37,6 @@ lock_path = $state_path/lock # Port the bind the API server to # bind_port = 8080 -# List paging configuration options. -# page_size_default = 20 - # Enable notifications. This feature drives deferred processing, reporting, # and subscriptions. # enable_notifications = True diff --git a/storyboard/api/config.py b/storyboard/api/config.py index b4b3c3d1..039ec7a1 100644 --- a/storyboard/api/config.py +++ b/storyboard/api/config.py @@ -22,8 +22,4 @@ app = { } cfg.CONF.register_opts([ - cfg.IntOpt('page_size_default', - default=20, - help='The maximum number of results to allow a user to request ' - 'from the API') ]) diff --git a/storyboard/api/v1/branches.py b/storyboard/api/v1/branches.py index 23e82390..0184ca15 100644 --- a/storyboard/api/v1/branches.py +++ b/storyboard/api/v1/branches.py @@ -80,9 +80,8 @@ class BranchesController(rest.RestController): :param sort_dir: Sort direction for results (asc, desc). """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_branch = branches_api.branch_get(marker) @@ -101,7 +100,8 @@ class BranchesController(rest.RestController): project_group_id=project_group_id) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(branches_count) if marker_branch: response.headers['X-Marker'] = str(marker_branch.id) diff --git a/storyboard/api/v1/milestones.py b/storyboard/api/v1/milestones.py index d2e381ea..dfc5e3a3 100644 --- a/storyboard/api/v1/milestones.py +++ b/storyboard/api/v1/milestones.py @@ -79,9 +79,8 @@ class MilestonesController(rest.RestController): :param sort_dir: Sort direction for results (asc, desc). """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_milestone = milestones_api.milestone_get(marker) @@ -99,7 +98,8 @@ class MilestonesController(rest.RestController): branch_id=branch_id) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(milestones_count) if marker_milestone: response.headers['X-Marker'] = str(marker_milestone.id) diff --git a/storyboard/api/v1/project_groups.py b/storyboard/api/v1/project_groups.py index e328db95..4939a95f 100644 --- a/storyboard/api/v1/project_groups.py +++ b/storyboard/api/v1/project_groups.py @@ -129,9 +129,8 @@ class ProjectGroupsController(rest.RestController): :param sort_dir: Sort direction for results (asc, desc). """ - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_group = project_groups.project_group_get(marker) @@ -147,7 +146,8 @@ class ProjectGroupsController(rest.RestController): title=title) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(group_count) if marker_group: response.headers['X-Marker'] = str(marker_group.id) diff --git a/storyboard/api/v1/projects.py b/storyboard/api/v1/projects.py index 94115803..0ebad8d2 100644 --- a/storyboard/api/v1/projects.py +++ b/storyboard/api/v1/projects.py @@ -98,9 +98,8 @@ class ProjectsController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_project = projects_api.project_get(marker) @@ -119,7 +118,8 @@ class ProjectsController(rest.RestController): project_group_id=project_group_id) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(project_count) if marker_project: response.headers['X-Marker'] = str(marker_project.id) diff --git a/storyboard/api/v1/stories.py b/storyboard/api/v1/stories.py index e2c38357..2ebc8123 100644 --- a/storyboard/api/v1/stories.py +++ b/storyboard/api/v1/stories.py @@ -92,9 +92,8 @@ class StoriesController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_story = stories_api.story_get(marker) @@ -122,7 +121,8 @@ class StoriesController(rest.RestController): tags_filter_type=tags_filter_type) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(story_count) if marker_story: response.headers['X-Marker'] = str(marker_story.id) diff --git a/storyboard/api/v1/subscription_events.py b/storyboard/api/v1/subscription_events.py index 49a31afd..e7b5cbdc 100644 --- a/storyboard/api/v1/subscription_events.py +++ b/storyboard/api/v1/subscription_events.py @@ -106,9 +106,8 @@ class SubscriptionEventsController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_sub = subscription_events_api.subscription_events_get(marker) @@ -133,7 +132,8 @@ class SubscriptionEventsController(rest.RestController): event_type=event_type) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(subscription_count) if marker_sub: response.headers['X-Marker'] = str(marker_sub.id) diff --git a/storyboard/api/v1/subscriptions.py b/storyboard/api/v1/subscriptions.py index d25727e3..c06f9d53 100644 --- a/storyboard/api/v1/subscriptions.py +++ b/storyboard/api/v1/subscriptions.py @@ -99,9 +99,8 @@ class SubscriptionsController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Sanity check on user_id current_user = user_api.user_get(request.current_user_id) @@ -126,7 +125,8 @@ class SubscriptionsController(rest.RestController): user_id=user_id) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(subscription_count) if marker_sub: response.headers['X-Marker'] = str(marker_sub.id) diff --git a/storyboard/api/v1/task_statuses.py b/storyboard/api/v1/task_statuses.py index d0ca1dd2..3f0d9644 100644 --- a/storyboard/api/v1/task_statuses.py +++ b/storyboard/api/v1/task_statuses.py @@ -37,9 +37,8 @@ class TaskStatusesController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) statuses = tasks_api.task_get_statuses() task_statuses = [] @@ -51,7 +50,8 @@ class TaskStatusesController(rest.RestController): task_statuses.append(ts) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(len(task_statuses)) return task_statuses[0:limit] diff --git a/storyboard/api/v1/tasks.py b/storyboard/api/v1/tasks.py index 6ac6b2b2..28b0cc8f 100644 --- a/storyboard/api/v1/tasks.py +++ b/storyboard/api/v1/tasks.py @@ -293,9 +293,8 @@ class TasksPrimaryController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_task = tasks_api.task_get(marker) @@ -326,7 +325,8 @@ class TasksPrimaryController(rest.RestController): priority=priority) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(task_count) if marker_task: response.headers['X-Marker'] = str(marker_task.id) @@ -468,9 +468,8 @@ class TasksNestedController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_task = tasks_api.task_get(marker) diff --git a/storyboard/api/v1/teams.py b/storyboard/api/v1/teams.py index 09113126..7ff6347f 100644 --- a/storyboard/api/v1/teams.py +++ b/storyboard/api/v1/teams.py @@ -134,9 +134,8 @@ class TeamsController(rest.RestController): :param sort_dir: Sort direction for results (asc, desc). """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_team = teams_api.team_get(marker) @@ -152,7 +151,8 @@ class TeamsController(rest.RestController): description=description) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(team_count) if marker_team: response.headers['X-Marker'] = str(marker_team.id) diff --git a/storyboard/api/v1/timeline.py b/storyboard/api/v1/timeline.py index 0969519d..0d2afb15 100644 --- a/storyboard/api/v1/timeline.py +++ b/storyboard/api/v1/timeline.py @@ -79,9 +79,8 @@ class TimeLineEventsController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Sanity check on event types. if event_type: @@ -105,7 +104,8 @@ class TimeLineEventsController(rest.RestController): sort_dir=sort_dir) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(event_count) if marker_event: response.headers['X-Marker'] = str(marker_event.id) @@ -153,9 +153,8 @@ class CommentsController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_event = None @@ -181,7 +180,8 @@ class CommentsController(rest.RestController): for event in events] # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(events_count) if marker_event: response.headers['X-Marker'] = str(marker) diff --git a/storyboard/api/v1/user_tokens.py b/storyboard/api/v1/user_tokens.py index 9a67ad0d..d5603dcc 100644 --- a/storyboard/api/v1/user_tokens.py +++ b/storyboard/api/v1/user_tokens.py @@ -72,9 +72,8 @@ class UserTokensController(rest.RestController): self._assert_can_access(user_id) # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_token = token_api.user_token_get(marker) @@ -88,7 +87,8 @@ class UserTokensController(rest.RestController): token_count = token_api.user_token_get_count(user_id=user_id) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(token_count) if marker_token: diff --git a/storyboard/api/v1/users.py b/storyboard/api/v1/users.py index 0e96fecd..41bc75f6 100644 --- a/storyboard/api/v1/users.py +++ b/storyboard/api/v1/users.py @@ -72,9 +72,8 @@ class UsersController(rest.RestController): """ # Boundary check on limit. - if limit is None: - limit = CONF.page_size_default - limit = max(0, limit) + if limit is not None: + limit = max(0, limit) # Resolve the marker record. marker_user = users_api.user_get(marker) @@ -87,7 +86,8 @@ class UsersController(rest.RestController): user_count = users_api.user_get_count(full_name=full_name) # Apply the query response headers. - response.headers['X-Limit'] = str(limit) + if limit: + response.headers['X-Limit'] = str(limit) response.headers['X-Total'] = str(user_count) if marker_user: response.headers['X-Marker'] = str(marker_user.id)