18
18
from axiom import attributes
19
19
from axiom.upgrade import registerUpgrader, registerAttributeCopyingUpgrader
20
20
from axiom.dependency import dependsOn, installOn, installedOn, _DependencyConnector
21
from axiom.scheduler import SubScheduler
23
22
from xmantissa import ixmantissa, webnav, people, webtheme
24
23
from xmantissa.webapp import PrivateApplication
428
424
_DependencyConnector(installee=src, target=old.store,
429
425
explicitlyInstalled=True,
431
# Cannot do either of these before the upgradeVersion call: while
432
# examining dependencies, it is likely that the Inbox being upgraded
433
# will be encountered, causing this upgrade function to run again.
434
# Repeat until the stack is full, then explode. -exarkun
435
427
filter = new.store.findFirst(spam.Filter, default=None)
436
428
if filter is None:
437
429
filter = spam.Filter(store=new.store)
438
installOn(filter, new.store)
439
430
new.filter = filter
441
installOn(focus, old.store)
442
432
new.focus = focus
444
434
registerUpgrader(inbox4to5, Inbox.typeName, 4, 5)
436
declareLegacyItem(Inbox.typeName, 5,
437
dict(privateApplication=attributes.reference(),
438
scheduler=attributes.reference(),
439
messageSource=attributes.reference(),
440
quotientPrefs=attributes.reference(),
441
deliveryAgent=attributes.reference(),
442
messageDisplayPrefs=attributes.reference(),
443
uiComplexity=attributes.integer(),
444
showMoreDetail=attributes.boolean(),
445
filter=attributes.reference(),
446
focus=attributes.reference()))
450
Copy over all attributes except C{scheduler}.
452
new = old.upgradeVersion(
453
Inbox.typeName, 5, 6,
454
privateApplication=old.privateApplication,
455
messageSource=old.messageSource,
456
quotientPrefs=old.quotientPrefs,
457
messageDisplayPrefs=old.messageDisplayPrefs,
458
deliveryAgent=old.deliveryAgent,
459
uiComplexity=old.uiComplexity,
460
showMoreDetail=old.showMoreDetail,
464
# If the old item was original schema version 5 in the database, focus and
465
# filter have already been installed, because the 4 to 5 upgrader used to
466
# install them. However, now that 5 is not the newest version of Inbox, it
467
# cannot do that. Only the upgrader to the newest version can. So do it
468
# here, instead, if it is necessary (which is when the original schema
469
# version was older than 5).
470
if installedOn(new.filter) is None:
471
installOn(new.filter, new.store)
472
if installedOn(new.focus) is None:
473
installOn(new.focus, new.store)
476
registerUpgrader(inbox5to6, Inbox.typeName, 5, 6)
447
479
class MailboxScrollingFragment(Scrollable, ScrollableView, LiveElement):