equal
deleted
inserted
replaced
1 from collections import MutableMapping |
1 from collections import MutableMapping |
2 |
2 |
3 import schema |
3 import schema |
|
4 import offer |
4 from .dbdefer import dbdefer |
5 from .dbdefer import dbdefer |
5 from .offer import extendProvider |
|
6 |
|
7 class Status: |
|
8 '''status for one recipient''' |
|
9 todo = 1 |
|
10 good = 2 |
|
11 error = 3 |
|
12 |
|
13 def __init__(self, offer, status, errtext=None): |
|
14 self.status = status |
|
15 self.offer = offer #the offer over that this job was done |
|
16 self.errtext = errtext #the error text |
|
17 |
6 |
18 class ExJob: |
7 class ExJob: |
19 '''One Job is a class that handles one job has multiple tasks''' |
8 '''One Job is a class that handles one job has multiple tasks''' |
20 def __init__(self, dbjob, recipients, message, offers): |
9 def __init__(self, dbjob, recipients, message, offers): |
21 self.dbjob = dbjob #Connection to mysql job element (id) |
10 self.dbjob = dbjob #Connection to mysql job element (id) |
40 user = session.merge(user) |
29 user = session.merge(user) |
41 job = schema.Job(info=info, status="started") |
30 job = schema.Job(info=info, status="started") |
42 user.jobs.append(job) |
31 user.jobs.append(job) |
43 session.commit() |
32 session.commit() |
44 |
33 |
45 o = extendProvider(user, message.typ, offers, session=session) |
34 o = offer.extendProvider(user, message.typ, offers, session=session) |
46 self[job.id] = ExJob(job.id, recipients, message, o) |
35 self[job.id] = ExJob(job.id, recipients, message, o) |
47 return self[job.id] |
36 return self[job.id] |
48 |
37 |
49 exJobs = ExJobs() |
38 exJobs = ExJobs() |