Merge branch 'production'
authorMatthijs Kooijman <m.kooijman@student.utwente.nl>
Mon, 15 Jun 2009 10:01:42 +0000 (12:01 +0200)
committerMatthijs Kooijman <m.kooijman@student.utwente.nl>
Mon, 15 Jun 2009 10:01:42 +0000 (12:01 +0200)
* 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.

import.py
influences/notify.py
templates/base/offline.html [new file with mode: 0644]
templates/influences/influence_detail.html
tools/templatetags/encode_email.py
urls.py

index 58205ac59deba2d7d07fbcf24784736ca807a463..4d97d747184e31dbe33ffaeb96d519ea40688b2e 100644 (file)
--- 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',
 )
index d53ab36a51a9dd6377ec85c487ac62e68a3a6aac..6aae6f28bb0cfb5548032d7cddc4f5566d38f97f 100644 (file)
@@ -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 (file)
index 0000000..7f51b4e
--- /dev/null
@@ -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 %}
index 5c50b67dce014a8f93495304535d1933d5f155b6..12ec468123e38525ad3d169f6a97f3b9e498ad68 100644 (file)
     </ul>
     {% endif %}
 {% endwith %}
+{% if object.result %}
+<h2>{% trans "Result" %}</h2>
+<p>{{ object.result }}</p>
+{% endif %}
 <h2>{% trans "Comments" %}</h2>
 {% block comments %}
 {% include "influences/influence_comments_block.html" %}
index 6a737d1e9c295432cede2d3774c9f76e8410289e..e7dccf66d3982c603bd2463a041587ae4c6b8b96 100644 (file)
@@ -1,52 +1,52 @@
-import random\r
-from django import template\r
-"""\r
-    Randomized string encoding\r
-    Inspired by John Gruber's Markdown: \r
-    http://daringfireball.net/projects/markdown/syntax#autolink\r
-"""\r
-register = template.Library()\r
-\r
-#@template.stringfilter\r
-def encode_string(value):\r
-    """\r
-    Encode a string into it's equivalent html entity.\r
-\r
-    The tag will randomly choose to represent the character as a hex digit or\r
-    decimal digit.\r
-   \r
-    Use {{ obj.name|encode_string }}\r
-    \r
-    {{ "person"|encode_string }} Becomes something like:\r
-    &#112;&#101;&#x72;&#x73;&#x6f;&#110;\r
-    """\r
-    e_string = "" \r
-    for a in value:\r
-        type = random.randint(0,1)\r
-        if type:\r
-            en = "&#x%x;" % ord(a)\r
-        else:\r
-            en = "&#%d;" % ord(a)\r
-        e_string += en \r
-    return e_string\r
-\r
-register.filter("encode_string", encode_string)\r
-\r
-def encode_mailto(value, arg):\r
-    """\r
-    Encode an e-mail address and its corresponding link name to its equivalent\r
-    html entities.\r
-\r
-    Use {{ obj.email|encode_mailto:obj.name }}\r
-    \r
-    {{ "j@j.com"|encode_mailto:"j" }} Becomes something like:\r
-    <a href="&#x6d;&#x61;&#x69;&#x6c;&#x74;&#111;&#x3a;&#106;&#x40;&#106;\\r
-    &#46;&#99;&#x6f;&#x6d;">&#x6a;</a>\r
-    """\r
-    address = 'mailto:%s' % value\r
-    address = encode_string(address)\r
-    name = encode_string(arg)\r
-    tag = "<a href=\"%s\">%s</a>" % (address, name)\r
-    return tag\r
-\r
-register.filter("encode_mailto", encode_mailto)\r
+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:
+    &#112;&#101;&#x72;&#x73;&#x6f;&#110;
+    """
+    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:
+    <a href="&#x6d;&#x61;&#x69;&#x6c;&#x74;&#111;&#x3a;&#106;&#x40;&#106;\
+    &#46;&#99;&#x6f;&#x6d;">&#x6a;</a>
+    """
+    address = 'mailto:%s' % value
+    address = encode_string(address)
+    name = encode_string(arg)
+    tag = "<a href=\"%s\">%s</a>" % (address, name)
+    return tag
+
+register.filter("encode_mailto", encode_mailto)
diff --git a/urls.py b/urls.py
index 0ff28c102adc52fffa93e97d18b42922c03c291e..bbc54680e93a86707869989232a109c8d8349b3e 100644 (file)
--- 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<object_id>\d+)/$', 'xerxes.influences.views.influence_detail', name='influences_influence_detail'),
     url(r'^influences/influence/(?P<object_id>\d+)/comment/$', 'xerxes.influences.views.influence_comment', name='influences_influence_comment'),
     url(r'^influences/influence/(?P<object_id>\d+)/comment/(?P<parent_id>\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'),