iro/providerlist.py
branchdevel
changeset 240 3406d3bf05d4
parent 239 4cf5e664c847
child 241 546316b0b09c
--- a/iro/providerlist.py	Wed Mar 21 19:41:55 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-#Copyright (C) 2009  Sandro Knauß <bugs@sandroknauss.de>
-
-#This program is free software; you can redistribute it and/or modify it under the terms
-#of the GNU General Public License as published by the Free Software Foundation;
-#either version 3 of the License, or any later version.
-#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-#without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#See the GNU General Public License for more details.
-
-#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 Providerlist:
-    def __init__(self):
-        self.provider={}
-        self.types={}
-        self.defaults={}
-        
-    def add(self, name, provider, typeslist):
-        self.provider[name]={"name":name, "class":provider, "types":typeslist}
-        for stype in typeslist:
-            try:
-                self.types[stype].append(self.provider[name])
-            except KeyError:
-                self.types[stype]=[self.provider[name]]
-            
-    
-    def setDefault(self, stype, name):
-        self.defaults[stype]=self.provider[name]
-    
-    def getDefault(self, stype):
-        return self.defaults[stype]
-    
-    def getProviderlist(self, stype):
-        llist=[ provider["name"] for provider in self.types[stype] ]
-        llist.sort()
-        return llist
-
-    def status(self):
-        ret="provider:%s"%self.provider
-        ret +="\ntypes:%s"%self.types
-        return ret+"\ndefaults:%s"%self.defaults
-
-    def getProvider(self, stype,  name="default"):
-        if name=="default":
-            return self.getDefault(stype)["class"]
-
-        if not stype in self.provider[name] ["types"]:
-            raise Exception("argh")
-
-        return self.provider[name]["class"]