def __init__(self): KoaObject.__init__(self) self.start = None self.end = None self.title = None self.description = None self.done = False
def __init__(self): KoaObject.__init__(self) self.name = "" self.maxlevel = 0 self.ranks = {0:"Vollnoob", 75:"Anfaenger", 150:"Furchtloser Recke", 300:"Skiller", 450:"Pro"}
def __init__(self): KoaObject.__init__(self) self.id = None self.nick = None self.gender = None self.firstname = None self.lastname = None self.matricular = None self.birthday = None self.email = None
def __init__(self): KoaObject.__init__(self) self.skill = None self.user = None self.level = ""
def getUserSkill(cls,user,skill): skill = APPLICATION.getStorage().find({'user_id':user.id, 'skill_id':skill.id, '_className':'UserSkill'}) return KoaObject.load(skill[0]) # HERE BE DRAGONS
def getUserSkills(cls, user): skills = APPLICATION.getStorage().find({'user_id':user.id, '_className':'UserSkill'}) return [KoaObject.load(i['_id']) for i in skills]
def getSkills(cls): skills = APPLICATION.getStorage().find({'_className':'Skill'}) return [KoaObject.load(i['_id']) for i in skills]
""" def increaseLevel(self): if self.level+1 <= self.skill.getMaxlevel(): if random() > 0.25: self.level+=1 self.store() """ Returns the Rank of this UserSkill. The Actual rank-strings are determined by this UserSkill's skill-object """ def getRank(self): return self.skill.getRankForLevel(self.level) KoaObject.registerClass(UserSkill) """ A Skill is something like "doin the dishes" or "wash clothes" or anything like that, that represents unpleasant work in the koa-directed household and is to be rewarded with skillpoints :) """ class Skill(KoaObject): """ Returns every Skill in the current Koa-Database """ @classmethod def getSkills(cls): skills = APPLICATION.getStorage().find({'_className':'Skill'}) return [KoaObject.load(i['_id']) for i in skills]
def __init__(self): KoaObject.__init__(self) self.author = None self.recipient = None self.content = ""
def getNotesForUser(cls,user): notes = APPLICATION.getStorage().find({'recipient_id':user.id, '_className':'Note'}) return [KoaObject.load(i['_id']) for i in notes]
def __init__(self): KoaObject.__init__(self) self.author = None self.recipient = None self.content = "" def setContent(self,content): self.content = content def getContent(self): return self.content def setAuthor(self,author): if author.__class__.__name__ != "User": raise Exception ("Must be User") self.author = author def getAuthor(self): return self.author def setRecipient(self, recipient): if recipient.__class__.__name__ != "User" and recipient is not None: raise Exception ("Must be User") self.recipient = recipient def getRecipient(self): return self.recipient KoaObject.registerClass(Note)
########################################################### import datetime datetime. from data import KoaObject, APPLICATION class Calendar(KoaObject): def __init__(self): self.appointments = {} def createAppointment(): appointment = Appointment() KoaObject.registerClass(Calendar) # ABSTRACT BASE CLASS ??? class Appointment(KoaObject): def __init__(self): KoaObject.__init__(self) self.start = None self.end = None self.title = None self.description = None self.done = False def setTitle(self, title): self.title = title def getTitle(self): return self.title
self.id = None self.nick = None self.gender = None self.firstname = None self.lastname = None self.matricular = None self.birthday = None self.email = None def setFirstname(self, name): self.firstname = name def getFirstname(self): return self.firstname def setLastname(self, name): self.lastname = name def getLastname(self): return self.lastname def getDisplayName(self): genderstring = ("Hr.", "Fr.") return genderstring[self.gender]+" "+self.lastname+", "+self.firstname KoaObject.registerClass(User)