fix: upstream bugfixes and proxy support backport#11
Merged
milanmajchrak merged 2 commits intodtqfrom Feb 18, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR backports critical bugfixes and proxy support from the upstream dspace-rest-python library (v0.1.14-v0.1.16). It addresses several serious bugs including tuple-instead-of-None issues in the User class, a broken get_items() method that always returned empty results, and incorrect field assignments in InProgressSubmission and EntityType initialization. The PR also adds HTTP/HTTPS proxy support via environment variable configuration.
Changes:
- Fixed 6 trailing comma bugs in User class that created tuples instead of None values
- Fixed get_items() checking wrong key ('collections' → 'items') in API response
- Fixed InProgressSubmission and EntityType init methods incorrectly assigning fields
- Added proxy support with PROXY_DICT class variable and proxies parameter to all HTTP methods
- Added params parameter to api_patch() for query string support
- Added embedded attribute to HALResource for accessing embedded API sub-resources
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| dspace_rest_client/models.py | Fixes User class trailing commas (lines 428-433), InProgressSubmission field assignment bugs (lines 480, 484), EntityType label overwrite bug (line 515), and adds embedded attribute to HALResource (lines 24, 33, 42-43) |
| dspace_rest_client/client.py | Adds PROXY_DICT class variable and proxies parameter (lines 77, 87, 100), adds proxies argument to all 7 HTTP methods (authenticate, api_get, api_post, api_post_uri, api_put, api_delete, api_patch), adds params parameter to api_patch (line 353), and fixes get_items() key check (line 935) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
879e73a to
a62f674
Compare
Backports critical bugfixes and proxy support from upstream the-library-code/dspace-rest-python.
Bugfixes:
- Fix User model trailing commas that turned fields into tuples
- Fix get_items() using wrong embedded key ('collections' -> 'items')
- Fix InProgressSubmission step assigned from lastModified instead of step
- Fix InProgressSubmission type assigned from lastModified instead of type
- Fix EntityType type field overwriting label
- Fix parse_json to handle None response safely
Improvements:
- Add proxy support via PROXY_URL env var and proxies constructor param
- Add proxies to all HTTP methods (GET, POST, PUT, DELETE, PATCH, send)
- Add proxies to authenticate status check GET
- Add params parameter to api_patch method
- Add embedded attribute to HALResource base class
- Add ITER_PAGE_SIZE class variable (preparation for pagination)
- Add upstream_ref/ to .gitignore
a62f674 to
59402c0
Compare
milanmajchrak
approved these changes
Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport critical bugfixes and improvements from the-library-code/dspace-rest-python upstream (v0.1.14-v0.1.16) into our fork.
Bug Fixes
Critical
User class trailing comma bug (models.py) - Class-level field definitions like
name = None,had trailing commas, silently creating tuples(None,)instead ofNone. This caused incorrect behavior in JSON serialization, comparisons (user.name is None->False), and any downstream code assuming these are plain values. All 6 affected fields fixed.get_items() never returning results (client.py) - Was checking
collectionsinr_json['_embedded']instead ofitems, meaning this method always returned an empty list even when the API responded correctly.InProgressSubmission.init double assignment bugs (models.py) - Two bugs:
self.stepwas assignedapi_resource['lastModified']instead ofapi_resource['step']; whentypewas present, it overwroteself.lastModifiedwith itself instead of settingself.type.EntityType.init label overwrite (models.py) - The
typefield was being assigned toself.label, destroying the correctly parsed label value. Fixed to assign toself.type.Improvements
Proxy support for all HTTP methods (client.py) - Added
PROXY_DICTclass variable (readsPROXY_URLenv var),proxiesparameter toDSpaceClient.__init__(), andproxies=self.proxiesto all 7 HTTP methods:authenticate,api_get,api_post,api_post_uri,api_put,api_delete,api_patch.params parameter added to api_patch() (client.py) - Upstream added
params=Nonetoapi_patch()and passes it tosession.patch(). Previously query parameters could not be passed during PATCH operations.embedded attribute on HALResource (models.py) - All HAL resources now store
_embeddeddata from API responses intoself.embedded. Enables access to embedded sub-resources (e.g.community.embedded['logo']).API / Breaking Changes
DSpaceClient.__init__()has newproxiesparameterPROXY_DICT(empty dict if no env var)proxies={...}to useapi_patch()has newparamsparameterNone(same behavior as before)HALResourceand subclasses now have.embeddedattribute{}dso.embedded['logo']etc.Userclass fields changed from tuples to proper typesuser.name == (None,)touser.name is Noneget_items()now actually returns items[]InProgressSubmission.stepnow correctly populatedlastModified.stepnow gets the real valueInProgressSubmission.typenow correctly populatedNone.typenow gets the real valueEntityType.typeno longer overwrites.label.labelnow correct,.typenow populatedNot Included
The following upstream additions were intentionally not included (new features, not bugfixes):
paginateddecorator and*_iterauto-paginating methodsparse_params/embedsparameter throughout methodscreate_item_version,create_resource_policy,resolve_identifier_to_dsomethodsBitstreamFormat,SearchResultmodel classessmart_openS3 support increate_bitstreamsetup.pytopyproject.tomlsearch_objectsconfigurationparameter