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 |
14 from anbieter import content |
14 from anbieter import content |
15 import md5, os, time |
15 import md5, os, time |
16 |
16 import logging |
|
17 logger=logging.getLogger("iro.joblist"); |
17 |
18 |
18 class Joblist: |
19 class Joblist: |
19 ''' |
20 ''' |
20 Providing an list of jobs; each new job gets a hash id |
21 Providing an list of jobs; each new job gets a hash id |
21 ''' |
22 ''' |
22 def __init__(self,manager, queue,providerlist): |
23 def __init__(self,manager, queue,providerlist,dbconn=None): |
23 self.jobs={} |
24 self.jobs={} |
24 self.manager=manager |
25 self.manager=manager |
25 self.queue=queue |
26 self.queue=queue |
26 self.providerlist=providerlist |
27 self.providerlist=providerlist |
|
28 self.dbconn=dbconn |
27 |
29 |
28 |
30 |
29 def __getitem__(self,key): |
31 def __getitem__(self,key): |
30 return self.jobs[key] |
32 return self.jobs[key] |
31 |
33 |
32 def __registerJob__(self, job): |
34 def __registerJob__(self, job): |
33 id = self._createID() |
35 id = self._createID() |
|
36 if self.dbconn: |
|
37 job.setAcounting(self.manager.Acounting(id,self.dbconn)) |
|
38 job.setId(id) |
34 self.jobs[id]=job |
39 self.jobs[id]=job |
35 self.queue.put(job) |
40 self.queue.put(job) |
36 return id |
41 return id |
37 |
42 |
38 def newSMS(self,message,recipients,provider="default"): |
43 def newSMS(self,message,recipients,provider="default"): |