From a2327b84858453ff250b7635f423ae94edf2740b Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Fri, 6 Sep 2002 07:34:57 +0000 Subject: Move printerdata dictionary object into it's own file. (This used to be commit c211d2deca1019d3ef9bd08f5a01e76ede2d0191) --- source3/python/printerdata.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 source3/python/printerdata.py (limited to 'source3/python/printerdata.py') diff --git a/source3/python/printerdata.py b/source3/python/printerdata.py new file mode 100644 index 0000000000..55b5fdf6ae --- /dev/null +++ b/source3/python/printerdata.py @@ -0,0 +1,23 @@ +# +# A python module that maps printerdata to a dictionary. We define +# two classes. The printerdata class maps to Get/Set/Enum/DeletePrinterData +# and the printerdata_ex class maps to Get/Set/Enum/DeletePrinterDataEx +# + +import spoolss + +class printerdata: + def __init__(self, host, creds = {}): + self.hnd = spoolss.openprinter(host, creds = creds) + + def keys(self): + return self.hnd.enumprinterdata().keys() + + def __getitem__(self, key): + return self.hnd.getprinterdata(key)['data'] + + def __setitem__(self, key, value): + # Store as REG_BINARY for now + self.hnd.setprinterdata({"key": "", "value": key, "type": 3, + "data": value}) + -- cgit