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
ab0b7910
Commit
ab0b7910
authored
Feb 24, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added caching for processed course.xml
--HG-- branch : dormsbee_performance
parent
6ad93db8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
courseware/content_parser.py
+13
-4
No files found.
courseware/content_parser.py
View file @
ab0b7910
...
...
@@ -170,15 +170,24 @@ def course_xml_process(tree):
def
course_file
(
user
):
''' Given a user, return course.xml
'''
# TODO: Cache.
# TODO: Cache.
filename
=
user
.
profile_cache
.
courseware
# UserProfile.objects.get(user=user).courseware
groups
=
user_groups
(
user
)
options
=
{
'dev_content'
:
settings
.
DEV_CONTENT
,
'groups'
:
groups
}
tree
=
course_xml_process
(
etree
.
XML
(
render_to_string
(
filename
,
options
,
namespace
=
'course'
)))
cache_key
=
filename
+
"_processed?dev_content:"
+
str
(
options
[
'dev_content'
])
+
"&groups:"
+
str
(
sorted
(
groups
))
tree_string
=
cache
.
get
(
cache_key
)
if
not
tree_string
:
tree
=
course_xml_process
(
etree
.
XML
(
render_to_string
(
filename
,
options
,
namespace
=
'course'
)))
tree_string
=
etree
.
tostring
(
tree
)
cache
.
set
(
cache_key
,
tree_string
,
60
)
else
:
tree
=
etree
.
XML
(
tree_string
)
return
tree
def
section_file
(
user
,
section
):
...
...
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