Ejemplo n.º 1
0
 def title(self, group_id):
     group = Group.query_by_id(group_id)
     return group.title
Ejemplo n.º 2
0
 def remove_book(self, group_id, book_id):
     group = Group.query_by_id(group_id)
     book = Book.query_by_id(book_id)
     group.remove_book(book)
     return "OK"
Ejemplo n.º 3
0
 def leave(self, group_id):
     user = cherrypy.request.user
     group = Group.query_by_id(group_id)
     with session_scope() as s:
         user.leave_group(s, group)
Ejemplo n.º 4
0
 def index(self, filter = ""):
     with session_scope() as s:
         return json.dumps([dict_group(group) for group in Group.list(s, filter)])
Ejemplo n.º 5
0
 def remove_book(self, group_id, book_id):
     group = Group.query_by_id(group_id)
     book = Book.query_by_id(book_id)
     group.remove_book(book)
     return "OK"
Ejemplo n.º 6
0
 def title(self, group_id):
     group = Group.query_by_id(group_id)
     return group.title
Ejemplo n.º 7
0
 def create(self, title, password):
     group = Group(title, password)
     with session_scope() as s:
         s.add(group)
         return "OK"
     return "FAIL"
Ejemplo n.º 8
0
 def index(self, filter=""):
     with session_scope() as s:
         return json.dumps(
             [dict_group(group) for group in Group.list(s, filter)])
Ejemplo n.º 9
0
 def leave(self, group_id):
     user = cherrypy.request.user
     group = Group.query_by_id(group_id)
     with session_scope() as s:
         user.leave_group(s, group)