Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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))
Ejemplo 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
Ejemplo 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))
Ejemplo n.º 9
0
 def shiftCount(self):
     db = core.connect("shiftspace/shared")
     return core.value(Group.shift_count(db, key=self.id)) or 0
Ejemplo 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))
Ejemplo n.º 11
0
 def uniqueName(cls, name):
     return core.value(User.by_name(core.connect(), key=name)) == None
Ejemplo n.º 12
0
 def uniqueName(cls, name):
     return core.value(User.by_name(core.connect(), key=name)) == None
Ejemplo n.º 13
0
 def shiftCount(self):
     db = core.connect("shiftspace/shared")
     return core.value(Group.shift_count(db, key=self.id)) or 0
Ejemplo 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))
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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