(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_lib, prev: FORMAT_DATE_TIME, next: FREE_DATE_TIME_CONTEXT)


FORMAT_SOGW_PROT - Translate a protection mask into a formatted string

Format:
    status, protection-string = vms_lib.format_sogw_prot \
            (protection-mask, [access-names], [ownership-names],
             [ownership-separator], [list-separator])
Returns:
status
Condition value as returned by LIB$FORMAT_SOGW_PROT.
protection-string
Formatted output.
Arguments:
protection-mask
16-bit protection value - Python integer.
access-names
Object of type 'vmsobj__access_names'.
ownership-names
Object of type 'vmsobj__ownership_names'.
ownership-separator
The separator string is inserted after the ownership name. The default value is ":".
list-separator
The separator string is placed between ownership/ access pairs. The default value is ",".
Examples:
>>> import pyvms
>>> import vms_lib

>>> print vms_lib.format_sogw_prot (0x1234)
(1, 'System: RWD, Owner: ED, Group: RED, World: WED')
>>>

>>> print vms_lib.format_sogw_prot (0x1234, None, None, '=', '|')
(1, 'System=RWD|Owner=ED|Group=RED|World=WED')
>>>

>>> accnam = vms_lib.get_accnam ()
>>> print accnam
<vmsobj__access_names, ACCESS_NAMES at 0x002a241c>
>>> accnam[0] = 'r'
>>> accnam[1] = 'w'
>>> accnam[2] = 'e'
>>> accnam[3] = 'd'
>>> print accnam[0:4]
['r', 'w', 'e', 'd']
>>> print vms_lib.format_sogw_prot (0x1234, accnam, None, '=', '|')
(1, 'System=rwd|Owner=ed|Group=red|World=wed')
>>>

>>> ownshp = pyvms.vmsobj__ownership_names ()
>>> print ownshp
<vmsobj__ownership_names, OWNERSHIP_NAMES at 0x00298590>
>>> print ownshp [0:4]
['SYSTEM', 'OWNER', 'GROUP', 'WORLD']
>>>
>>> print vms_lib.format_sogw_prot (0x1234, accnam, ownshp, '=', '|')
(1, 'SYSTEM=rwd|OWNER=ed|GROUP=red|WORLD=wed')
>>>

>>> ownshp [0] = 'sys'
>>> ownshp [1] = 'own'
>>> ownshp [2] = 'grp'
>>> ownshp [3] = 'wld'
>>> print ownshp [0:4]
['sys', 'own', 'grp', 'wld']
>>>
>>> print vms_lib.format_sogw_prot (0x1234, accnam, ownshp, '=', '|')
(1, 'sys=rwd|own=ed|grp=red|wld=wed')
>>>


>>> print vms_lib.format_sogw_prot (0x1234, 'X')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: access_names - must be\
 vmsobj__access_names or None
>>>

>>> print vms_lib.format_sogw_prot (0x1234, None, 'X')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 3: ownership_names - must be\
 vmsobj__ownership_names or None
>>>

(go to: table of contents, index, list of vms_lib, prev: FORMAT_DATE_TIME, next: FREE_DATE_TIME_CONTEXT)

12-AUG-1999 ZE.