Example #1
0
def send_message(connection, text):
    """
    Send a message from the webui process to the router process,
    via the ajax app.
    """
    post = {"connection_id": unicode(connection.id), "text": text}
    return call_router("messaging", "send_message", **post)
Example #2
0
def send_message(connection, text):
    """
    Send a message from the webui process to the router process,
    via the ajax app.
    """
    post = {"connection_id": unicode(connection.id), "text": text}
    return call_router("messaging", "send_message", **post)
Example #3
0
def send_alert(alert,contact):
    return call_router("alerts", "send_alert",
        **{ "en": alert.text_en,
            "ka": alert.text_ka,
            "categories": _m2m2array(alert),
            "is_important": unicode(alert.is_important),
            "id": unicode(alert.id),
            "contact_id": unicode(contact.id)})
Example #4
0
def send_bulk_message_from_csv(path, text='coffee'):
    backend_name = "TLS-TT"
    file = open(path)
    for line in file:
        line_list = line.split(',')
        name = line_list[0].strip()
        identity = line_list[1].strip()        
#        if Connection.objects.filter(identity=identity).count() == 0:
        contact = Contact(name=name)
        contact.save()
        # TODO deal with errors!
        backend = Backend.objects.get(name=backend_name)
        connection = Connection(backend=backend, identity=identity,\
            contact=contact)
        connection.save()
#       else:
#            connection = Connection.objects.get(identity=identity)
        post = {"connection_id": unicode(connection.id), "text": text}
        call_router("messaging", "send_message", **post)
def send_alert(alert, contact):
    return call_router(
        "alerts", "send_alert", **{
            "en": alert.text_en,
            "ka": alert.text_ka,
            "categories": _m2m2array(alert),
            "is_important": unicode(alert.is_important),
            "id": unicode(alert.id),
            "contact_id": unicode(contact.id)
        })
Example #6
0
def test_schedule(request, schedule_pk):
    post = {"schedule_pk": schedule_pk}
    succeed = call_router("scheduler", "run_schedule", **post)
    return HttpResponseRedirect(reverse('scheduler'))
Example #7
0
def test_schedule(request, schedule_pk):
    post = {"schedule_pk": schedule_pk}
    succeed = call_router("scheduler", "run_schedule", **post)
    return HttpResponseRedirect(reverse('scheduler'))