def post(self): keys = [] item_count = int(self.request.get( "item_count", default_value=0)) for i in xrange(1, item_count+1): key = self.request.get("cb%s" % i) if key: keys.append(key) action = self.request.get("action") user = users.get_current_user() reload_nav = False if action == "Delete Checked": for key in keys: bm = db.get(key) if bm.owner != user: self.error(403) return if bm.is_folder: helper.delete_folder(bm) reload_nav = True else: bm.delete() if reload_nav: memcache.delete("nav") parent_key = self.request.get( "current_folder_key", default_value="") self.redirect("/my_bookmarks?key=" + parent_key)
def post(self): folder = self.get_folder() if folder is None: self.error(400) return parent_key = str(folder.bm_parent.key()) \ if folder.bm_parent else '' if self.request.get("action") == "Delete": helper.delete_folder(folder) memcache.delete("nav") self.redirect("/my_bookmarks?key=" + parent_key) return folder_name = self.request.get( "folder_name", default_value='').strip() shared = True if self.request.get( "shared", default_value=False) else False if not folder_name: err_msg = ["Folder name is required."] context = { "folder_name": folder_name, "shared": shared, "key": str(folder.key()), "parent_key": str(folder.bm_parent.key()), "err_msg": err_msg, "current_folder_path": helper.get_folder_path(folder.bm_parent), } self.render("edit_folder", context) else: folder.title = folder_name folder.shared = shared # shared property of all the bookmarks in the folder ??? folder.put() self.redirect("/my_bookmarks?key=" + parent_key)