Skip to content

Commit 18ac2e0

Browse files
Martin Larraldewillmcgugan
authored andcommitted
Fix registry.install not returning decorated class (#249)
* Fix `registry.install` not returning decorated class * Update `CHANGELOG.md` with `Registry.install` bugfix
1 parent d6cf403 commit 18ac2e0

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## Unreleased
9+
10+
### Fixed
11+
12+
- `Registry.install` returns its argument.
13+
814
## [2.2.0] - 2018-01-01
915

1016
A few methods have been renamed for greater clarity (but functionality remains the same).

fs/opener/registry.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ def install(self, opener):
7171
class ArchiveOpener(Opener):
7272
protocols = ['zip', 'tar']
7373
"""
74-
if not isinstance(opener, Opener):
75-
opener = opener()
76-
assert isinstance(opener, Opener), "Opener instance required"
77-
assert opener.protocols, "must list one or more protocols"
78-
for protocol in opener.protocols:
79-
self._protocols[protocol] = opener
74+
_opener = opener if isinstance(opener, Opener) else opener()
75+
assert isinstance(_opener, Opener), "Opener instance required"
76+
assert _opener.protocols, "must list one or more protocols"
77+
for protocol in _opener.protocols:
78+
self._protocols[protocol] = _opener
79+
return opener
8080

8181
@property
8282
def protocols(self):

0 commit comments

Comments
 (0)