diff --git a/CHANGELOG.md b/CHANGELOG.md index 33142766ee95866ec4e3052ed3d7437fae0d2dd1..7ecd4f37fba0cc9f5b24ebb12ef60952a407ea8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,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/__init__.py b/src/linkahead/__init__.py index ac8df123c66ee092801e63a427003fbb7478fc0c..9d5d754619112f94246451ef875c454a8fbf9f4f 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, Parent, + SUGGESTED, Container, Entity, File, Parent, 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 a3b4683a20a49fe1fc936d47fb185823c4e0eaba..5f4a6a194d17e76d6a3eedf4be1a81633f7d6e3e 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -338,26 +338,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 - - @property # getter for _cuid - def cuid(self): - # Set if None? - return self._cuid - - @property # getter for _flags - def flags(self): - return self._flags.copy() # for dict[str, str] shallow copy is enough - def grant( self, realm: Optional[str] = None, @@ -2307,8 +2287,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, @@ -2341,9 +2320,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" @@ -2356,15 +2333,6 @@ class File(Record): self.file = file self.thumbnail = thumbnail - self.pickup = pickup - - if from_location is not None: - warn(DeprecationWarning( - "Param `from_location` is deprecated, use `pickup instead`.")) - - if self.pickup is None: - self.pickup = from_location - def to_xml( self, xml: Optional[etree._Element] = None, @@ -4169,8 +4137,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) @@ -4343,8 +4309,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: @@ -5193,42 +5157,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 str(child.tag).lower() == "stats": - infoelem = child - - break - - for child in infoelem: - if str(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.