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
6d6b3a59
Commit
6d6b3a59
authored
Apr 12, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
violation fixes
parent
d4536c65
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
30 additions
and
33 deletions
+30
-33
cms/djangoapps/contentstore/course_info_model.py
+1
-2
cms/djangoapps/contentstore/module_info_model.py
+0
-1
cms/djangoapps/contentstore/utils.py
+6
-6
cms/djangoapps/contentstore/views.py
+0
-0
cms/djangoapps/models/settings/course_details.py
+0
-1
cms/djangoapps/models/settings/course_grading.py
+9
-15
cms/djangoapps/models/settings/course_metadata.py
+11
-5
cms/envs/aws.py
+1
-2
cms/envs/common.py
+1
-1
common/lib/xmodule/xmodule/contentstore/content.py
+1
-0
No files found.
cms/djangoapps/contentstore/course_info_model.py
View file @
6d6b3a59
...
...
@@ -97,8 +97,7 @@ def update_course_updates(location, update, passed_id=None):
if
(
len
(
new_html_parsed
)
==
1
):
content
=
new_html_parsed
[
0
]
.
tail
else
:
content
=
"
\n
"
.
join
([
html
.
tostring
(
ele
)
for
ele
in
new_html_parsed
[
1
:]])
content
=
"
\n
"
.
join
([
html
.
tostring
(
ele
)
for
ele
in
new_html_parsed
[
1
:]])
return
{
"id"
:
passed_id
,
"date"
:
update
[
'date'
],
...
...
cms/djangoapps/contentstore/module_info_model.py
View file @
6d6b3a59
from
static_replace
import
replace_static_urls
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore
import
Location
from
django.http
import
Http404
def
get_module_info
(
store
,
location
,
parent_location
=
None
,
rewrite_static_links
=
False
):
...
...
cms/djangoapps/contentstore/utils.py
View file @
6d6b3a59
import
logging
from
django.conf
import
settings
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
...
...
@@ -9,7 +8,7 @@ import copy
DIRECT_ONLY_CATEGORIES
=
[
'course'
,
'chapter'
,
'sequential'
,
'about'
,
'static_tab'
,
'course_info'
]
#In order to instantiate an open ended tab automatically, need to have this data
OPEN_ENDED_PANEL
=
{
"name"
:
"Open Ended Panel"
,
"type"
:
"open_ended"
}
OPEN_ENDED_PANEL
=
{
"name"
:
"Open Ended Panel"
,
"type"
:
"open_ended"
}
def
get_modulestore
(
location
):
...
...
@@ -87,11 +86,10 @@ def get_lms_link_for_item(location, preview=False, course_id=None):
if
settings
.
LMS_BASE
is
not
None
:
if
preview
:
lms_base
=
settings
.
MITX_FEATURES
.
get
(
'PREVIEW_LMS_BASE'
,
'preview.'
+
settings
.
LMS_BASE
)
lms_base
=
settings
.
MITX_FEATURES
.
get
(
'PREVIEW_LMS_BASE'
,
'preview.'
+
settings
.
LMS_BASE
)
else
:
lms_base
=
settings
.
LMS_BASE
lms_link
=
"//{lms_base}/courses/{course_id}/jump_to/{location}"
.
format
(
lms_base
=
lms_base
,
course_id
=
course_id
,
...
...
@@ -193,6 +191,7 @@ class CoursePageNames:
CourseOutline
=
"course_index"
Checklists
=
"checklists"
def
add_open_ended_panel_tab
(
course
):
"""
Used to add the open ended panel tab to a course if it does not exist.
...
...
@@ -209,6 +208,7 @@ def add_open_ended_panel_tab(course):
changed
=
True
return
changed
,
course_tabs
def
remove_open_ended_panel_tab
(
course
):
"""
Used to remove the open ended panel tab from a course if it exists.
...
...
@@ -221,6 +221,6 @@ def remove_open_ended_panel_tab(course):
#Check to see if open ended panel is defined in the course
if
OPEN_ENDED_PANEL
in
course_tabs
:
#Add panel to the tabs if it is not defined
course_tabs
=
[
ct
for
ct
in
course_tabs
if
ct
!=
OPEN_ENDED_PANEL
]
course_tabs
=
[
ct
for
ct
in
course_tabs
if
ct
!=
OPEN_ENDED_PANEL
]
changed
=
True
return
changed
,
course_tabs
cms/djangoapps/contentstore/views.py
View file @
6d6b3a59
This diff is collapsed.
Click to expand it.
cms/djangoapps/models/settings/course_details.py
View file @
6d6b3a59
...
...
@@ -174,7 +174,6 @@ class CourseDetails(object):
return
result
# TODO move to a more general util? Is there a better way to do the isinstance model check?
class
CourseSettingsEncoder
(
json
.
JSONEncoder
):
def
default
(
self
,
obj
):
...
...
cms/djangoapps/models/settings/course_grading.py
View file @
6d6b3a59
...
...
@@ -45,14 +45,13 @@ class CourseGradingModel(object):
# return empty model
else
:
return
{
"id"
:
index
,
return
{
"id"
:
index
,
"type"
:
""
,
"min_count"
:
0
,
"drop_count"
:
0
,
"short_label"
:
None
,
"weight"
:
0
}
}
@staticmethod
def
fetch_cutoffs
(
course_location
):
...
...
@@ -95,7 +94,6 @@ class CourseGradingModel(object):
return
CourseGradingModel
.
fetch
(
course_location
)
@staticmethod
def
update_grader_from_json
(
course_location
,
grader
):
"""
...
...
@@ -137,7 +135,6 @@ class CourseGradingModel(object):
return
cutoffs
@staticmethod
def
update_grace_period_from_json
(
course_location
,
graceperiodjson
):
"""
...
...
@@ -210,8 +207,7 @@ class CourseGradingModel(object):
location
=
Location
(
location
)
descriptor
=
get_modulestore
(
location
)
.
get_item
(
location
)
return
{
"graderType"
:
descriptor
.
lms
.
format
if
descriptor
.
lms
.
format
is
not
None
else
'Not Graded'
,
return
{
"graderType"
:
descriptor
.
lms
.
format
if
descriptor
.
lms
.
format
is
not
None
else
'Not Graded'
,
"location"
:
location
,
"id"
:
99
# just an arbitrary value to
}
...
...
@@ -231,7 +227,6 @@ class CourseGradingModel(object):
get_modulestore
(
location
)
.
update_metadata
(
location
,
descriptor
.
_model_data
.
_kvs
.
_metadata
)
@staticmethod
def
convert_set_grace_period
(
descriptor
):
# 5 hours 59 minutes 59 seconds => converted to iso format
...
...
@@ -262,13 +257,12 @@ class CourseGradingModel(object):
@staticmethod
def
parse_grader
(
json_grader
):
# manual to clear out kruft
result
=
{
"type"
:
json_grader
[
"type"
],
"min_count"
:
int
(
json_grader
.
get
(
'min_count'
,
0
)),
"drop_count"
:
int
(
json_grader
.
get
(
'drop_count'
,
0
)),
"short_label"
:
json_grader
.
get
(
'short_label'
,
None
),
"weight"
:
float
(
json_grader
.
get
(
'weight'
,
0
))
/
100.0
}
result
=
{
"type"
:
json_grader
[
"type"
],
"min_count"
:
int
(
json_grader
.
get
(
'min_count'
,
0
)),
"drop_count"
:
int
(
json_grader
.
get
(
'drop_count'
,
0
)),
"short_label"
:
json_grader
.
get
(
'short_label'
,
None
),
"weight"
:
float
(
json_grader
.
get
(
'weight'
,
0
))
/
100.0
}
return
result
...
...
cms/djangoapps/models/settings/course_metadata.py
View file @
6d6b3a59
...
...
@@ -6,6 +6,7 @@ from xblock.core import Scope
from
xmodule.course_module
import
CourseDescriptor
import
copy
class
CourseMetadata
(
object
):
'''
For CRUD operations on metadata fields which do not have specific editors
...
...
@@ -13,8 +14,13 @@ class CourseMetadata(object):
The objects have no predefined attrs but instead are obj encodings of the
editable metadata.
'''
FILTERED_LIST
=
XModuleDescriptor
.
system_metadata_fields
+
[
'start'
,
'end'
,
'enrollment_start'
,
'enrollment_end'
,
'tabs'
,
'graceperiod'
,
'checklists'
]
FILTERED_LIST
=
XModuleDescriptor
.
system_metadata_fields
+
[
'start'
,
'end'
,
'enrollment_start'
,
'enrollment_end'
,
'tabs'
,
'graceperiod'
,
'checklists'
]
@classmethod
def
fetch
(
cls
,
course_location
):
...
...
@@ -48,7 +54,7 @@ class CourseMetadata(object):
descriptor
=
get_modulestore
(
course_location
)
.
get_item
(
course_location
)
dirty
=
False
#Copy the filtered list to avoid permanently changing the class attribute
filtered_list
=
copy
.
copy
(
cls
.
FILTERED_LIST
)
#Don't filter on the tab attribute if filter_tabs is False
...
...
@@ -71,7 +77,7 @@ class CourseMetadata(object):
if
dirty
:
get_modulestore
(
course_location
)
.
update_metadata
(
course_location
,
own_metadata
(
descriptor
))
own_metadata
(
descriptor
))
# Could just generate and return a course obj w/o doing any db reads,
# but I put the reads in as a means to confirm it persisted correctly
...
...
@@ -92,6 +98,6 @@ class CourseMetadata(object):
delattr
(
descriptor
.
lms
,
key
)
get_modulestore
(
course_location
)
.
update_metadata
(
course_location
,
own_metadata
(
descriptor
))
own_metadata
(
descriptor
))
return
cls
.
fetch
(
course_location
)
cms/envs/aws.py
View file @
6d6b3a59
...
...
@@ -67,4 +67,4 @@ MODULESTORE = AUTH_TOKENS['MODULESTORE']
CONTENTSTORE
=
AUTH_TOKENS
[
'CONTENTSTORE'
]
# Datadog for events!
DATADOG_API
=
AUTH_TOKENS
.
get
(
"DATADOG_API"
)
\ No newline at end of file
DATADOG_API
=
AUTH_TOKENS
.
get
(
"DATADOG_API"
)
cms/envs/common.py
View file @
6d6b3a59
...
...
@@ -167,7 +167,7 @@ STATICFILES_DIRS = [
PROJECT_ROOT
/
"static"
,
# This is how you would use the textbook images locally
#
("book", ENV_ROOT / "book_images")
# ("book", ENV_ROOT / "book_images")
]
# Locale/Internationalization
...
...
common/lib/xmodule/xmodule/contentstore/content.py
View file @
6d6b3a59
...
...
@@ -9,6 +9,7 @@ import StringIO
from
xmodule.modulestore
import
Location
from
.django
import
contentstore
# to install PIL on MacOSX: 'easy_install http://dist.repoze.org/PIL-1.1.6.tar.gz'
from
PIL
import
Image
...
...
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