diff --git a/mwdb/core/deprecated.py b/mwdb/core/deprecated.py index d3615c69..df138a5f 100644 --- a/mwdb/core/deprecated.py +++ b/mwdb/core/deprecated.py @@ -31,10 +31,6 @@ class DeprecatedFeature(Enum): # Use GET / instead # Deprecated in v2.0.0 legacy_search = "legacy_search" - # Legacy ?page parameter in object listing endpoints - # Use "?older_than" instead - # Deprecated in v2.0.0 - legacy_page_parameter = "legacy_page_parameter" # Legacy Metakey API # Use Attribute API instead # Deprecated in v2.6.0 diff --git a/mwdb/resources/object.py b/mwdb/resources/object.py index 82227ef6..cba69230 100644 --- a/mwdb/resources/object.py +++ b/mwdb/resources/object.py @@ -216,9 +216,6 @@ def get(self): description: | Request canceled due to database statement timeout. """ - if "page" in request.args: - uses_deprecated_api(DeprecatedFeature.legacy_page_parameter) - obj = load_schema(request.args, ObjectListRequestSchema()) pivot_obj = None @@ -243,9 +240,6 @@ def get(self): ).order_by(Object.id.desc()) if pivot_obj: db_query = db_query.filter(Object.id < pivot_obj.id) - # Legacy parameter - to be removed in the future - elif obj["page"] is not None and obj["page"] > 1: - db_query = db_query.offset((obj["page"] - 1) * 10) objects = db_query.limit(limit).all() diff --git a/mwdb/schema/object.py b/mwdb/schema/object.py index 35356224..e261c996 100644 --- a/mwdb/schema/object.py +++ b/mwdb/schema/object.py @@ -1,13 +1,6 @@ import json -from marshmallow import ( - Schema, - ValidationError, - fields, - post_dump, - pre_load, - validates_schema, -) +from marshmallow import Schema, ValidationError, fields, post_dump, pre_load from .attribute import AttributeItemRequestSchema, AttributeItemResponseSchema from .metakey import MetakeyItemRequestSchema @@ -16,19 +9,10 @@ class ObjectListRequestSchema(Schema): - page = fields.Int(missing=None) # legacy, to be removed in future query = fields.Str(missing=None) older_than = fields.Str(missing=None) count = fields.Int(missing=10) - @validates_schema - def validate_key(self, data, **kwargs): - if data["page"] is not None and data["older_than"] is not None: - raise ValidationError( - "'page' and 'older_than' can't be used simultaneously. " - "Use 'older_than' for new code." - ) - class ObjectCountRequestSchema(Schema): query = fields.Str(missing=None)