Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the service http://gravatar.com avatar image. #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion planet/spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
re_slash = re.compile(r'[?/:|]+')
re_initial_cruft = re.compile(r'^[,.]*')
re_final_cruft = re.compile(r'[,.]*$')
re_email = '^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3\})(\\]?)$'

index = True

Expand Down Expand Up @@ -161,7 +162,10 @@ def writeCache(feed_uri, feed_info, data):
data.feed.links.append(feedparser.FeedParserDict(
{'rel':'self', 'type':feedtype, 'href':feed_uri}))
for name, value in config.feed_options(feed_uri).items():
data.feed['planet_'+name] = value
if name == "gravatar" and re.match(re_email, value):
data.feed['planet_'+name] = md5(value.strip()).hexdigest()
else:
data.feed['planet_'+name] = value

# perform user configured scrub operations on the data
scrub.scrub(feed_uri, data)
Expand Down
4 changes: 4 additions & 0 deletions themes/classic_fancy/index.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@
### variables, but makes them available to us anyway.

<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title_plain ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
<TMPL_IF channel_gravatar>
<img class="face" src="http://gravatar.com/avatar/<TMPL_VAR channel_gravatar ESCAPE="HTML">" alt="">
<TMPL_ELSE>
<TMPL_IF channel_face>
<img class="face" src="images/<TMPL_VAR channel_face ESCAPE="HTML">" width="<TMPL_VAR channel_facewidth ESCAPE="HTML">" height="<TMPL_VAR channel_faceheight ESCAPE="HTML">" alt="">
</TMPL_IF>
</TMPL_IF>
</TMPL_IF>


<div class="entrygroup" id="<TMPL_VAR id>"<TMPL_IF channel_language> lang="<TMPL_VAR channel_language>"</TMPL_IF>>
Expand Down