Exemplo n.º 1
0
 def delete_notebook(self, notebook_id, modifier_id):
     notebook = Notebook.get_by_key(notebook_id)
     notebook.delete(modifier_id)
     query = Note.all()
     query.filter("notebook_id =", notebook_id)
     query.set("notebook_id", EMPTY_UID)
     query.set("is_trashed", True)
     query.update(modifier_id)
     query = Notebook.all()
     return True
Exemplo n.º 2
0
 def create_notebook(self, notebook, modifier_id):
     query = Notebook.all()
     query.order("-nb_order")
     if query.count() > 0:
         notebook.nb_order = query.get().nb_order + 1
     else:
         notebook.nb_order = 1
     notebook.put(modifier_id)
     return notebook
Exemplo n.º 3
0
 def fetch_notebooks(self, user_id, sharetome=None, withnotecount=True):
     query = Notebook.all()
     if sharetome:
         group_ids = ContactService.get_instance().fetch_my_groups(user_id, onlyrtnids=True, include_self=False)
         if len(group_ids) > 0:
             query.filter("group_id in", group_ids)
         else:
             return []
     else:
         query.filter("creator_id =", user_id)
     query.order("nb_order")
     
     def notebook_proc(notebook):
         if withnotecount:
             notebook.notecount = self.get_notecount(False, user_id, notebook_id=notebook.uid)
     
     notebooks = query.fetch(model_proc=notebook_proc)
     return notebooks
Exemplo n.º 4
0
 def get_notebook(self, notebook_id):
     notebook = Notebook.get_by_key(notebook_id)
     return notebook