Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 203f001cc306ca6696b0a8d46e47e72a300202b9 2 parents da073ee + 428fc5d
@pungoyal pungoyal authored
View
0  apps/bulkpoll/__init__.py
No changes.
View
27 apps/bulkpoll/app.py
@@ -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
View
11 apps/bulkpoll/message_parser.py
@@ -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
+
+
+
View
3  apps/bulkpoll/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your Django models here, if you need them.
View
13 apps/bulkpoll/tests.py
@@ -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')
View
1  apps/bulkpoll/views.py
@@ -0,0 +1 @@
+# Create your webui views here.
View
2  apps/charts/templates/translate_message.html
@@ -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 }}
View
2  apps/charts/unittests/view_tests.py
@@ -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)
View
2  apps/charts/views.py
@@ -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
2  rapidsms.ini
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.