equal
deleted
inserted
replaced
8 #without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
8 #without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
9 #See the GNU General Public License for more details. |
9 #See the GNU General Public License for more details. |
10 |
10 |
11 #You should have received a copy of the GNU General Public License |
11 #You should have received a copy of the GNU General Public License |
12 #along with this program; if not, see <http://www.gnu.org/licenses/>. |
12 #along with this program; if not, see <http://www.gnu.org/licenses/>. |
13 |
13 import logging |
|
14 logger=logging.getLogger("iro.user") |
14 class NotSupportedFeature (Exception): |
15 class NotSupportedFeature (Exception): |
15 def __init__(self,name): |
16 def __init__(self,name): |
16 self.name=name |
17 self.name=name |
17 |
18 |
18 def __str__(self): |
19 def __str__(self): |
19 return ("This is not a supported feature:", self.name) |
20 return ("This is not a supported feature:", self.name) |
|
21 |
|
22 class NoID(Exception): |
|
23 def __init__(self,i): |
|
24 self.i=i |
|
25 |
|
26 def __str__(self): |
|
27 return ("No Job with id:", self.i) |
|
28 |
20 |
29 |
21 class User: |
30 class User: |
22 ''' |
31 ''' |
23 class for a xmlrpc user |
32 class for a xmlrpc user |
24 ''' |
33 ''' |
30 def status(self,id=None,detailed=False): |
39 def status(self,id=None,detailed=False): |
31 ''' |
40 ''' |
32 gets the status for a job |
41 gets the status for a job |
33 if the id is None all Jobs of an user are given back |
42 if the id is None all Jobs of an user are given back |
34 ''' |
43 ''' |
35 if id==None: |
44 try: |
36 jobs=self.jobs |
45 jobs={} |
37 else: |
46 if id==None: |
38 try: |
47 jobs=self.jobs |
39 jobs={id:self.jobs[id]} |
48 else: |
40 except: |
49 try: |
41 raise String("No Job with ID: %i" %(id)) |
50 jobs={id:self.jobs[id]} |
42 ret={} |
51 except: |
43 for key in jobs: |
52 logger.error("No Job ID %s",id) |
44 job=jobs[key] |
53 #raise NoID(id) |
45 ret[key]={"name":job.getName(),"status":job.getStatus(detailed)} |
54 ret={} |
46 |
55 if not jobs: |
47 return ret |
56 return {} |
|
57 |
|
58 for key in jobs: |
|
59 job=jobs[key] |
|
60 ret[key]={"name":job.getName(),"status":job.getStatus(detailed)} |
|
61 |
|
62 return ret |
|
63 except: |
|
64 logger.exception("Fehler in iro.user.status") |
|
65 return {} |
48 |
66 |
49 def stop(self,id): |
67 def stop(self,id): |
50 ''' |
68 ''' |
51 stops an job with id |
69 stops an job with id |
52 ''' |
70 ''' |