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
700ddcb8
Commit
700ddcb8
authored
Jul 17, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store rss instead of parser in memcache.
parent
a99ae175
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
common/djangoapps/student/views.py
+10
-7
lms/templates/feed.rss
+1
-1
No files found.
common/djangoapps/student/views.py
View file @
700ddcb8
...
@@ -6,6 +6,7 @@ import string
...
@@ -6,6 +6,7 @@ import string
import
sys
import
sys
import
uuid
import
uuid
import
feedparser
import
feedparser
import
urllib
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth
import
logout
,
authenticate
,
login
from
django.contrib.auth
import
logout
,
authenticate
,
login
...
@@ -47,13 +48,15 @@ def csrf_token(context):
...
@@ -47,13 +48,15 @@ def csrf_token(context):
def
index
(
request
):
def
index
(
request
):
''' Redirects to main page -- info page if user authenticated, or marketing if not
''' Redirects to main page -- info page if user authenticated, or marketing if not
'''
'''
feed_data
=
settings
.
RSS_URL
if
hasattr
(
settings
,
'RSS_URL'
)
else
render_to_string
(
"feed.rss"
,
None
)
feed_data
=
cache
.
get
(
"students_index_rss_feed_data"
)
feed
=
cache
.
get
(
"students_index_rss_feed"
)
if
feed_data
==
None
:
if
hasattr
(
settings
,
'RSS_URL'
):
if
feed
==
None
:
feed_data
=
urllib
.
urlopen
(
settings
.
RSS_URL
)
.
read
()
feed
=
feedparser
.
parse
(
feed_data
)
else
:
cache
.
set
(
"students_index_rss_feed"
,
feed
,
settings
.
RSS_TIMEOUT
)
feed_data
=
render_to_string
(
"feed.rss"
,
None
)
cache
.
set
(
"students_index_rss_feed_data"
,
feed_data
,
settings
.
RSS_TIMEOUT
)
feed
=
feedparser
.
parse
(
feed_data
)
entries
=
feed
[
'entries'
][
0
:
3
]
entries
=
feed
[
'entries'
][
0
:
3
]
for
entry
in
entries
:
for
entry
in
entries
:
soup
=
BeautifulSoup
(
entry
.
description
)
soup
=
BeautifulSoup
(
entry
.
description
)
...
...
lms/templates/feed.rss
View file @
700ddcb8
<
%namespace name='static' file='static_content.html'/>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<
%namespace name='static' file='static_content.html'/>
<feed
xml:lang=
"en-US"
xmlns=
"http://www.w3.org/2005/Atom"
xmlns:media=
"http://search.yahoo.com/mrss/"
>
<feed
xml:lang=
"en-US"
xmlns=
"http://www.w3.org/2005/Atom"
xmlns:media=
"http://search.yahoo.com/mrss/"
>
<id>
tag:mitx.mit.edu,2012:/blog
</id>
<id>
tag:mitx.mit.edu,2012:/blog
</id>
<link
type=
"text/html"
rel=
"alternate"
href=
"http://mitx.mit.edu/blog"
/>
<link
type=
"text/html"
rel=
"alternate"
href=
"http://mitx.mit.edu/blog"
/>
...
...
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