def __init__(self, mind, avatar, page): self.mind = mind self.avatar = avatar # Page instances must be created by the MindAdaptor # Only mind and avatar is handled by twisted.spread self.page = page(self) # The page self.name = None # Contest name self.isrunning = False self.js = JSUtil(mind)
class NevowMind: """Mind wrapper for Nevow clients. mind - original mind avatar - avatar for this mind page - The corresponding page *class* see: auth.py for mechanism """ def __init__(self, mind, avatar, page): self.mind = mind self.avatar = avatar # Page instances must be created by the MindAdaptor # Only mind and avatar is handled by twisted.spread self.page = page(self) # The page self.name = None # Contest name self.isrunning = False self.js = JSUtil(mind) def __getattr__(self, attr): # Fallback to original mind's attribute return getattr(self.mind, attr) def init(self): "Called when the mind is first created (on user logon)" pass # Mind methods # def contestStopped(self): self.mind.alert("Contest is stopped") self.js.reload() def contestStarted(self, name, details): self.mind.alert("Contest is started") self.js.reload()