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
8d790784
Commit
8d790784
authored
Nov 16, 2012
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a typo, and indent instead of comment for dead code, so I can read it.
parent
ff407c4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
24 deletions
+25
-24
common/lib/xmodule/xmodule/course_module.py
+25
-24
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
8d790784
...
...
@@ -132,34 +132,35 @@ class Reschedule(Policy):
]
settings
=
dict
(
tree
.
settings
)
if
'start_date'
in
policy
:
if
'start_date'
in
settings
:
settings
[
'start_date'
]
=
settings
[
'start_date'
]
+
delta
return
tree
.
_replace
(
settings
=
settings
,
children
=
children
)
# class AppendModule(QueryPolicy):
# """
# This module will append a policy after each module matching the query.
# Any keys in policy_to_copy will be copied from the usage node that
# matches the query.
# """
# def __init__(self, query, source, policy_to_copy=None, *args, **kwargs):
# super(AppendModule, self).__init__(query, *args, **kwargs)
# self.policy_to_copy = policy_to_copy if policy_to_copy is not None else []
# self.source = source
# def update(usage):
# """
# Return a list of usages to replace the returned usage with
# """
# to_insert = Usage.create_usage(self.source)
# policy = dict(to_insert.policy)
# for key in self.policy_to_copy:
# if key in usage:
# policy[key] = usage[key]
# return [usage, to_insert._replace(policy=policy)]
if
0
:
class
AppendModule
(
QueryPolicy
):
"""
This module will append a policy after each module matching the query.
Any keys in policy_to_copy will be copied from the usage node that
matches the query.
"""
def
__init__
(
self
,
query
,
source
,
policy_to_copy
=
None
,
*
args
,
**
kwargs
):
super
(
AppendModule
,
self
)
.
__init__
(
query
,
*
args
,
**
kwargs
)
self
.
policy_to_copy
=
policy_to_copy
if
policy_to_copy
is
not
None
else
[]
self
.
source
=
source
def
update
(
usage
):
"""
Return a list of usages to replace the returned usage with
"""
to_insert
=
Usage
.
create_usage
(
self
.
source
)
policy
=
dict
(
to_insert
.
policy
)
for
key
in
self
.
policy_to_copy
:
if
key
in
usage
:
policy
[
key
]
=
usage
[
key
]
return
[
usage
,
to_insert
.
_replace
(
policy
=
policy
)]
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