# Dice Example from TW.API import * from Interfaces import * from whrandom import randint class DiceService(SEF.Service): __implements__ = IDiceService class DiceElement(SEF.Element): class diceValue(SEF.StructuralFeature): lo = 1 hi = 6 newVerbs = Items( next = 'next%(initCap)s', ) def next(feature,self): print "Rolling from %s to %s" % (feature.lo,feature.hi) return randint(feature.lo,feature.hi) def roll(self): return self.nextDiceValue() def getDice(self): return self.DiceElement() setupModule()