From e7efcb316825a0b788cb8dc375792372aeaf7424 Mon Sep 17 00:00:00 2001 From: Daniel Hornung <d.hornung@indiscale.com> Date: Wed, 18 Sep 2024 14:43:52 +0200 Subject: [PATCH 1/3] MAINT: Added deprecation warning to DropOffBox related options. --- src/linkahead/common/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py index a8144286..0cc0f11e 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -2279,12 +2279,12 @@ class File(Record): server's "caosroot" file system. @param file: A local path or python file object. The file designated by this argument will be uploaded to the server via HTTP. - @param pickup: A file/folder in the DropOffBox (the server will move that + @param pickup: Deprecated: A file/folder in the DropOffBox (the server will move that file into its "caosroot" file system). @param thumbnail: (Local) filename to a thumbnail for this file. @param properties: A list of properties for this file record. @todo is this implemented? - @param from_location: Deprecated, use `pickup` instead. + @param from_location: Deprecated x 2, use `pickup` instead. """ @@ -2311,10 +2311,12 @@ class File(Record): self.thumbnail = thumbnail self.pickup = pickup + if self.pickup is not None: + warn(DeprecationWarning("The DropOffBox is deprecated, do not use `pickup`.")) if from_location is not None: warn(DeprecationWarning( - "Param `from_location` is deprecated, use `pickup instead`.")) + "Param `from_location` is deprecated, as everything DropOffBox related.")) if self.pickup is None: self.pickup = from_location -- GitLab From 2600dacb6a3193f90d6174c84d29229a90bd2776 Mon Sep 17 00:00:00 2001 From: Daniel Hornung <d.hornung@indiscale.com> Date: Wed, 18 Sep 2024 15:40:40 +0200 Subject: [PATCH 2/3] MAINT: Removced DropOffBox class. --- src/linkahead/__init__.py | 2 +- src/linkahead/common/models.py | 36 ---------------------------------- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/src/linkahead/__init__.py b/src/linkahead/__init__.py index cd54f8f4..2c34c252 100644 --- a/src/linkahead/__init__.py +++ b/src/linkahead/__init__.py @@ -42,7 +42,7 @@ from .common.datatype import (BOOLEAN, DATETIME, DOUBLE, FILE, INTEGER, LIST, REFERENCE, TEXT) # Import of the basic API classes: from .common.models import (ACL, ALL, FIX, NONE, OBLIGATORY, RECOMMENDED, - SUGGESTED, Container, DropOffBox, Entity, File, + SUGGESTED, Container, Entity, File, Info, Message, Permissions, Property, Query, QueryTemplate, Record, RecordType, delete, execute_query, get_global_acl, diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py index 0cc0f11e..c4b4d15e 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -4999,42 +4999,6 @@ def execute_query( cache=cache, page_length=page_length) -class DropOffBox(list): - def __init__(self, *args, **kwargs): - warn(DeprecationWarning("The DropOffBox is deprecated and will be removed in future.")) - super().__init__(*args, **kwargs) - - path = None - - def sync(self): - c = get_connection() - _log_request("GET: Info") - http_response = c.retrieve(["Info"]) - body = http_response.read() - _log_response(body) - - xml = etree.fromstring(body) - - for child in xml: - if child.tag.lower() == "stats": - infoelem = child - - break - - for child in infoelem: - if child.tag.lower() == "dropoffbox": - dropoffboxelem = child - - break - del self[:] - self.path = dropoffboxelem.get('path') - - for f in dropoffboxelem: - self.append(f.get('path')) - - return self - - class UserInfo(): """User information from a server response. -- GitLab From 85d209eb825e8192c8e18527c0ea8777d1a79d8f Mon Sep 17 00:00:00 2001 From: Daniel Hornung <d.hornung@indiscale.com> Date: Wed, 25 Sep 2024 16:09:55 +0200 Subject: [PATCH 3/3] WIP: DropOffBox removal --- CHANGELOG.md | 2 ++ src/linkahead/common/models.py | 35 +--------------------------------- 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b792cc1..78b4b206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed ### +- `DropOffBox` class and related parameters (`pickup` for file uploading). + ### Fixed ### ### Security ### diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py index c4b4d15e..6683ed11 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -358,17 +358,6 @@ class Entity: def file(self, new_file): self.__file = new_file - @property - def pickup(self): - if self.__pickup is not None or self._wrapped_entity is None: - return self.__pickup - - return self._wrapped_entity.pickup - - @pickup.setter - def pickup(self, new_pickup): - self.__pickup = new_pickup - def grant( self, realm: Optional[str] = None, @@ -2263,8 +2252,7 @@ class File(Record): """This class represents LinkAhead's file entities. For inserting a new file to the server, `path` gives the new location, and - (exactly?) one of `file` and `pickup` should (must?) be given to specify the - source of the file. + `file` specifies the source of the file. Symlinking from the "extroot" file system is not supported by this API yet, it can be done manually using the `InsertFilesInDir` flag. For sample code, @@ -2279,13 +2267,9 @@ class File(Record): server's "caosroot" file system. @param file: A local path or python file object. The file designated by this argument will be uploaded to the server via HTTP. - @param pickup: Deprecated: A file/folder in the DropOffBox (the server will move that - file into its "caosroot" file system). @param thumbnail: (Local) filename to a thumbnail for this file. @param properties: A list of properties for this file record. @todo is this implemented? - @param from_location: Deprecated x 2, use `pickup` instead. - """ def __init__( @@ -2295,9 +2279,7 @@ class File(Record): description: Optional[str] = None, # @ReservedAssignment path: Optional[str] = None, file: Union[str, TextIO, None] = None, - pickup: Optional[str] = None, # @ReservedAssignment thumbnail: Optional[str] = None, - from_location=None, ): Record.__init__(self, id=id, name=name, description=description) self.role = "File" @@ -2310,17 +2292,6 @@ class File(Record): self.file = file self.thumbnail = thumbnail - self.pickup = pickup - if self.pickup is not None: - warn(DeprecationWarning("The DropOffBox is deprecated, do not use `pickup`.")) - - if from_location is not None: - warn(DeprecationWarning( - "Param `from_location` is deprecated, as everything DropOffBox related.")) - - if self.pickup is None: - self.pickup = from_location - def to_xml( self, xml: Optional[etree._Element] = None, @@ -3975,8 +3946,6 @@ class Container(list): if hasattr(entity, '_upload') and entity._upload is not None: entity_xml.set("upload", entity._upload) - elif hasattr(entity, 'pickup') and entity.pickup is not None: - entity_xml.set("pickup", entity.pickup) insert_xml.append(entity_xml) @@ -4149,8 +4118,6 @@ class Container(list): if hasattr(entity, '_upload') and entity._upload is not None: entity_xml.set("upload", entity._upload) - elif hasattr(entity, 'pickup') and entity.pickup is not None: - entity_xml.set("pickup", entity.pickup) insert_xml.append(entity_xml) if len(self) > 0 and len(insert_xml) < 1: -- GitLab