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
b0f011ff
Commit
b0f011ff
authored
Aug 01, 2008
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some small tweaks...
parent
563213f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
fs/objecttree.py
+5
-5
No files found.
fs/objecttree.py
View file @
b0f011ff
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
from
fs
import
_iteratepath
,
pathsplit
from
fs
import
_iteratepath
,
pathsplit
class
ObjectDict
(
dict
):
class
_
ObjectDict
(
dict
):
pass
pass
class
ObjectTree
(
object
):
class
ObjectTree
(
object
):
...
@@ -10,12 +10,12 @@ class ObjectTree(object):
...
@@ -10,12 +10,12 @@ class ObjectTree(object):
"""A class to facilitate the creation of tree structures."""
"""A class to facilitate the creation of tree structures."""
def
__init__
(
self
):
def
__init__
(
self
):
self
.
root
=
ObjectDict
()
self
.
root
=
_
ObjectDict
()
def
_locate
(
self
,
path
):
def
_locate
(
self
,
path
):
current
=
self
.
root
current
=
self
.
root
for
path_component
in
path
.
split
(
'/'
):
for
path_component
in
path
.
split
(
'/'
):
if
type
(
current
)
is
not
ObjectDict
:
if
type
(
current
)
is
not
_
ObjectDict
:
return
None
return
None
node
=
current
.
get
(
path_component
,
None
)
node
=
current
.
get
(
path_component
,
None
)
if
node
is
None
:
if
node
is
None
:
...
@@ -30,8 +30,8 @@ class ObjectTree(object):
...
@@ -30,8 +30,8 @@ class ObjectTree(object):
path
,
name
=
path
.
rsplit
(
'/'
,
1
)
path
,
name
=
path
.
rsplit
(
'/'
,
1
)
for
path_component
in
path
.
split
(
'/'
):
for
path_component
in
path
.
split
(
'/'
):
node
=
current
.
get
(
path_component
,
None
)
node
=
current
.
get
(
path_component
,
None
)
if
node
is
None
or
type
(
node
)
is
not
ObjectDict
:
if
type
(
node
)
is
not
_
ObjectDict
:
new_dict
=
ObjectDict
()
new_dict
=
_
ObjectDict
()
current
[
path_component
]
=
new_dict
current
[
path_component
]
=
new_dict
current
=
new_dict
current
=
new_dict
else
:
else
:
...
...
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