-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/python | ||
# coding=utf-8 | ||
# region License | ||
# Findeco is dually licensed under GPLv3 or later and MPLv2. | ||
# | ||
################################################################################ | ||
# Copyright (c) 2012 Klaus Greff <[email protected]> | ||
# This file is part of Findeco. | ||
# | ||
# Findeco is free software; you can redistribute it and/or modify it under | ||
# the terms of the GNU General Public License as published by the Free Software | ||
# Foundation; either version 3 of the License, or (at your option) any later | ||
# version. | ||
# | ||
# Findeco is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# Findeco. If not, see <http://www.gnu.org/licenses/>. | ||
################################################################################ | ||
# | ||
################################################################################ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
#endregion ##################################################################### | ||
|
||
from __future__ import division, print_function, unicode_literals | ||
|
||
from django.core.management import BaseCommand | ||
from node_storage.path_helpers import get_node_for_path | ||
from node_storage.tools import delete_node | ||
|
||
|
||
class Command(BaseCommand): | ||
args = '<NodePath>' | ||
help = 'Delete a node and all children, votes, posts, derivates, ' \ | ||
'cache entries, arguments, and empty parents associated with it. '\ | ||
'BE CAREFUL: This operation cannot be undone! Backup your Database!' | ||
|
||
def handle(self, *args, **options): | ||
if len(args) < 1: | ||
print("You have to provide a <NodePath>.") | ||
|
||
if len(args) > 1: | ||
print("Please provide exactly one argument!") | ||
|
||
node_path = args[0] | ||
|
||
node = get_node_for_path(node_path) | ||
assert node, "Node for path '%s' does not exist." % node_path | ||
|
||
delete_node(node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters