# HG changeset patch # User Sandro Knauß # Date 1265519617 -3600 # Node ID 5253631a8dd39614251b802a500839359b3f1abb # Parent 49ffb1f6cdbf7928084335b1c84560f3dde4fed0 sms via sipgate working diff -r 49ffb1f6cdbf -r 5253631a8dd3 .hgignore --- a/.hgignore Sun Feb 07 05:12:57 2010 +0100 +++ b/.hgignore Sun Feb 07 06:13:37 2010 +0100 @@ -2,3 +2,7 @@ *~ *.pyc *.conf +.*.swp +*orig +*.log +MyIro diff -r 49ffb1f6cdbf -r 5253631a8dd3 iro/anbieter/content.py --- a/iro/anbieter/content.py Sun Feb 07 05:12:57 2010 +0100 +++ b/iro/anbieter/content.py Sun Feb 07 06:13:37 2010 +0100 @@ -15,11 +15,14 @@ from email.header import Header class content: - def __init__(self,content): - self.content=content - - def sendto(self,anbieter,recipients): - pass + def __init__(self,content): + self.content=content + + def sendto(self,anbieter,recipients): + pass + + def getContent(self): + return self.content class SMS(content): def __init__(self,cont): diff -r 49ffb1f6cdbf -r 5253631a8dd3 iro/anbieter/sipgate.py --- a/iro/anbieter/sipgate.py Sun Feb 07 05:12:57 2010 +0100 +++ b/iro/anbieter/sipgate.py Sun Feb 07 06:13:37 2010 +0100 @@ -43,10 +43,10 @@ def sendSMS(self,sms,recipients): """send SMS with $sms to $recipients""" - logger.debug('sipgate.sendSMS(%s,%s)'%(sms, str(recipients))) + logger.debug('sipgate.sendSMS(%s,%s)'%(sms.getContent(), str(recipients))) args={ "TOS" : "text", - "Content" : sms.content + "Content" : sms.getContent() } self.__send(args,recipients) @@ -94,9 +94,9 @@ for recipient in recipients: try: tel = telnumber(recipient) - + if tel in sended: #only send message once per recipient - continue + continue sended.append(tel) args["RemoteUri"]="sip:%s%s@sipgate.net"%(tel.land,tel.number) diff -r 49ffb1f6cdbf -r 5253631a8dd3 iro/iro.py --- a/iro/iro.py Sun Feb 07 05:12:57 2010 +0100 +++ b/iro/iro.py Sun Feb 07 06:13:37 2010 +0100 @@ -14,7 +14,7 @@ import logging,multiprocessing #logging anfangen logger=logging.getLogger("iro") -logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)s(%(processName)s)-%(levelname)s: %(message)s') +logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)s()-%(levelname)s: %(message)s') # Server code diff -r 49ffb1f6cdbf -r 5253631a8dd3 iro/test.py --- a/iro/test.py Sun Feb 07 05:12:57 2010 +0100 +++ b/iro/test.py Sun Feb 07 06:13:37 2010 +0100 @@ -2,7 +2,7 @@ import unittest, ConfigParser import iro -from job import MessageJob +from job import SMSJob, FAXJob, MailJob from joblist import Joblist from providerlist import Providerlist import threading, xmlrpclib @@ -38,7 +38,10 @@ class MyManager(BaseManager): pass - MyManager.register('MessageJob', MessageJob) + MyManager.register('SMSJob', SMSJob) + MyManager.register('FAXob', FAXJob) + MyManager.register('MailJob',MailJob) + MyManager.register('Providerlist',Providerlist) manager = MyManager() manager.start() @@ -120,8 +123,8 @@ self.assertEqual(admin.status(),{id1: {'status': ['init',{}], 'name': 'test'}, id2: {'status': ['init',{}], 'name': 'test2'}} ) - self.assertRaises(xmlrpclib.Fault, client2.status, id1) - self.assertRaises(xmlrpclib.Fault, client1.status, id2) + self.assertEqual(client2.status(id1), {}) + self.assertEqual(client1.status(id2), {}) def testGetProvider(self): servstr="https://test:test@localhost:8000" diff -r 49ffb1f6cdbf -r 5253631a8dd3 iro/user.py --- a/iro/user.py Sun Feb 07 05:12:57 2010 +0100 +++ b/iro/user.py Sun Feb 07 06:13:37 2010 +0100 @@ -72,7 +72,7 @@ job=self.jobs[id] job.stop() except: - raise String("No Job with ID: %i" %(id)) + raise NoID(id) job.stop()