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
4f626fc5
Commit
4f626fc5
authored
Jul 29, 2008
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added desc method to filesystems that display debugging information regarding file / dir location
parent
4b2f57cb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
1 deletions
+48
-1
fs/browsewin.py
+4
-1
fs/fs.py
+15
-0
fs/memoryfs.py
+6
-0
fs/multifs.py
+23
-0
No files found.
fs/browsewin.py
View file @
4f626fc5
...
...
@@ -11,7 +11,7 @@ class BrowseFrame(wx.Frame):
def
__init__
(
self
,
fs
):
wx
.
Frame
.
__init__
(
self
,
None
)
wx
.
Frame
.
__init__
(
self
,
None
,
size
=
(
1000
,
600
)
)
self
.
fs
=
fs
self
.
SetTitle
(
"FS Browser - "
+
str
(
fs
))
...
...
@@ -20,6 +20,7 @@ class BrowseFrame(wx.Frame):
self
.
tree
.
AddColumn
(
"FS"
,
300
)
self
.
tree
.
AddColumn
(
"Size"
,
150
)
self
.
tree
.
AddColumn
(
"Created"
,
250
)
self
.
tree
.
AddColumn
(
"Description"
,
250
)
self
.
root_id
=
self
.
tree
.
AddRoot
(
'root'
,
data
=
wx
.
TreeItemData
(
{
'path'
:
"/"
,
'expanded'
:
False
}
))
rid
=
self
.
tree
.
GetItemData
(
self
.
root_id
)
...
...
@@ -99,6 +100,8 @@ class BrowseFrame(wx.Frame):
else
:
self
.
tree
.
SetItemText
(
new_item
,
'unknown'
,
2
)
self
.
tree
.
SetItemText
(
new_item
,
self
.
fs
.
desc
(
new_path
),
3
)
item_data
[
'expanded'
]
=
True
self
.
tree
.
Expand
(
item_id
)
...
...
fs/fs.py
View file @
4f626fc5
...
...
@@ -14,6 +14,7 @@ error_msgs = {
"INVALID_PATH"
:
"Path is invalid:
%(path)
s"
,
"NO_DIR"
:
"Directory does not exist:
%(path)
s"
,
"NO_FILE"
:
"No such file:
%(path)
s"
,
"NO_RESOURCE"
:
"No path to:
%(path)
s"
,
"LISTDIR_FAILED"
:
"Unable to get directory listing:
%(path)
s"
,
"DELETE_FAILED"
:
"Unable to delete file:
%(path)
s"
,
"NO_SYS_PATH"
:
"No mapping to OS filesytem:
%(path)
s,"
,
...
...
@@ -206,6 +207,20 @@ class FS(object):
return
NullFile
()
raise
def
desc
(
self
,
path
):
if
not
self
.
exists
(
path
):
return
"No description available"
try
:
sys_path
=
self
.
getsyspath
(
path
)
except
FSError
:
return
"No description available"
if
self
.
isdir
(
path
):
return
"Dir, maps to
%
s"
%
sys_path
else
:
return
"File, maps to
%
s"
%
sys_path
def
open
(
self
,
path
,
mode
=
"r"
,
buffering
=-
1
,
**
kwargs
):
...
...
fs/memoryfs.py
View file @
4f626fc5
...
...
@@ -175,6 +175,12 @@ class MemoryFS(FS):
raise
FSError
(
"NO_SYS_PATH"
,
pathname
,
msg
=
"This file-system has no syspath"
)
def
desc
(
self
,
path
):
if
self
.
isdir
(
path
):
return
"Dir in memory"
else
:
return
"File object in memory"
def
isdir
(
self
,
path
):
...
...
fs/multifs.py
View file @
4f626fc5
...
...
@@ -46,6 +46,16 @@ class MultiFS(FS):
return
fs
return
None
def
which
(
self
,
path
):
for
fs
in
self
:
if
fs
.
exists
(
path
):
for
fs_name
,
fs_object
in
self
.
fs_lookup
.
iteritems
():
if
fs
is
fs_object
:
return
fs_name
,
fs
return
None
,
None
def
getsyspath
(
self
,
path
):
fs
=
self
.
_delegate_search
(
path
)
...
...
@@ -54,6 +64,19 @@ class MultiFS(FS):
raise
FSError
(
"NO_FILE"
,
path
)
def
desc
(
self
,
path
):
if
not
self
.
exists
(
path
):
raise
FSError
(
"NO_RESOURCE"
,
path
)
name
,
fs
=
self
.
which
(
path
)
if
name
is
None
:
return
""
return
"
%
s, on
%
s (
%
s)"
%
(
fs
.
desc
(
path
),
name
,
fs
)
def
open
(
self
,
path
,
mode
=
"r"
,
buffering
=-
1
,
**
kwargs
):
for
fs
in
self
:
...
...
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