--- a/iro/user.py Fri Nov 27 01:09:34 2009 +0100
+++ b/iro/user.py Sun Feb 07 05:10:46 2010 +0100
@@ -10,7 +10,8 @@
#You should have received a copy of the GNU General Public License
#along with this program; if not, see <http://www.gnu.org/licenses/>.
-
+import logging
+logger=logging.getLogger("iro.user")
class NotSupportedFeature (Exception):
def __init__(self,name):
self.name=name
@@ -18,6 +19,14 @@
def __str__(self):
return ("This is not a supported feature:", self.name)
+class NoID(Exception):
+ def __init__(self,i):
+ self.i=i
+
+ def __str__(self):
+ return ("No Job with id:", self.i)
+
+
class User:
'''
class for a xmlrpc user
@@ -32,19 +41,28 @@
gets the status for a job
if the id is None all Jobs of an user are given back
'''
- if id==None:
- jobs=self.jobs
- else:
- try:
- jobs={id:self.jobs[id]}
- except:
- raise String("No Job with ID: %i" %(id))
- ret={}
- for key in jobs:
- job=jobs[key]
- ret[key]={"name":job.getName(),"status":job.getStatus(detailed)}
-
- return ret
+ try:
+ jobs={}
+ if id==None:
+ jobs=self.jobs
+ else:
+ try:
+ jobs={id:self.jobs[id]}
+ except:
+ logger.error("No Job ID %s",id)
+ #raise NoID(id)
+ ret={}
+ if not jobs:
+ return {}
+
+ for key in jobs:
+ job=jobs[key]
+ ret[key]={"name":job.getName(),"status":job.getStatus(detailed)}
+
+ return ret
+ except:
+ logger.exception("Fehler in iro.user.status")
+ return {}
def stop(self,id):
'''