File: //usr/lib/python3.9/site-packages/ipalib/__pycache__/output.cpython-39.pyc
a
}�f? � @ s� d Z ddlZddlmZmZ ddlmZ ddlmZ ddl m
Z
ejrJeZ
G dd� de�ZG d d
� d
e�ZdZG dd
� d
e�ZG dd� de�ZG dd� de�Zeded�d�Zede
ed�fed��Zedded�dgd�ZeefZeed�efZeed�edeed��edeed��fZeedeed��efZeedeed��eddgd�fZeedeed ��efZ e Z!eedeed ��ede
dgd�fZ"eed�ede
dgd�fZ#dS )!z&
Simple description of return values.
� N)�ReadOnly�lock)�client_has_capability)�_)�apireprc @ s@ e Zd ZdZdZdZdZg Zddg fdd�Zdd� Z dd� Z
dS ) �Outputa
Simple description of a member in the return value ``dict``.
This class controls both the type of object being returned by
a command as well as how the output will be displayed.
For example, this class defines two return results: an entry
and a value.
>>> from ipalib import crud, output
>>> class user(crud.Update):
...
... has_output = (
... output.Entry('result'),
... output.value,
... )
The order of the values in has_output controls the order of output.
If you have values that you don't want to be printed then add
``'no_display'`` to flags.
The difference between ``'no_display'`` and ``'no_output'`` is
that ``'no_output'`` will prevent a Param value from being returned
at all. ``'no_display'`` will cause the API to return a value, it
simply won't be displayed to the user. This is so some things may
be returned that while not interesting to us, but may be to others.
>>> from ipalib import crud, output
>>> myvalue = output.Output('myvalue', unicode,
... 'Do not print this value', flags=['no_display'],
... )
>>> class user(crud.Update):
...
... has_output = (
... output.Entry('result'),
... myvalue,
... )
Nc C sD || _ |d ur$t|t�s|f}|| _|d ur2|| _|| _t| � d S �N)�name�
isinstance�tuple�type�doc�flagsr )�selfr r r
r � r �1/usr/lib/python3.9/site-packages/ipalib/output.py�__init__N s
zOutput.__init__c C s d| j jd�| �� �f S )Nz%s(%s)z, )� __class__�__name__�join�_Output__repr_iter)r r r r �__repr__Y s �zOutput.__repr__c c sZ t | j�V dD ]D}| j�|�}|s&qt|t�r>tt|��}nt |�}d||f V qd S )N)r r
r z%s=%s)�reprr �__dict__�getr
r r �list)r �key�valuer r r Z__repr_iter_ s
zOutput.__repr_iter)r �
__module__�__qualname__�__doc__r �validater
r r r r r r r r r ! s 'r c @ s e Zd ZeZed�ZdS )�Entryz'A dictionary representing an LDAP entryN)r r r �dictr r r
r r r r r"