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
756dc978
Commit
756dc978
authored
May 12, 2012
by
Piotr Mitros
Committed by
pmitros
May 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved grading code from init to grades.py to fix existing scripts
parent
095043ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
63 deletions
+61
-63
djangoapps/courseware/__init__.py
+0
-60
djangoapps/courseware/grades.py
+61
-3
No files found.
djangoapps/courseware/__init__.py
View file @
756dc978
"""
Course settings module. The settings are based of django.conf. All settings in
courseware.global_course_settings are first applied, and then any settings
in the settings.DATA_DIR/course_settings.py are applied. A setting must be
in ALL_CAPS.
Settings are used by calling
from courseware import course_settings
Note that courseware.course_settings is not a module -- it's an object. So
importing individual settings is not possible:
from courseware.course_settings import GRADER # This won't work.
"""
import
imp
import
logging
import
sys
import
types
from
django.conf
import
settings
from
courseware
import
global_course_settings
from
courseware
import
graders
_log
=
logging
.
getLogger
(
"mitx.courseware"
)
class
Settings
(
object
):
def
__init__
(
self
):
# update this dict from global settings (but only for ALL_CAPS settings)
for
setting
in
dir
(
global_course_settings
):
if
setting
==
setting
.
upper
():
setattr
(
self
,
setting
,
getattr
(
global_course_settings
,
setting
))
data_dir
=
settings
.
DATA_DIR
fp
=
None
try
:
fp
,
pathname
,
description
=
imp
.
find_module
(
"course_settings"
,
[
data_dir
])
mod
=
imp
.
load_module
(
"course_settings"
,
fp
,
pathname
,
description
)
except
Exception
as
e
:
_log
.
exception
(
"Unable to import course settings file from "
+
data_dir
+
". Error: "
+
str
(
e
))
mod
=
types
.
ModuleType
(
'course_settings'
)
finally
:
if
fp
:
fp
.
close
()
for
setting
in
dir
(
mod
):
if
setting
==
setting
.
upper
():
setting_value
=
getattr
(
mod
,
setting
)
setattr
(
self
,
setting
,
setting_value
)
# Here is where we should parse any configurations, so that we can fail early
self
.
GRADER
=
graders
.
grader_from_conf
(
self
.
GRADER
)
course_settings
=
Settings
()
\ No newline at end of file
djangoapps/courseware/grades.py
View file @
756dc978
"""
Course settings module. The settings are based of django.conf. All settings in
courseware.global_course_settings are first applied, and then any settings
in the settings.DATA_DIR/course_settings.py are applied. A setting must be
in ALL_CAPS.
Settings are used by calling
from courseware import course_settings
Note that courseware.course_settings is not a module -- it's an object. So
importing individual settings is not possible:
from courseware.course_settings import GRADER # This won't work.
"""
from
lxml
import
etree
import
random
import
imp
import
logging
import
sys
import
types
from
django.conf
import
settings
from
courseware
import
course_settings
import
courseware.content_parser
as
content_parser
from
courseware
import
global_
course_settings
from
courseware
import
graders
from
courseware.graders
import
Score
import
courseware.modules
from
models
import
StudentModule
import
courseware.content_parser
as
content_parser
import
courseware.modules
_log
=
logging
.
getLogger
(
"mitx.courseware"
)
class
Settings
(
object
):
def
__init__
(
self
):
# update this dict from global settings (but only for ALL_CAPS settings)
for
setting
in
dir
(
global_course_settings
):
if
setting
==
setting
.
upper
():
setattr
(
self
,
setting
,
getattr
(
global_course_settings
,
setting
))
data_dir
=
settings
.
DATA_DIR
fp
=
None
try
:
fp
,
pathname
,
description
=
imp
.
find_module
(
"course_settings"
,
[
data_dir
])
mod
=
imp
.
load_module
(
"course_settings"
,
fp
,
pathname
,
description
)
except
Exception
as
e
:
_log
.
exception
(
"Unable to import course settings file from "
+
data_dir
+
". Error: "
+
str
(
e
))
mod
=
types
.
ModuleType
(
'course_settings'
)
finally
:
if
fp
:
fp
.
close
()
for
setting
in
dir
(
mod
):
if
setting
==
setting
.
upper
():
setting_value
=
getattr
(
mod
,
setting
)
setattr
(
self
,
setting
,
setting_value
)
# Here is where we should parse any configurations, so that we can fail early
self
.
GRADER
=
graders
.
grader_from_conf
(
self
.
GRADER
)
course_settings
=
Settings
()
def
grade_sheet
(
student
):
"""
...
...
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