Esempio n. 1
0
 def get(self, id):
     gi = GroupInfo.get(id=id)
     if not gi:
         raise HTTPError(404)
     group_name = gi.name
     creater = User.get(gi.create_id)
     description = gi.description
     groups = Group.where(group_id=id)
     user_ids = groups.col_list(col='user_id')
     users = User.get_list(id=user_ids)
     for user_id in user_ids:
         if user_id not in CACHE:
             for user in users:
                 if user_id == user.id:
                     CACHE[user_id] = user
     blogs = Blog.where('user_id in (%s)'%','.join(user_ids))
     for blog in blogs:
         blog.user = CACHE[blog.user_id]
     return self.render('group.html', gi=gi, creater=creater, groups=groups, users=users, blogs=blogs)
Esempio n. 2
0
 def get(self, limit=0):
     offset = 20
     limit = int(limit)
     groups = GroupInfo.where()
     groups = groups[limit:limit+offset]
     return self.render('groups.html', groups=groups)