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
171e16f1
Commit
171e16f1
authored
Jul 17, 2012
by
Matthew Mongeau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use local feed as default
parent
2bfe0cb9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
13 deletions
+38
-13
common/djangoapps/student/views.py
+11
-11
lms/envs/common.py
+1
-1
lms/templates/feed.rss
+25
-0
lms/templates/index.html
+1
-1
No files found.
common/djangoapps/student/views.py
View file @
171e16f1
...
...
@@ -47,17 +47,17 @@ def csrf_token(context):
def
index
(
request
):
''' Redirects to main page -- info page if user authenticated, or marketing if not
'''
entries
=
None
if
settings
.
RSS_URL
:
feed
=
cache
.
get
(
"students_index_rss_feed"
)
if
feed
==
None
:
feed
=
feedparser
.
parse
(
settings
.
RSS_URL
)
cache
.
set
(
"students_index_rss_feed"
,
feed
,
settings
.
RSS_TIMEOUT
)
entries
=
feed
[
'entries'
][
0
:
3
]
for
entry
in
entries
:
soup
=
BeautifulSoup
(
entry
.
description
)
if
soup
.
img
:
entry
.
image
=
soup
.
img
[
'src'
]
feed_data
=
settings
.
RSS_URL
if
hasattr
(
settings
,
'RSS_URL'
)
else
render_to_string
(
"feed.rss"
,
None
)
feed
=
cache
.
get
(
"students_index_rss_feed"
)
if
feed
==
None
:
feed
=
feedparser
.
parse
(
feed_data
)
cache
.
set
(
"students_index_rss_feed"
,
feed
,
settings
.
RSS_TIMEOUT
)
entries
=
feed
[
'entries'
][
0
:
3
]
for
entry
in
entries
:
soup
=
BeautifulSoup
(
entry
.
description
)
entry
.
image
=
soup
.
img
[
'src'
]
if
soup
.
img
else
None
if
settings
.
COURSEWARE_ENABLED
and
request
.
user
.
is_authenticated
():
return
redirect
(
reverse
(
'dashboard'
))
...
...
lms/envs/common.py
View file @
171e16f1
...
...
@@ -104,7 +104,7 @@ LIB_URL = '/static/js/'
# Dev machines shouldn't need the book
# BOOK_URL = '/static/book/'
BOOK_URL
=
'https://mitxstatic.s3.amazonaws.com/book_images/'
# For AWS deploys
RSS_URL
=
'https://github.com/blog.atom
'
# RSS_URL = r'lms/templates/feed.rss
'
RSS_TIMEOUT
=
600
# Configuration option for when we want to grab server error pages
...
...
lms/templates/feed.rss
0 → 100644
View file @
171e16f1
<
%namespace name='static' file='static_content.html'/>
<?xml version="1.0" encoding="UTF-8"?>
<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>
<link
type=
"text/html"
rel=
"alternate"
href=
"http://mitx.mit.edu/blog"
/>
<link
type=
"application/atom+xml"
rel=
"self"
href=
"https://github.com/blog.atom"
/>
<title>
The GitHub Blog
</title>
<updated>
2012-07-16T14:08:12-07:00
</updated>
<entry>
<id>
tag:mitx.mit.edu,2012:Post/3
</id>
<published>
2012-07-16T14:08:12-07:00
</published>
<updated>
2012-07-16T14:08:12-07:00
</updated>
<link
type=
"text/html"
rel=
"alternate"
href=
"#"
/>
<title>
Online Classes Cut Costs, But Do They Dilute Brands?
</title>
<content
type=
"html"
>
<
img src=
"
${static.url('images/courses/space1.jpg')}
"
/
>
A Description
</content>
</entry>
<entry>
<id>
tag:mitx.mit.edu,2012:Post/3
</id>
<published>
2012-07-16T14:08:12-07:00
</published>
<updated>
2012-07-16T14:08:12-07:00
</updated>
<link
type=
"text/html"
rel=
"alternate"
href=
"#"
/>
<title>
Online Classes Cut Costs, But Do They Dilute Brands?
</title>
<content
type=
"html"
>
A Description
</content>
</entry>
</feed>
lms/templates/index.html
View file @
171e16f1
...
...
@@ -94,7 +94,7 @@
<section
class=
"blog-posts"
>
%for entry in entries:
<article>
%if
hasattr(entry, 'image')
:
%if
entry.image
:
<a
href=
"${entry.link}"
class=
"post-graphics"
>
<img
src=
"${entry.image}"
/>
</a>
...
...
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