From 9c8654b6746c97bdaf83ee17cec38aa4310cf751 Mon Sep 17 00:00:00 2001 From: Marcus -Chaosblog Date: Mon, 9 Jul 2012 22:19:10 +0200 Subject: [PATCH] User based option to switch off Twitter links add "twitter: no" to the specified user in bloggers.yml to turn off the Twitter link for this user. --- render.py | 1 + templates/users.tmpl | 6 +++++- templates/week.tmpl | 25 +++++++++++++++---------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/render.py b/render.py index 6489704..bd63966 100755 --- a/render.py +++ b/render.py @@ -90,6 +90,7 @@ def render_template(path, week=None, **kwargs): u.username = un u.name = rec['name'] u.links = rec['links'] + u.twitter = rec.get('twitter') u.start_de = datetime.datetime.strptime(rec['start'],"%Y/%m/%d").strftime("%d.%m.%Y") u.start = rec['start'] u.end = rec.get('end') diff --git a/templates/users.tmpl b/templates/users.tmpl index acbcaf1..2d577d1 100644 --- a/templates/users.tmpl +++ b/templates/users.tmpl @@ -8,7 +8,11 @@ % for u in sorted(userlist, key=lambda u:u.username): ${u.name} - @${u.username} + + % if u.twitter != False: + @${u.username} + % endif + % if u.links: % for a in u.links: diff --git a/templates/week.tmpl b/templates/week.tmpl index 59fe0c1..dfb199e 100644 --- a/templates/week.tmpl +++ b/templates/week.tmpl @@ -2,7 +2,11 @@ Results for week beginning ${week_start.strftime("%F")}

Who posted:

% for u in sorted(good, key=lambda u:u.username): -
${u.name} - @${u.username}:
+
${u.name} \ + % if u.twitter != False: + @${u.username} \ + % endif + :
    % for p in u.weeks[week]: @@ -16,7 +20,11 @@ Results for week beginning ${week_start.strftime("%F")}

    Slackers:

      % for u in sorted(lame, key=lambda u:u.username): -
    • ${u.name} - @${u.username}
    • +
    • ${u.name} \ + % if u.twitter != False: + @${u.username} \ + % endif +
    • % endfor
    @@ -33,7 +41,11 @@ Results for week beginning ${week_start.strftime("%F")}

    Who haven't started yet:

      % for u in sorted(skip, key=lambda u:u.username): -
    • ${u.name} - @${u.username}
    • +
    • ${u.name} \ + % if u.twitter != False: + - @${u.username} \ + % endif +
    • % endfor
    % endif @@ -63,10 +75,3 @@ Results for week beginning ${week_start.strftime("%F")} %endif - -

    Previously Punted (pay €30 to return):

    -
      -% for (u) in sorted(punted, key=lambda p:p.username): -
    • ${u.username} (${u.end})
    • -% endfor -
    \ No newline at end of file