-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove a deprecation warning, add datasource/recipient_discard
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 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,32 @@ | ||
#!/usr/bin/env python | ||
#-*- encoding: utf-8 -*- | ||
# | ||
# Copyright Gerhard Lausser. | ||
# This software is licensed under the | ||
# GNU Affero General Public License version 3 (see the file LICENSE). | ||
|
||
import logging | ||
import coshsh | ||
from coshsh.datarecipient import Datarecipient | ||
from coshsh.util import compare_attr | ||
|
||
|
||
logger = logging.getLogger('coshsh') | ||
|
||
|
||
def __dr_ident__(params={}): | ||
if compare_attr("type", params, "discard"): | ||
return DrDiscard | ||
|
||
|
||
class DrDiscard(coshsh.datarecipient.Datarecipient): | ||
def __init__(self, **kwargs): | ||
self.name = kwargs["name"] | ||
|
||
def read(self, filter=None, objects={}, force=False, **kwargs): | ||
self.objects = objects | ||
|
||
def output(self): | ||
# this is only used to prevent the default recipient from kicking in | ||
pass | ||
|
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,29 @@ | ||
#!/usr/bin/env python | ||
#-*- encoding: utf-8 -*- | ||
# | ||
# Copyright Gerhard Lausser. | ||
# This software is licensed under the | ||
# GNU Affero General Public License version 3 (see the file LICENSE). | ||
|
||
import logging | ||
import coshsh | ||
from coshsh.datasource import Datasource | ||
from coshsh.util import compare_attr | ||
|
||
|
||
logger = logging.getLogger('coshsh') | ||
|
||
|
||
def __ds_ident__(params={}): | ||
if coshsh.util.compare_attr("type", params, "discard"): | ||
return DsDiscard | ||
|
||
|
||
class DsDiscard(coshsh.datasource.Datasource): | ||
def __init__(self, **kwargs): | ||
super(self.__class__, self).__init__(**kwargs) | ||
|
||
def read(self, filter=None, objects={}, force=False, **kwargs): | ||
self.objects = objects | ||
for k in self.objects.keys(): | ||
self.objects[k] = {} |