Source code for bard.plugs.undel
# bard/plugs/undel.py
#
#
""" undelete. """
__copyright__ = "Copyright 2014 B.H.J Thate"
## IMPORTS
from bard.utils import txt_parse
from bard.runtime import kernel
import logging
## CMNDS
[docs]def undel(event):
try: key, match = event.parsed.args
except ValueError: return
nr = 0
for obj in kernel.objects(**{"full": True}):
if key not in obj: continue
if match not in obj[key]: continue
if "deleted" not in obj: continue
obj.deleted = False
obj.sync()
nr += 1
event.ok(nr)
kernel.register("undel", undel)