def unreadCount(self): from server.models.message import Message db = core.connect("shiftspace/shared") syscount = core.value(Message.system_count(db, key=self.id)) or 0 tocount = core.value(Message.count_by_user(db, key=self.id)) or 0 readcount = core.value(Message.read_count_by_user(db, key=self.id)) or 0 return (syscount+tocount)-readcount
def unreadCount(self): from server.models.message import Message db = core.connect("shiftspace/shared") syscount = core.value(Message.system_count(db, key=self.id)) or 0 tocount = core.value(Message.count_by_user(db, key=self.id)) or 0 readcount = core.value(Message.read_count_by_user(db, key=self.id)) or 0 return (syscount + tocount) - readcount
def info(self): from server.models.follow import Follow from server.models.shift import Shift # TODO: use the bulk API - David 12/10/09 result = {} db = core.connect() shared = core.connect("shiftspace/shared") result["followerCount"] = core.value(Follow.followers_count(db, key=self.id)) or 0 result["followingCount"] = core.value(Follow.following_count(db, key=self.id)) or 0 result["publishedShiftCount"] = core.value(Shift.count_by_user_and_published(shared, key=self.id)) or 0 return result
def info(self): from server.models.follow import Follow from server.models.shift import Shift # TODO: use the bulk API - David 12/10/09 result = {} db = core.connect() shared = core.connect("shiftspace/shared") result["followerCount"] = core.value( Follow.followers_count(db, key=self.id)) or 0 result["followingCount"] = core.value( Follow.following_count(db, key=self.id)) or 0 result["publishedShiftCount"] = core.value( Shift.count_by_user_and_published(shared, key=self.id)) or 0 return result
def updateForUser(cls, userId, groupId, level): db = core.connect() perm = core.value( Permission.by_user_and_group(db, key=[userId, groupId])) perm.level = level perm.store(db) return perm
def commentCount(self): from server.models.comment import Comment db = core.connect("shiftspace/shared") return core.value(Comment.count_by_shift(db, key=self.id))
def _internal_summary_function(lldbval, internal_dict): out_string = "" if internal_dict != None and len(obj.header) > 0: out_string += "\n" + obj.header + "\n" out_string += obj(core.value(lldbval)) return out_string
def shiftCount(self): db = core.connect("shiftspace/shared") return core.value(Group.shift_count(db, key=self.id)) or 0
def adminCount(self): from server.models.permission import Permission db = core.connect() return core.value(Permission.admin_count(db, key=self.id))
def uniqueName(cls, name): return core.value(User.by_name(core.connect(), key=name)) == None
def favoriteCount(self): from server.models.favorite import Favorite db = core.connect("shiftspace/shared") return core.value(Favorite.count_by_shift(db, key=self.id)) or 0
def updateForUser(cls, userId, groupId, level): db = core.connect() perm = core.value(Permission.by_user_and_group(db, key=[userId, groupId])) perm.level = level perm.store(db) return perm
def _internal_summary_function(lldbval, internal_dict): out_string= "" if internal_dict != None and len(obj.header) > 0 : out_string += "\n" + obj.header +"\n" out_string += obj( core.value(lldbval) ) return out_string