17
17
from epsilon import descriptor, extime
19
19
from axiom import item, attributes, iaxiom
20
from axiom.scheduler import SubScheduler
21
20
from axiom.dependency import dependsOn
22
21
from axiom.upgrade import registerUpgrader
99
98
Manages the creation, operation, and destruction of grabbers
100
99
(items which retrieve information from remote sources).
104
103
paused = attributes.boolean(doc="""
105
104
Flag indicating whether grabbers created by this Item will be
107
106
""", default=False)
109
scheduler = dependsOn(SubScheduler)
110
108
privateApplication = dependsOn(PrivateApplication)
111
109
deliveryAgent = dependsOn(DeliveryAgent)
129
127
self.scheduler.schedule(pg, extime.Time())
130
128
# OR MAYBE A LITTLE LATER
132
item.declareLegacyItem(GrabberConfiguration, 1, dict(
130
item.declareLegacyItem(GrabberConfiguration.typeName, 1, dict(
133
131
paused=attributes.boolean(default=False),
134
132
installedOn=attributes.reference()))
136
134
def _grabberConfiguration1to2(old):
137
135
new = old.upgradeVersion(GrabberConfiguration.typeName, 1, 2,
138
136
paused=old.paused,
139
scheduler = old.store.findOrCreate(SubScheduler),
140
137
privateApplication = old.store.findOrCreate(PrivateApplication),
141
138
deliveryAgent = old.store.findOrCreate(DeliveryAgent))
143
140
registerUpgrader(_grabberConfiguration1to2, GrabberConfiguration.typeName, 1, 2)
142
item.declareLegacyItem(GrabberConfiguration.typeName, 2, dict(
143
paused=attributes.boolean(default=False),
144
scheduler=attributes.reference(),
145
privateApplication=attributes.reference(),
146
deliveryAgent=attributes.reference(),
150
def _grabberConfiguration2to3(old):
152
Copy all the remaining attributes.
154
new = old.upgradeVersion(GrabberConfiguration.typeName, 2, 3,
156
privateApplication = old.store.findOrCreate(PrivateApplication),
157
deliveryAgent = old.store.findOrCreate(DeliveryAgent))
159
registerUpgrader(_grabberConfiguration2to3, GrabberConfiguration.typeName, 2, 3)
145
162
class POP3UID(item.Item):
146
163
grabberID = attributes.text(doc="""
147
164
A string identifying the email-address/port parts of a
425
442
self.setStatus(u"Logging in...")
428
loginResult = d.getResult()
429
446
except pop3client.ServerErrorResponse, e:
431
448
u'Login failed: ' + str(e).decode('ascii', 'replace'),