summaryrefslogtreecommitdiffstats
path: root/source/python/samba/printerdata.py
diff options
context:
space:
mode:
authorCVS Import User <samba-bugs@samba.org>2004-04-04 11:51:10 +0000
committerCVS Import User <samba-bugs@samba.org>2004-04-04 11:51:10 +0000
commite3d2dbdff6711b0bc768fb6b08f41240f21d5fba (patch)
tree159ef54b59b18e9b950f5c6af105915214244912 /source/python/samba/printerdata.py
parent139b1658ca30692835c1a7203c7cd003e587ac12 (diff)
downloadsamba-e3d2dbdff6711b0bc768fb6b08f41240f21d5fba.tar.gz
samba-e3d2dbdff6711b0bc768fb6b08f41240f21d5fba.tar.xz
samba-e3d2dbdff6711b0bc768fb6b08f41240f21d5fba.zip
r6: merge in the samba4 HEAD branch from cvs
to checkout try: svn co svn+ssh://svn.samba.org/home/svn/samba/branches/SAMBA_4_0 metze
Diffstat (limited to 'source/python/samba/printerdata.py')
-rw-r--r--source/python/samba/printerdata.py65
1 files changed, 0 insertions, 65 deletions
diff --git a/source/python/samba/printerdata.py b/source/python/samba/printerdata.py
deleted file mode 100644
index 0b53a3dfb52..00000000000
--- a/source/python/samba/printerdata.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-
-#
-# 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
-#
-
-#
-# TODO:
-#
-# - Implement __delitem__
-#
-
-from samba import spoolss
-
-class printerdata:
- def __init__(self, host, creds = {}, access = 0x02000000):
- # For read access, use MAXIMUM_ALLOWED_ACCESS = 0x02000000
- # For write access, use PRINTER_ACCESS_ADMINISTER = 0x00000004
- self.hnd = spoolss.openprinter(host, creds = creds, access = access)
-
- 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})
-
-class printerdata_ex:
- def __init__(self, host, creds = {}, access = 0x02000000):
- # For read access, use MAXIMUM_ALLOWED_ACCESS = 0x02000000
- # For write access, use PRINTER_ACCESS_ADMINISTER = 0x00000004
- self.host = host
- self.top_level_keys = ["PrinterDriverData", "DsSpooler", "DsDriver",
- "DsUser"]
- self.creds = creds
- self.access = access
-
- def keys(self):
- return self.top_level_keys
-
- def has_key(self, key):
- for k in self.top_level_keys:
- if k == key:
- return 1
- return 0
-
- class printerdata_ex_subkey:
- def __init__(self, host, key, creds, access):
- self.hnd = spoolss.openprinter(host, creds, access)
- self.key = key
-
- def keys(self):
- return self.hnd.enumprinterdataex(self.key).keys()
-
- def __getitem__(self, key):
- return self.hnd.getprinterdataex(self.key, key)['data']
-
- def __getitem__(self, key):
- return self.printerdata_ex_subkey(self.host, key, creds, access)