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
bbf508ca
Commit
bbf508ca
authored
Sep 13, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix-setattr-and-getattr
parent
b1a76f12
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
10 deletions
+10
-10
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+2
-2
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+1
-1
common/lib/xmodule/xmodule/modulestore/xml.py
+1
-1
common/lib/xmodule/xmodule/tests/test_conditional_logic.py
+1
-1
common/lib/xmodule/xmodule/x_module.py
+1
-1
lms/djangoapps/instructor/views/legacy.py
+2
-2
lms/djangoapps/lms_migration/migrate.py
+2
-2
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
bbf508ca
...
@@ -605,8 +605,8 @@ class MongoModuleStore(ModuleStoreBase):
...
@@ -605,8 +605,8 @@ class MongoModuleStore(ModuleStoreBase):
)
)
xblock_class
=
XModuleDescriptor
.
load_class
(
location
.
category
,
self
.
default_class
)
xblock_class
=
XModuleDescriptor
.
load_class
(
location
.
category
,
self
.
default_class
)
if
definition_data
is
None
:
if
definition_data
is
None
:
if
hasattr
(
xblock_class
,
'data'
)
and
getattr
(
xblock_class
,
'data'
)
.
default
is
not
None
:
if
hasattr
(
xblock_class
,
'data'
)
and
xblock_class
.
data
.
default
is
not
None
:
definition_data
=
getattr
(
xblock_class
,
'data'
)
.
default
definition_data
=
xblock_class
.
data
.
default
else
:
else
:
definition_data
=
{}
definition_data
=
{}
dbmodel
=
self
.
_create_new_field_data
(
location
.
category
,
location
,
definition_data
,
metadata
)
dbmodel
=
self
.
_create_new_field_data
(
location
.
category
,
location
,
definition_data
,
metadata
)
...
...
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
View file @
bbf508ca
...
@@ -41,7 +41,7 @@ def wrap_draft(item):
...
@@ -41,7 +41,7 @@ def wrap_draft(item):
draft, and `False` otherwise. Sets the item's location to the
draft, and `False` otherwise. Sets the item's location to the
non-draft location in either case
non-draft location in either case
"""
"""
setattr
(
item
,
'is_draft'
,
item
.
location
.
revision
==
DRAFT
)
item
.
is_draft
=
(
item
.
location
.
revision
==
DRAFT
)
item
.
scope_ids
=
item
.
scope_ids
.
_replace
(
usage_id
=
item
.
location
.
replace
(
revision
=
None
))
item
.
scope_ids
=
item
.
scope_ids
.
_replace
(
usage_id
=
item
.
location
.
replace
(
revision
=
None
))
return
item
return
item
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
bbf508ca
...
@@ -190,7 +190,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
...
@@ -190,7 +190,7 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
err_msg
err_msg
)
)
setattr
(
descriptor
,
'data_dir'
,
course_dir
)
descriptor
.
data_dir
=
course_dir
xmlstore
.
modules
[
course_id
][
descriptor
.
location
]
=
descriptor
xmlstore
.
modules
[
course_id
][
descriptor
.
location
]
=
descriptor
...
...
common/lib/xmodule/xmodule/tests/test_conditional_logic.py
View file @
bbf508ca
...
@@ -13,7 +13,7 @@ class ConditionalModuleTest(LogicTest):
...
@@ -13,7 +13,7 @@ class ConditionalModuleTest(LogicTest):
"Make shure that ajax request works correctly"
"Make shure that ajax request works correctly"
# Mock is_condition_satisfied
# Mock is_condition_satisfied
self
.
xmodule
.
is_condition_satisfied
=
lambda
:
True
self
.
xmodule
.
is_condition_satisfied
=
lambda
:
True
se
tattr
(
self
.
xmodule
.
descriptor
,
'get_children'
,
lambda
:
[])
se
lf
.
xmodule
.
descriptor
.
get_children
=
lambda
:
[]
response
=
self
.
ajax_request
(
'No'
,
{})
response
=
self
.
ajax_request
(
'No'
,
{})
html
=
response
[
'html'
]
html
=
response
[
'html'
]
...
...
common/lib/xmodule/xmodule/x_module.py
View file @
bbf508ca
...
@@ -342,7 +342,7 @@ class ResourceTemplates(object):
...
@@ -342,7 +342,7 @@ class ResourceTemplates(object):
@classmethod
@classmethod
def
get_template_dir
(
cls
):
def
get_template_dir
(
cls
):
if
getattr
(
cls
,
'template_dir_name'
,
None
):
if
getattr
(
cls
,
'template_dir_name'
,
None
):
dirname
=
os
.
path
.
join
(
'templates'
,
getattr
(
cls
,
'template_dir_name'
)
)
dirname
=
os
.
path
.
join
(
'templates'
,
cls
.
template_dir_name
)
if
not
resource_isdir
(
__name__
,
dirname
):
if
not
resource_isdir
(
__name__
,
dirname
):
log
.
warning
(
"No resource directory {dir} found when loading {cls_name} templates"
.
format
(
log
.
warning
(
"No resource directory {dir} found when loading {cls_name} templates"
.
format
(
dir
=
dirname
,
dir
=
dirname
,
...
...
lms/djangoapps/instructor/views/legacy.py
View file @
bbf508ca
...
@@ -208,7 +208,7 @@ def instructor_dashboard(request, course_id):
...
@@ -208,7 +208,7 @@ def instructor_dashboard(request, course_id):
if
settings
.
MITX_FEATURES
[
'ENABLE_MANUAL_GIT_RELOAD'
]:
if
settings
.
MITX_FEATURES
[
'ENABLE_MANUAL_GIT_RELOAD'
]:
if
'GIT pull'
in
action
:
if
'GIT pull'
in
action
:
data_dir
=
getattr
(
course
,
'data_dir'
)
data_dir
=
course
.
data_dir
log
.
debug
(
'git pull {0}'
.
format
(
data_dir
))
log
.
debug
(
'git pull {0}'
.
format
(
data_dir
))
gdir
=
settings
.
DATA_DIR
/
data_dir
gdir
=
settings
.
DATA_DIR
/
data_dir
if
not
os
.
path
.
exists
(
gdir
):
if
not
os
.
path
.
exists
(
gdir
):
...
@@ -222,7 +222,7 @@ def instructor_dashboard(request, course_id):
...
@@ -222,7 +222,7 @@ def instructor_dashboard(request, course_id):
if
'Reload course'
in
action
:
if
'Reload course'
in
action
:
log
.
debug
(
'reloading {0} ({1})'
.
format
(
course_id
,
course
))
log
.
debug
(
'reloading {0} ({1})'
.
format
(
course_id
,
course
))
try
:
try
:
data_dir
=
getattr
(
course
,
'data_dir'
)
data_dir
=
course
.
data_dir
modulestore
()
.
try_load_course
(
data_dir
)
modulestore
()
.
try_load_course
(
data_dir
)
msg
+=
"<br/><p>Course reloaded from {0}</p>"
.
format
(
data_dir
)
msg
+=
"<br/><p>Course reloaded from {0}</p>"
.
format
(
data_dir
)
track
.
views
.
server_track
(
request
,
"reload"
,
{
"directory"
:
data_dir
},
page
=
"idashboard"
)
track
.
views
.
server_track
(
request
,
"reload"
,
{
"directory"
:
data_dir
},
page
=
"idashboard"
)
...
...
lms/djangoapps/lms_migration/migrate.py
View file @
bbf508ca
...
@@ -45,8 +45,8 @@ def get_commit_id(course):
...
@@ -45,8 +45,8 @@ def get_commit_id(course):
def
set_commit_id
(
course
,
commit_id
):
def
set_commit_id
(
course
,
commit_id
):
#course.metadata['GIT_COMMIT_ID'] = commit_id
#course.metadata['GIT_COMMIT_ID'] = commit_id
setattr
(
course
,
'GIT_COMMIT_ID'
,
commit_id
)
course
.
GIT_COMMIT_ID
=
commit_id
#
setattr(def_ms.courses[reload_dir], 'GIT_COMMIT_ID', new_commit_id)
#
def_ms.courses[reload_dir].GIT_COMMIT_ID = new_commit_id
def
manage_modulestores
(
request
,
reload_dir
=
None
,
commit_id
=
None
):
def
manage_modulestores
(
request
,
reload_dir
=
None
,
commit_id
=
None
):
...
...
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