--- a/iro/user.py Fri Oct 23 01:15:23 2009 +0200
+++ b/iro/user.py Fri Oct 23 01:37:44 2009 +0200
@@ -10,6 +10,14 @@
#You should have received a copy of the GNU General Public License
#along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+class NotSupportedFeature (Exception):
+ def __init__(self,name):
+ self.name=name
+
+ def __str__(self):
+ return ("This is not a supported feature:", self.name)
+
class User:
'''
class for a xmlrpc user
@@ -17,6 +25,7 @@
def __init__(self,jobqueue):
self.jobqueue=jobqueue
self.jobs={}
+ self.features=["mail", "sms", "fax", ]
def status(self,id=None,detailed=False):
'''
@@ -53,15 +62,31 @@
'''
starts the SMS with message to recipients
'''
+ if not "sms" in self.features:
+ raise NotSupportedFeature("sms")
id = self.jobqueue.newSMS(message,recipients)
self.jobs[id]=self.jobqueue[id]
return id
-
+
+
+ def startFAX(self):
+ '''
+ starts the FAX - not implemented
+ '''
+ raise NotSupportedFeature("fax")
+
+
def startMail(self,subject, body , recipients):
+ if not "mail" in self.features:
+ raise NotSupportedFeature("mail")
id = self.jobqueue.newMail(subject, body ,recipients)
self.jobs[id]=self.jobqueue[id]
- return id
+ return id
+
+ def getProvider(self, name):
+ if not name in self.features:
+ raise NotSupportedFeature(name)
class Admin(User):
def __init__(self,jobqueue):