Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
a07d64a7
Commit
a07d64a7
authored
Sep 18, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrap_fs_methods: kwd arg to exclude certain methods
parent
974ea2b2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
+3
-1
fs/wrapfs.py
+3
-1
No files found.
fs/wrapfs.py
View file @
a07d64a7
...
@@ -236,7 +236,7 @@ class WrapFS(FS):
...
@@ -236,7 +236,7 @@ class WrapFS(FS):
if
hasattr
(
self
.
wrapped_fs
,
"close"
):
if
hasattr
(
self
.
wrapped_fs
,
"close"
):
self
.
wrapped_fs
.
close
()
self
.
wrapped_fs
.
close
()
def
wrap_fs_methods
(
decorator
,
cls
=
None
):
def
wrap_fs_methods
(
decorator
,
cls
=
None
,
exclude
=
[]
):
"""Apply the given decorator to all FS methods on the given class.
"""Apply the given decorator to all FS methods on the given class.
This function can be used in two ways. When called with two arguments it
This function can be used in two ways. When called with two arguments it
...
@@ -261,6 +261,8 @@ def wrap_fs_methods(decorator,cls=None):
...
@@ -261,6 +261,8 @@ def wrap_fs_methods(decorator,cls=None):
def
apply_decorator
(
cls
):
def
apply_decorator
(
cls
):
for
method_name
in
methods
:
for
method_name
in
methods
:
if
method_name
in
exclude
:
continue
method
=
getattr
(
cls
,
method_name
,
None
)
method
=
getattr
(
cls
,
method_name
,
None
)
if
method
is
not
None
:
if
method
is
not
None
:
setattr
(
cls
,
method_name
,
decorator
(
method
))
setattr
(
cls
,
method_name
,
decorator
(
method
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment