/usr/share/doc/python-axiom/examples/bucket.py is in python-axiom 0.7.5-1.
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | from axiom import item, attributes
class Bucket(item.Item):
typeName = 'bucket'
schemaVersion = 1
name = attributes.text()
def getstuff(self):
for food in self.store.query(FoodItem,
FoodItem.bucket == self,
sort=FoodItem.deliciousness.descending):
food.extra.what()
class FoodItem(item.Item):
typeName = 'food'
schemaVersion = 1
bucket = attributes.reference()
extra = attributes.reference()
deliciousness = attributes.integer(indexed=True)
class Chicken(item.Item):
typeName = 'chicken'
schemaVersion = 1
epistemologicalBasisForCrossingTheRoad = attributes.text()
def what(self):
print 'chicken!'
class Biscuit(item.Item):
typeName = 'biscuit'
schemaVersion = 1
fluffiness = attributes.integer()
def what(self):
print 'biscuits!'
from axiom.store import Store
s = Store()
u = Bucket(name=u'whatever', store=s)
c = Chicken(epistemologicalBasisForCrossingTheRoad=u'extropian', store=s)
b = Biscuit(fluffiness=100, store=s)
FoodItem(store=s, deliciousness=3, extra=c, bucket=u)
FoodItem(store=s, deliciousness=4, extra=b, bucket=u)
u.getstuff()
|