def test_delete_and_in(self, db): with db.atomic(): for i in range(3): WikiGroupFactory.create() WikiGroup.delete().where(WikiGroup.id.in_([1,2])).execute() assert WikiGroup.select().count() == 1 assert WikiGroup.get_by_id(3)
def delete_group(wiki_group): # remove wiki group record in _admin.db WikiGroup.delete().where(WikiGroup.db_name == wiki_group).execute() # remove the database file os.remove(os.path.join(DB_PATH, '{0}.db'.format(wiki_group))) # remove uploaded files shutil.rmtree(os.path.join(DB_PATH, wiki_group)) # remove db name from cached db names current_app.active_wiki_groups.remove(wiki_group) return redirect(url_for('.super_admin'))