Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
e69955b4
Commit
e69955b4
authored
Sep 18, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pylint/pep8 fixes
parent
99bf6417
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
cms/djangoapps/contentstore/views/assets.py
+0
-1
common/lib/xmodule/xmodule/contentstore/content.py
+1
-1
common/lib/xmodule/xmodule/contentstore/mongo.py
+11
-11
No files found.
cms/djangoapps/contentstore/views/assets.py
View file @
e69955b4
...
@@ -10,7 +10,6 @@ from django.views.decorators.http import require_POST
...
@@ -10,7 +10,6 @@ from django.views.decorators.http import require_POST
from
mitxmako.shortcuts
import
render_to_response
from
mitxmako.shortcuts
import
render_to_response
from
cache_toolbox.core
import
del_cached_content
from
cache_toolbox.core
import
del_cached_content
from
auth.authz
import
create_all_course_groups
from
xmodule.contentstore.django
import
contentstore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
...
...
common/lib/xmodule/xmodule/contentstore/content.py
View file @
e69955b4
...
@@ -15,7 +15,7 @@ from PIL import Image
...
@@ -15,7 +15,7 @@ from PIL import Image
class
StaticContent
(
object
):
class
StaticContent
(
object
):
def
__init__
(
self
,
loc
,
name
,
content_type
,
data
,
last_modified_at
=
None
,
thumbnail_location
=
None
,
import_path
=
None
,
def
__init__
(
self
,
loc
,
name
,
content_type
,
data
,
last_modified_at
=
None
,
thumbnail_location
=
None
,
import_path
=
None
,
length
=
None
):
length
=
None
,
locked
=
False
):
self
.
location
=
loc
self
.
location
=
loc
self
.
name
=
name
# a display string which can be edited, and thus not part of the location which needs to be fixed
self
.
name
=
name
# a display string which can be edited, and thus not part of the location which needs to be fixed
self
.
content_type
=
content_type
self
.
content_type
=
content_type
...
...
common/lib/xmodule/xmodule/contentstore/mongo.py
View file @
e69955b4
...
@@ -27,12 +27,12 @@ class MongoContentStore(ContentStore):
...
@@ -27,12 +27,12 @@ class MongoContentStore(ContentStore):
self
.
fs_files
=
_db
[
bucket
+
".files"
]
# the underlying collection GridFS uses
self
.
fs_files
=
_db
[
bucket
+
".files"
]
# the underlying collection GridFS uses
def
save
(
self
,
content
):
def
save
(
self
,
content
):
id
=
content
.
get_id
()
content_
id
=
content
.
get_id
()
# Seems like with the GridFS we can't update existing ID's we have to do a delete/add pair
# Seems like with the GridFS we can't update existing ID's we have to do a delete/add pair
self
.
delete
(
id
)
self
.
delete
(
content_
id
)
with
self
.
fs
.
new_file
(
_id
=
id
,
filename
=
content
.
get_url_path
(),
content_type
=
content
.
content_type
,
with
self
.
fs
.
new_file
(
_id
=
content_
id
,
filename
=
content
.
get_url_path
(),
content_type
=
content
.
content_type
,
displayname
=
content
.
name
,
thumbnail_location
=
content
.
thumbnail_location
,
displayname
=
content
.
name
,
thumbnail_location
=
content
.
thumbnail_location
,
import_path
=
content
.
import_path
)
as
fp
:
import_path
=
content
.
import_path
)
as
fp
:
if
hasattr
(
content
.
data
,
'__iter__'
):
if
hasattr
(
content
.
data
,
'__iter__'
):
...
@@ -43,25 +43,25 @@ class MongoContentStore(ContentStore):
...
@@ -43,25 +43,25 @@ class MongoContentStore(ContentStore):
return
content
return
content
def
delete
(
self
,
id
):
def
delete
(
self
,
content_
id
):
if
self
.
fs
.
exists
({
"_id"
:
id
}):
if
self
.
fs
.
exists
({
"_id"
:
content_
id
}):
self
.
fs
.
delete
(
id
)
self
.
fs
.
delete
(
content_
id
)
def
find
(
self
,
location
,
throw_on_not_found
=
True
,
as_stream
=
False
):
def
find
(
self
,
location
,
throw_on_not_found
=
True
,
as_stream
=
False
):
id
=
StaticContent
.
get_id_from_location
(
location
)
content_
id
=
StaticContent
.
get_id_from_location
(
location
)
try
:
try
:
if
as_stream
:
if
as_stream
:
fp
=
self
.
fs
.
get
(
id
)
return
StaticContentStream
(
location
,
fp
.
displayname
,
fp
.
content_type
,
fp
,
last_modified_at
=
fp
.
uploadDate
,
return
StaticContentStream
(
location
,
fp
.
displayname
,
fp
.
content_type
,
fp
,
last_modified_at
=
fp
.
uploadDate
,
thumbnail_location
=
fp
.
thumbnail_location
if
hasattr
(
fp
,
'thumbnail_location'
)
else
None
,
thumbnail_location
=
fp
.
thumbnail_location
if
hasattr
(
fp
,
'thumbnail_location'
)
else
None
,
import_path
=
fp
.
import_path
if
hasattr
(
fp
,
'import_path'
)
else
None
,
import_path
=
fp
.
import_path
if
hasattr
(
fp
,
'import_path'
)
else
None
,
length
=
fp
.
length
)
length
=
fp
.
length
)
fp
=
self
.
fs
.
get
(
content_id
)
else
:
else
:
with
self
.
fs
.
get
(
id
)
as
fp
:
return
StaticContent
(
location
,
fp
.
displayname
,
fp
.
content_type
,
fp
.
read
(),
last_modified_at
=
fp
.
uploadDate
,
return
StaticContent
(
location
,
fp
.
displayname
,
fp
.
content_type
,
fp
.
read
(),
last_modified_at
=
fp
.
uploadDate
,
thumbnail_location
=
fp
.
thumbnail_location
if
hasattr
(
fp
,
'thumbnail_location'
)
else
None
,
thumbnail_location
=
fp
.
thumbnail_location
if
hasattr
(
fp
,
'thumbnail_location'
)
else
None
,
import_path
=
fp
.
import_path
if
hasattr
(
fp
,
'import_path'
)
else
None
,
import_path
=
fp
.
import_path
if
hasattr
(
fp
,
'import_path'
)
else
None
,
length
=
fp
.
length
)
length
=
fp
.
length
)
with
self
.
fs
.
get
(
content_id
)
as
fp
:
except
NoFile
:
except
NoFile
:
if
throw_on_not_found
:
if
throw_on_not_found
:
raise
NotFoundError
()
raise
NotFoundError
()
...
@@ -69,9 +69,9 @@ class MongoContentStore(ContentStore):
...
@@ -69,9 +69,9 @@ class MongoContentStore(ContentStore):
return
None
return
None
def
get_stream
(
self
,
location
):
def
get_stream
(
self
,
location
):
id
=
StaticContent
.
get_id_from_location
(
location
)
content_
id
=
StaticContent
.
get_id_from_location
(
location
)
try
:
try
:
handle
=
self
.
fs
.
get
(
id
)
handle
=
self
.
fs
.
get
(
content_
id
)
except
NoFile
:
except
NoFile
:
raise
NotFoundError
()
raise
NotFoundError
()
...
...
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