From: Matthijs Kooijman Date: Mon, 15 Jun 2009 10:01:42 +0000 (+0200) Subject: Merge branch 'production' X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=884bf66b55546555bfd3df318b9318e8358b02cf;hp=381c81a8ffac8c4b3abf6a762d031a7e261e8eaa;p=matthijs%2Fprojects%2Fxerxes.git Merge branch 'production' * production: Remove SQL password from import.py. Add code to support disabling new influences. Remove \r's. Only notify a player of finished influence changes. --- diff --git a/import.py b/import.py index 58205ac..4d97d74 100644 --- a/import.py +++ b/import.py @@ -11,7 +11,7 @@ from datetime import datetime conn = MySQLdb.connect( user = 'ee_inschrijving', - passwd = '3c6b362d17aa96d132544fb63f7c8b74', + passwd = '', db = 'ee_inschrijving', charset = 'latin1', ) diff --git a/influences/notify.py b/influences/notify.py index d53ab36..6aae6f2 100644 --- a/influences/notify.py +++ b/influences/notify.py @@ -20,7 +20,9 @@ def influence_saved(**kwargs): recipients = ['lextalionis@evolution-events.nl'] recipients.extend(instance.related_players.keys()) if (not settings.DEBUG): - # TODO: Perhaps only notify when the status is / becomes Done? + recipients = ['lextalionis@evolution-events.nl'] + if instance.status == 'D': + recipients.append(instance.character.player) notify(recipients, 'influences/email/influence_changed.html', {'influence' : instance, 'created' : created}) signals.post_save.connect(influence_saved, sender=Influence) diff --git a/templates/base/offline.html b/templates/base/offline.html new file mode 100644 index 0000000..7f51b4e --- /dev/null +++ b/templates/base/offline.html @@ -0,0 +1,6 @@ +{% extends "base/base.html" %} +{% load i18n %} + +{% block content %} +Xerxes is offline, het is tijdelijk niet mogelijk om invloeden in te dienen. +{% endblock %} diff --git a/templates/influences/influence_detail.html b/templates/influences/influence_detail.html index 5c50b67..12ec468 100644 --- a/templates/influences/influence_detail.html +++ b/templates/influences/influence_detail.html @@ -27,6 +27,10 @@ {% endif %} {% endwith %} +{% if object.result %} +

{% trans "Result" %}

+

{{ object.result }}

+{% endif %}

{% trans "Comments" %}

{% block comments %} {% include "influences/influence_comments_block.html" %} diff --git a/tools/templatetags/encode_email.py b/tools/templatetags/encode_email.py index 6a737d1..e7dccf6 100644 --- a/tools/templatetags/encode_email.py +++ b/tools/templatetags/encode_email.py @@ -1,52 +1,52 @@ -import random -from django import template -""" - Randomized string encoding - Inspired by John Gruber's Markdown: - http://daringfireball.net/projects/markdown/syntax#autolink -""" -register = template.Library() - -#@template.stringfilter -def encode_string(value): - """ - Encode a string into it's equivalent html entity. - - The tag will randomly choose to represent the character as a hex digit or - decimal digit. - - Use {{ obj.name|encode_string }} - - {{ "person"|encode_string }} Becomes something like: - person - """ - e_string = "" - for a in value: - type = random.randint(0,1) - if type: - en = "&#x%x;" % ord(a) - else: - en = "&#%d;" % ord(a) - e_string += en - return e_string - -register.filter("encode_string", encode_string) - -def encode_mailto(value, arg): - """ - Encode an e-mail address and its corresponding link name to its equivalent - html entities. - - Use {{ obj.email|encode_mailto:obj.name }} - - {{ "j@j.com"|encode_mailto:"j" }} Becomes something like: - j - """ - address = 'mailto:%s' % value - address = encode_string(address) - name = encode_string(arg) - tag = "%s" % (address, name) - return tag - -register.filter("encode_mailto", encode_mailto) +import random +from django import template +""" + Randomized string encoding + Inspired by John Gruber's Markdown: + http://daringfireball.net/projects/markdown/syntax#autolink +""" +register = template.Library() + +#@template.stringfilter +def encode_string(value): + """ + Encode a string into it's equivalent html entity. + + The tag will randomly choose to represent the character as a hex digit or + decimal digit. + + Use {{ obj.name|encode_string }} + + {{ "person"|encode_string }} Becomes something like: + person + """ + e_string = "" + for a in value: + type = random.randint(0,1) + if type: + en = "&#x%x;" % ord(a) + else: + en = "&#%d;" % ord(a) + e_string += en + return e_string + +register.filter("encode_string", encode_string) + +def encode_mailto(value, arg): + """ + Encode an e-mail address and its corresponding link name to its equivalent + html entities. + + Use {{ obj.email|encode_mailto:obj.name }} + + {{ "j@j.com"|encode_mailto:"j" }} Becomes something like: + j + """ + address = 'mailto:%s' % value + address = encode_string(address) + name = encode_string(arg) + tag = "%s" % (address, name) + return tag + +register.filter("encode_mailto", encode_mailto) diff --git a/urls.py b/urls.py index 0ff28c1..bbc5468 100644 --- a/urls.py +++ b/urls.py @@ -3,6 +3,7 @@ from django.conf.urls.defaults import * from django.contrib import admin from xerxes.influences.models import Character from xerxes.influences.models import Influence +from django.views.generic.simple import direct_to_template import os # Automatically import admin.py from all INSTALLED_APPS @@ -18,6 +19,8 @@ urlpatterns = patterns('', url(r'^influences/influence/(?P\d+)/$', 'xerxes.influences.views.influence_detail', name='influences_influence_detail'), url(r'^influences/influence/(?P\d+)/comment/$', 'xerxes.influences.views.influence_comment', name='influences_influence_comment'), url(r'^influences/influence/(?P\d+)/comment/(?P\d+)/$', 'xerxes.influences.views.influence_comment', name='influences_influence_comment_parent'), + #url(r'^influences/influence/add/(\d+)$', 'django.views.generic.simple.direct_to_template', {'template': 'base/offline.html'}, name='influences_add_influence_for_character'), + #url(r'^influences/influence/add/$', 'django.views.generic.simple.direct_to_template', {'template': 'base/offline.html'}, name='influences_add_influence'), url(r'^influences/influence/add/(\d+)/$', 'xerxes.influences.views.add_influence', name='influences_add_influence_for_character'), url(r'^influences/influence/add/$', 'xerxes.influences.views.add_influence', name='influences_add_influence'),