Beispiel #1
0
 def title(self, group_id):
     group = Group.query_by_id(group_id)
     return group.title
Beispiel #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"
Beispiel #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)
Beispiel #4
0
 def index(self, filter = ""):
     with session_scope() as s:
         return json.dumps([dict_group(group) for group in Group.list(s, filter)])
Beispiel #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"
Beispiel #6
0
 def title(self, group_id):
     group = Group.query_by_id(group_id)
     return group.title
Beispiel #7
0
 def create(self, title, password):
     group = Group(title, password)
     with session_scope() as s:
         s.add(group)
         return "OK"
     return "FAIL"
Beispiel #8
0
 def index(self, filter=""):
     with session_scope() as s:
         return json.dumps(
             [dict_group(group) for group in Group.list(s, filter)])
Beispiel #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)