# HG changeset patch # User Sandro Knauß # Date 1265515951 -3600 # Node ID cf54cc3373f239a167a52fe8e89ca1d6e163b6d9 # Parent e33b90f96e0fb4eb7871e7603da98d232da9a729# Parent 7295e27e8c99f0f86f2d7ee0f9eae142227340a7 merging mergiing svn diff -r 7295e27e8c99 -r cf54cc3373f2 iro/user.py --- a/iro/user.py Fri Nov 27 01:14:51 2009 +0100 +++ b/iro/user.py Sun Feb 07 05:12:31 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 . - +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): '''