Permalink
Browse files

Merge branch 'master' of github.com:pungoyal/shadow-poll

  • Loading branch information...
2 parents da073ee + 428fc5d commit 203f001cc306ca6696b0a8d46e47e72a300202b9 @pungoyal pungoyal committed Apr 1, 2010
No changes.
View
@@ -0,0 +1,27 @@
+import rapidsms
+
+class App (rapidsms.app.App):
+ def start (self):
+ """Configure your app in the start phase."""
+ pass
+
+ def parse (self, message):
+ """Parse and annotate messages in the parse phase."""
+ pass
+
+ def handle (self, message):
+ """Add your main application logic in the handle phase."""
+ pass
+
+ def cleanup (self, message):
+ """Perform any clean up after all handlers have run in the
+ cleanup phase."""
+ pass
+
+ def outgoing (self, message):
+ """Handle outgoing message notifications."""
+ pass
+
+ def stop (self):
+ """Perform global app cleanup when the application is stopped."""
+ pass
@@ -0,0 +1,11 @@
+class MessageParser(object):
+ def __init__(self, message):
+ self.message = message
+
+ def parse(self):
+ message_arr = self.message.split(" ")
+
+ return message_arr
+
+
+
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your Django models here, if you need them.
@@ -0,0 +1,13 @@
+from rapidsms.tests.scripted import TestScript
+from app import App
+
+from message_parser import MessageParser
+
+class TestApp (TestScript):
+ apps = (App,)
+
+ def test_message_parser_age_sex(self):
+ msgParser = MessageParser("bulk m 7 a a b c d")
+ parsed_msg = msgParser.parse()
+ self.assertEquals(parsed_msg[1], 'm')
+ self.assertEquals(parsed_msg[2], '7')
@@ -0,0 +1 @@
+# Create your webui views here.
@@ -26,7 +26,7 @@
{% block messages %}
<div id="message_translation_container">
<div id="status">{{status}}</div>
- {% jplayer 0 message.sound_file_url %}
+ {% jplayer 0 message.sound_file_url server_name %}
<div id="translation_container">
<form method="post">
{{ form.as_p }}
@@ -45,7 +45,7 @@ def test_messaging_pages_is_accesible(self):
self.failUnless(login, 'Could not log in')
response = self.client.get("/messages/translate/")
self.assertEquals(response.status_code, 200)
- response = self.client.get("/message/translate/1")
+ response = self.client.get("/message/translate/4")
self.assertEquals(response.status_code, 200)
@@ -44,6 +44,7 @@ def voice_admin_page(request):
@login_required
def voice_translate(request, message_id, template = "translate_message.html"):
context = {}
+ server_name = request.META['SERVER_NAME']
message = get_object_or_404(VoiceMessage, pk=message_id)
if request.method == "POST":
form = VoiceMessageForm(request.POST, instance=message)
@@ -54,6 +55,7 @@ def voice_translate(request, message_id, template = "translate_message.html"):
form = VoiceMessageForm(instance=message)
context['form'] = form
context['message'] = message
+ context['server_name'] = server_name
return render_to_response(request, template, context)
def play_audio(request, file_name):
View
@@ -12,7 +12,7 @@
# backends=[backend1,backend2,...] * comma-separated list of backends to load
[rapidsms]
-apps=webapp,ajax,admin,httptester,logger,internationalization,register,reporters,patterns,default,messaging,iraq,poll,charts,atom,django_extensions
+apps=webapp,ajax,admin,httptester,logger,internationalization,register,reporters,patterns,default,messaging,iraq,poll,bulkpoll,charts,atom,django_extensions
backends=http, kannel
# -- DATABASE

0 comments on commit 203f001

Please sign in to comment.