-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathdelete_legacy.py
More file actions
31 lines (25 loc) · 810 Bytes
/
Copy pathdelete_legacy.py
File metadata and controls
31 lines (25 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from six.moves import input
import sys
from model import Polycule
import polycules
db = polycules.connect_db()
id = input('Enter the ID of the polycule to delete > ')
polycule = Polycule.get(db, int(id), None, force=True)
if polycule is None:
print('\nNo polycule with that ID found.')
db.close()
sys.exit(1)
if polycule.delete_pass is not None:
confirm = input(
'\nPolycule has a delete password, are you sure? [y/n] > ')
if confirm[0].lower() != 'y':
print('\nOkay, exiting without deleting.')
db.close()
sys.exit(1)
confirm = input(
'\nAre you sure you want to delete {}? [y/n] > '.format(id))
if confirm[0].lower() == 'y':
print('\nDeleting {}...'.format(id))
polycule.delete(None, force=True)
print('Polycule deleted.')
db.close()