/usr/share/pyshared/axiom/test/newcirc.py is in python-axiom 0.7.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # -*- test-case-name: axiom.test.test_upgrading.DeletionTest.testCircular -*-
from axiom.item import Item
from axiom.attributes import reference, integer
class A(Item):
typeName = 'test_circular_a'
b = reference()
class B(Item):
typeName = 'test_circular_b'
a = reference()
n = integer()
schemaVersion = 2
from axiom.upgrade import registerUpgrader
def b1to2(oldb):
# This upgrader isn't doing anything that actually makes sense; in a
# realistic upgrader, you'd probably be changing A around, perhaps deleting
# it to destroy old adjunct items and creating a new A. The point is,
# s.findUnique(A).b should give back the 'b' that you are upgrading whether
# it is run before or after the upgrade.
oldb.a.deleteFromStore()
newb = oldb.upgradeVersion('test_circular_b', 1, 2)
newb.n = oldb.n
newb.a = A(store=newb.store,
b=newb)
return newb
registerUpgrader(b1to2, 'test_circular_b', 1, 2)
|