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
de98e4d8
Commit
de98e4d8
authored
Nov 23, 2009
by
rfkelly0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support for ResourceLockedError on Windows
parent
c0896558
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
fs/errors.py
+8
-0
fs/memoryfs.py
+2
-2
fs/tempfs.py
+3
-0
No files found.
fs/errors.py
View file @
de98e4d8
...
...
@@ -144,6 +144,11 @@ def convert_fs_errors(func):
raise
OSError
(
errno
.
EINVAL
,
str
(
e
))
except
PermissionDeniedError
,
e
:
raise
OSError
(
errno
.
EACCES
,
str
(
e
))
except
ResourceLockedError
,
e
:
if
sys
.
platform
==
"win32"
:
raise
WindowsError
(
32
,
str
(
e
))
else
:
raise
OSError
(
errno
.
EACCES
,
str
(
e
))
except
DirectoryNotEmptyError
,
e
:
raise
OSError
(
errno
.
ENOTEMPTY
,
str
(
e
))
except
DestinationExistsError
,
e
:
...
...
@@ -194,6 +199,9 @@ def convert_os_errors(func):
if
e
.
errno
==
errno
.
ENOSPC
:
raise
StorageSpaceError
(
opname
,
details
=
e
),
None
,
tb
if
e
.
errno
==
errno
.
EACCES
:
if
sys
.
platform
==
"win32"
:
if
e
.
args
[
0
]
and
e
.
args
[
0
]
==
32
:
raise
ResourceLockedError
(
path
,
opname
=
opname
,
details
=
e
),
None
,
tb
raise
PermissionDeniedError
(
opname
,
details
=
e
),
None
,
tb
# Sometimes windows gives some random errors...
if
sys
.
platform
==
"win32"
:
...
...
fs/memoryfs.py
View file @
de98e4d8
...
...
@@ -349,7 +349,7 @@ class MemoryFS(FS):
if
dir_entry
.
islocked
():
self
.
_orphan_files
(
dir_entry
)
#raise ResourceLockedError(
"FILE_LOCKED",
path)
#raise ResourceLockedError(path)
if
dir_entry
.
isdir
():
raise
ResourceInvalidError
(
path
,
msg
=
"That's a directory, not a file:
%(path)
s"
)
...
...
@@ -397,7 +397,7 @@ class MemoryFS(FS):
if
dir_entry
is
None
:
raise
ResourceNotFoundError
(
src
)
#if dir_entry.islocked():
# raise ResourceLockedError(
"FILE_LOCKED",
src)
# raise ResourceLockedError(src)
open_files
=
dir_entry
.
open_files
[:]
for
f
in
open_files
:
...
...
fs/tempfs.py
View file @
de98e4d8
...
...
@@ -4,6 +4,8 @@ import os
from
osfs
import
OSFS
import
tempfile
from
fs.errors
import
*
class
TempFS
(
OSFS
):
"""Create a Filesystem in a tempory directory (with tempfile.mkdtemp),
...
...
@@ -28,6 +30,7 @@ class TempFS(OSFS):
def
__unicode__
(
self
):
return
unicode
(
self
.
__str__
())
@convert_os_errors
def
close
(
self
):
"""Removes the temporary directory.
This will be called automatically when the object is cleaned up by
...
...
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