Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
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
django-pipeline
Commits
d80a100e
Commit
d80a100e
authored
Apr 02, 2012
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure we try to open and save the same way
parent
dab36fc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
pipeline/storage.py
+19
-3
No files found.
pipeline/storage.py
View file @
d80a100e
...
@@ -72,7 +72,7 @@ class BaseFinderStorage(PipelineStorage):
...
@@ -72,7 +72,7 @@ class BaseFinderStorage(PipelineStorage):
def
exists
(
self
,
name
):
def
exists
(
self
,
name
):
exists
=
self
.
finders
.
find
(
name
)
!=
None
exists
=
self
.
finders
.
find
(
name
)
!=
None
if
not
exists
:
if
not
exists
:
exists
=
super
(
BaseFinderStorage
,
self
)
.
exists
(
name
)
return
super
(
BaseFinderStorage
,
self
)
.
exists
(
name
)
return
exists
return
exists
def
listdir
(
self
,
path
):
def
listdir
(
self
,
path
):
...
@@ -83,11 +83,27 @@ class BaseFinderStorage(PipelineStorage):
...
@@ -83,11 +83,27 @@ class BaseFinderStorage(PipelineStorage):
except
OSError
:
except
OSError
:
pass
pass
def
_save
(
self
,
name
,
content
):
def
find_storage
(
self
,
name
):
for
finder
in
finders
.
get_finders
():
for
finder
in
finders
.
get_finders
():
for
path
,
storage
in
finder
.
list
([]):
for
path
,
storage
in
finder
.
list
([]):
if
os
.
path
.
dirname
(
name
)
in
path
:
if
os
.
path
.
dirname
(
name
)
in
path
:
return
storage
.
_save
(
name
,
content
)
return
storage
return
None
def
_open
(
self
,
name
,
mode
=
"rb"
):
storage
=
self
.
find_storage
(
name
)
if
storage
:
return
storage
.
_open
(
name
,
mode
)
return
super
(
BaseFinderStorage
,
self
)
.
_open
(
name
,
mode
)
def
_save
(
self
,
name
,
content
):
storage
=
self
.
find_storage
(
name
)
if
storage
:
# Ensure we overwrite file, since we have no control on external storage
if
storage
.
exists
(
name
):
storage
.
delete
(
name
)
return
storage
.
_save
(
name
,
content
)
return
super
(
BaseFinderStorage
,
self
)
.
_save
(
name
,
content
)
class
PipelineFinderStorage
(
BaseFinderStorage
):
class
PipelineFinderStorage
(
BaseFinderStorage
):
...
...
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