예제 #1
0
 def get(self, id):
     g = Group.get(group_id=id)
     if not g:
         raise HTTPError(404)
     add_group(id, self.current_user.id)
     uri = self.request.path 
     print uri
     return self.redirect('/group/%s'%id)
예제 #2
0
 def post(self):
     error = {}
     group_name = self.get_argument('group_name', None)
     group_description = self.get_argument('group_description', None)
     if not group_name:
         error['group_name'] = 'U have to input the name'
     if not group_description:
         error['group_description'] = 'the group must have to be declared'
     if error:
         return self.render('new_group.html', error=error, group_name=group_name, group_description=group_description)
     create_id = self.current_user.id
     gi = new_info(create_id, group_name, group_description)
     g = add_group(gi.id, create_id, CID_CREATE)
     return self.redirect('/group/%s'%g.group_id)
예제 #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
add_group.py
Author: yupbank
Email:  [email protected]

Created on
2012-11-28
'''
import _env
from model.user import User
from model.group import Group, add_group

if __name__ == '__main__':
    except_id = '118270245423604986734'
    for i in  User.where():
        if not i.id == except_id:
            group = Group.where(user_id=i.id)
            if not group:
                add_group(i.id)