Beispiel #1
0
 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
Beispiel #2
0
 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
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
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
Beispiel #6
0
 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))
Beispiel #7
0
 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
Beispiel #8
0
 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))
Beispiel #9
0
 def shiftCount(self):
     db = core.connect("shiftspace/shared")
     return core.value(Group.shift_count(db, key=self.id)) or 0
Beispiel #10
0
    def adminCount(self):
        from server.models.permission import Permission

        db = core.connect()
        return core.value(Permission.admin_count(db, key=self.id))
Beispiel #11
0
 def uniqueName(cls, name):
     return core.value(User.by_name(core.connect(), key=name)) == None
Beispiel #12
0
 def uniqueName(cls, name):
     return core.value(User.by_name(core.connect(), key=name)) == None
Beispiel #13
0
 def shiftCount(self):
     db = core.connect("shiftspace/shared")
     return core.value(Group.shift_count(db, key=self.id)) or 0
Beispiel #14
0
 def adminCount(self):
     from server.models.permission import Permission
     db = core.connect()
     return core.value(Permission.admin_count(db, key=self.id))
Beispiel #15
0
 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
Beispiel #16
0
 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
Beispiel #17
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
Beispiel #18
0
 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