Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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))
Esempio n. 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
Esempio n. 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))
Esempio n. 9
0
 def shiftCount(self):
     db = core.connect("shiftspace/shared")
     return core.value(Group.shift_count(db, key=self.id)) or 0
Esempio n. 10
0
    def adminCount(self):
        from server.models.permission import Permission

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