Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
radiopanik
panikweb
Commits
607b44cb
Commit
607b44cb
authored
Sep 01, 2013
by
fred
Browse files
fix datetime formatting in rss feed
parent
7741a377
Changes
2
Hide whitespace changes
Inline
Side-by-side
panikweb/paniktags/templatetags/paniktags.py
View file @
607b44cb
import
email.utils
import
datetime
import
re
import
time
import
urllib2
import
uuid
...
...
@@ -185,3 +188,10 @@ class FormatSearchResultNode(template.Node):
@
register
.
inclusion_tag
(
'includes/piwik.html'
)
def
piwik
():
return
{
'enabled'
:
settings
.
ENABLE_PIWIK
}
@
register
.
filter
def
rfc822
(
datetime
):
if
datetime
is
None
:
return
''
return
email
.
utils
.
formatdate
(
time
.
mktime
(
datetime
.
timetuple
()))
panikweb_templates/templates/podcasts.html
View file @
607b44cb
{% load soundfiles %}
<?xml version="1.0" encoding="UTF-8"?>
{% load paniktags %}
{% load soundfiles %}
<?xml version="1.0" encoding="UTF-8"?>
<rss
version=
"2.0"
xmlns:dc=
"http://purl.org/dc/elements/1.1/"
xmlns:content=
"http://purl.org/rss/1.0/modules/content/"
...
...
@@ -7,15 +7,15 @@
<title>
Radio Panik{% if title %} - {{ title }}{% endif %}
</title>
<link>
{{ base_url }}
</link>
<description></description>
<lastBuildDate>
{{ soundfiles.0.creation_timestamp|
date:"r"
}}
</lastBuildDate>
<lastBuildDate>
{{ soundfiles.0.creation_timestamp|
rfc822
}}
</lastBuildDate>
{% for soundfile in soundfiles|slice:":20" %}
<item>
<title>
{% if soundfile.fragment %}{{ soundfile.title }} - {% endif %}{{ soundfile.episode.title }}
</title>
<link>
{{ base_url }}{% url 'episode-view' slug=soundfile.episode.slug emission_slug=soundfile.episode.emission.slug %}
</link>
<description>
{{ soundfile.episode.text|striptags }}
</description>
<enclosure
url=
"{{ base_url }}{{ soundfile|format_url:'mp3' }}"
type=
"audio/mpeg"
/>
<guid>
{{ soundfile.episode.get_absolute_url }}
-
{{ soundfile.id }}
</guid>
<pubDate>
{{ soundfile.episode.creation_timestamp|
date:"r"
}} GMT
</pubDate>
<guid>
{{
base_url }}{{
soundfile.episode.get_absolute_url }}
#
{{ soundfile.id }}
</guid>
<pubDate>
{{ soundfile.episode.creation_timestamp|
rfc822
}} GMT
</pubDate>
</item>
{% endfor %}
</channel>
...
...
Write
Preview
Supports
Markdown
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