--- a/.hgignore Sun Feb 07 17:05:24 2010 +0100
+++ b/.hgignore Sun Feb 07 17:08:17 2010 +0100
@@ -2,3 +2,7 @@
*~
*.pyc
*.conf
+.*.swp
+*orig
+*.log
+MyIro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgtags Sun Feb 07 17:08:17 2010 +0100
@@ -0,0 +1,1 @@
+5253631a8dd39614251b802a500839359b3f1abb sipgate-sms-working
--- a/iro/anbieter/content.py Sun Feb 07 17:05:24 2010 +0100
+++ b/iro/anbieter/content.py Sun Feb 07 17:08:17 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):
--- a/iro/anbieter/sipgate.py Sun Feb 07 17:05:24 2010 +0100
+++ b/iro/anbieter/sipgate.py Sun Feb 07 17:08:17 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,15 +94,16 @@
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)
- xmlrpc_result = self.__send_method(self.samurai.SessionInitiate, args)
+ self.__send_method(self.samurai.SessionInitiate, args)
self.updateStatus(arranged=recipient)
- except NotATelNumber,NoValidStatusCode :
+
+ except NotATelNumber, NoValidStatusCode:
self.updateStatus(failed=recipient)
self.__disconnect()
--- a/iro/test.py Sun Feb 07 17:05:24 2010 +0100
+++ b/iro/test.py Sun Feb 07 17:08:17 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"
--- a/iro/user.py Sun Feb 07 17:05:24 2010 +0100
+++ b/iro/user.py Sun Feb 07 17:08:17 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()