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
3b36fbf9
Commit
3b36fbf9
authored
Aug 16, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move mitxmako out of common lib, and pass template rendering function into MongoModuleStore
parent
73623ed9
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
27 additions
and
18 deletions
+27
-18
cms/envs/dev.py
+1
-0
cms/envs/test.py
+1
-0
common/djangoapps/mitxmako/README
+0
-0
common/djangoapps/mitxmako/__init__.py
+0
-0
common/djangoapps/mitxmako/makoloader.py
+0
-0
common/djangoapps/mitxmako/middleware.py
+0
-0
common/djangoapps/mitxmako/shortcuts.py
+0
-0
common/djangoapps/mitxmako/template.py
+0
-0
common/djangoapps/mitxmako/templatetag_helpers.py
+0
-0
common/lib/mitxmako/setup.py
+0
-8
common/lib/xmodule/setup.py
+0
-1
common/lib/xmodule/xmodule/modulestore/django.py
+17
-4
common/lib/xmodule/xmodule/modulestore/mongo.py
+4
-3
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
+2
-1
lms/djangoapps/courseware/tests/tests.py
+1
-0
lms/envs/dev_mongo.py
+1
-0
repo-requirements.txt
+0
-1
No files found.
cms/envs/dev.py
View file @
3b36fbf9
...
...
@@ -24,6 +24,7 @@ MODULESTORE = {
'db'
:
'xmodule'
,
'collection'
:
'modulestore'
,
'fs_root'
:
GITHUB_REPO_ROOT
,
'render_template'
:
'mitxmako.shortcuts.render_to_string'
,
}
}
}
...
...
cms/envs/test.py
View file @
3b36fbf9
...
...
@@ -47,6 +47,7 @@ MODULESTORE = {
'db'
:
'test_xmodule'
,
'collection'
:
'modulestore'
,
'fs_root'
:
GITHUB_REPO_ROOT
,
'render_template'
:
'mitxmako.shortcuts.render_to_string'
,
}
}
}
...
...
common/
lib
/mitxmako/README
→
common/
djangoapps
/mitxmako/README
View file @
3b36fbf9
File moved
common/
lib/mitxmako
/mitxmako/__init__.py
→
common/
djangoapps
/mitxmako/__init__.py
View file @
3b36fbf9
File moved
common/
lib/mitxmako
/mitxmako/makoloader.py
→
common/
djangoapps
/mitxmako/makoloader.py
View file @
3b36fbf9
File moved
common/
lib/mitxmako
/mitxmako/middleware.py
→
common/
djangoapps
/mitxmako/middleware.py
View file @
3b36fbf9
File moved
common/
lib/mitxmako
/mitxmako/shortcuts.py
→
common/
djangoapps
/mitxmako/shortcuts.py
View file @
3b36fbf9
File moved
common/
lib/mitxmako
/mitxmako/template.py
→
common/
djangoapps
/mitxmako/template.py
View file @
3b36fbf9
File moved
common/
lib/mitxmako
/mitxmako/templatetag_helpers.py
→
common/
djangoapps
/mitxmako/templatetag_helpers.py
View file @
3b36fbf9
File moved
common/lib/mitxmako/setup.py
deleted
100644 → 0
View file @
73623ed9
from
setuptools
import
setup
,
find_packages
setup
(
name
=
"mitxmako"
,
version
=
"0.1"
,
packages
=
find_packages
(
exclude
=
[
"tests"
]),
install_requires
=
[
'distribute'
],
)
common/lib/xmodule/setup.py
View file @
3b36fbf9
...
...
@@ -10,7 +10,6 @@ setup(
},
requires
=
[
'capa'
,
'mitxmako'
],
# See http://guide.python-distribute.org/creation.html#entry-points
...
...
common/lib/xmodule/xmodule/modulestore/django.py
View file @
3b36fbf9
...
...
@@ -12,15 +12,28 @@ from django.conf import settings
_MODULESTORES
=
{}
FUNCTION_KEYS
=
[
'render_template'
]
def
load_function
(
path
):
module_path
,
_
,
name
=
path
.
rpartition
(
'.'
)
return
getattr
(
import_module
(
module_path
),
name
)
def
modulestore
(
name
=
'default'
):
global
_MODULESTORES
if
name
not
in
_MODULESTORES
:
class_path
=
settings
.
MODULESTORE
[
name
][
'ENGINE'
]
module_path
,
_
,
class_name
=
class_path
.
rpartition
(
'.'
)
class_
=
getattr
(
import_module
(
module_path
),
class_name
)
class_
=
load_function
(
settings
.
MODULESTORE
[
name
][
'ENGINE'
])
options
=
{}
options
.
update
(
settings
.
MODULESTORE
[
name
][
'OPTIONS'
])
for
key
in
FUNCTION_KEYS
:
if
key
in
options
:
options
[
key
]
=
load_function
(
options
[
key
])
_MODULESTORES
[
name
]
=
class_
(
**
settings
.
MODULESTORE
[
name
][
'OPTIONS'
])
**
options
)
return
_MODULESTORES
[
name
]
common/lib/xmodule/xmodule/modulestore/mongo.py
View file @
3b36fbf9
...
...
@@ -9,7 +9,6 @@ from importlib import import_module
from
xmodule.errortracker
import
null_error_tracker
from
xmodule.x_module
import
XModuleDescriptor
from
xmodule.mako_module
import
MakoDescriptorSystem
from
mitxmako.shortcuts
import
render_to_string
from
.
import
ModuleStoreBase
,
Location
from
.exceptions
import
(
ItemNotFoundError
,
...
...
@@ -82,7 +81,8 @@ class MongoModuleStore(ModuleStoreBase):
"""
# TODO (cpennington): Enable non-filesystem filestores
def
__init__
(
self
,
host
,
db
,
collection
,
fs_root
,
port
=
27017
,
default_class
=
None
,
def
__init__
(
self
,
host
,
db
,
collection
,
fs_root
,
render_template
,
port
=
27017
,
default_class
=
None
,
error_tracker
=
null_error_tracker
):
ModuleStoreBase
.
__init__
(
self
)
...
...
@@ -108,6 +108,7 @@ class MongoModuleStore(ModuleStoreBase):
self
.
default_class
=
None
self
.
fs_root
=
path
(
fs_root
)
self
.
error_tracker
=
error_tracker
self
.
render_template
=
render_template
def
_clean_item_data
(
self
,
item
):
"""
...
...
@@ -160,7 +161,7 @@ class MongoModuleStore(ModuleStoreBase):
self
.
default_class
,
resource_fs
,
self
.
error_tracker
,
render_to_string
,
self
.
render_template
,
)
return
system
.
load_item
(
item
[
'location'
])
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
View file @
3b36fbf9
...
...
@@ -26,6 +26,7 @@ DB = 'test'
COLLECTION
=
'modulestore'
FS_ROOT
=
DATA_DIR
# TODO (vshnayder): will need a real fs_root for testing load_item
DEFAULT_CLASS
=
'xmodule.raw_module.RawDescriptor'
RENDER_TEMPLATE
=
lambda
t_n
,
d
,
ctx
=
None
,
nsp
=
'main'
:
''
class
TestMongoModuleStore
(
object
):
...
...
@@ -48,7 +49,7 @@ class TestMongoModuleStore(object):
@staticmethod
def
initdb
():
# connect to the db
store
=
MongoModuleStore
(
HOST
,
DB
,
COLLECTION
,
FS_ROOT
,
default_class
=
DEFAULT_CLASS
)
store
=
MongoModuleStore
(
HOST
,
DB
,
COLLECTION
,
FS_ROOT
,
RENDER_TEMPLATE
,
default_class
=
DEFAULT_CLASS
)
# Explicitly list the courses to load (don't want the big one)
courses
=
[
'toy'
,
'simple'
]
import_from_xml
(
store
,
DATA_DIR
,
courses
)
...
...
lms/djangoapps/courseware/tests/tests.py
View file @
3b36fbf9
...
...
@@ -56,6 +56,7 @@ def mongo_store_config(data_dir):
'db'
:
'xmodule'
,
'collection'
:
'modulestore'
,
'fs_root'
:
data_dir
,
'render_template'
:
'mitxmako.shortcuts.render_to_string'
,
}
}
}
...
...
lms/envs/dev_mongo.py
View file @
3b36fbf9
...
...
@@ -14,6 +14,7 @@ MODULESTORE = {
'db'
:
'xmodule'
,
'collection'
:
'modulestore'
,
'fs_root'
:
GITHUB_REPO_ROOT
,
'render_template'
:
'mitxmako.shortcuts.render_to_string'
,
}
}
}
repo-requirements.txt
View file @
3b36fbf9
-e common/lib/capa
-e common/lib/mitxmako
-e common/lib/xmodule
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