????
| Current Path : /proc/1724857/root/lib/python3.9/site-packages/ipalib/__pycache__/ |
| Current File : //proc/1724857/root/lib/python3.9/site-packages/ipalib/__pycache__/parameters.cpython-39.pyc |
a
�ji3 � @ sV d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z m
Z
ddlZddlm
Z ddlZddlmZ ddlmZ ddlmZmZ ddlmZmZmZ dd lmZmZmZm Z dd
l!m"Z"m#Z#m$Z$ ddlm%Z%m&Z& ddl'm(Z(m)Z) dd
l*m+Z+m,Z,m-Z- ddl'm.Z.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 dZ6dZ7e7 Z8dd� Z9ej:�rZe;Z<G dd� de�Z=dd� Z>e?� Z@dd� ZG dd� de�ZAG dd� deA�ZBG d d!� d!eB�ZCG d"d#� d#eA�ZDG d$d%� d%eD�ZEG d&d'� d'eD�ZFG d(d)� d)eA�ZGG d*d+� d+eG�ZHG d,d-� d-eA�ZIG d.d/� d/eA�ZJG d0d1� d1eG�ZKG d2d3� d3eK�ZLG d4d5� d5eK�ZMG d6d7� d7eA�ZNG d8d9� d9eN�ZOG d:d;� d;eN�ZPG d<d=� d=eN�ZQG d>d?� d?eA�ZRG d@dA� dAeK�ZSG dBdC� dCeH�ZTG dDdE� dEeA�ZUG dFdG� dGeK�ZVG dHdI� dIeA�ZWdJdK� ZXG dLdM� dMeA�ZYG dNdO� dOeA�ZZG dPdQ� dQeA�Z[e,ejIe5ej\j]iZ^dRdS� Z_G dTdU� dUeK�Z`dS )Va7
Parameter system for command plugins.
A `Param` instance can be used to describe an argument or option that a command
takes, or an attribute that a command returns. The `Param` base class is not
used directly, but there are many subclasses for specific Python data types
(like `Str` or `Int`) and specific properties (like `Password`).
To create a `Param` instance, you must always provide the parameter *name*,
which should be the LDAP attribute name if the parameter describes the attribute
of an LDAP entry. For example, we could create an `Str` instance describing the user's last-name attribute like this:
>>> from ipalib import Str
>>> sn = Str('sn')
>>> sn.name
'sn'
When creating a `Param`, there are also a number of optional kwargs which
which can provide additional meta-data and functionality. For example, every
parameter has a *cli_name*, the name used on the command-line-interface. By
default the *cli_name* is the same as the *name*:
>>> sn.cli_name
'sn'
But often the LDAP attribute name isn't user friendly for the command-line, so
you can override this with the *cli_name* kwarg:
>>> sn = Str('sn', cli_name='last')
>>> sn.name
'sn'
>>> sn.cli_name
'last'
Note that the RPC interfaces (and the internal processing pipeline) always use
the parameter *name*, regardless of what the *cli_name* might be.
A `Param` also has two translatable kwargs: *label* and *doc*. These must both
be `Gettext` instances. They both default to a place-holder `FixMe` instance,
a subclass of `Gettext` used to mark a missing translatable string:
>>> sn.label
FixMe('sn')
>>> sn.doc
FixMe('sn')
The *label* is a short phrase describing the parameter. It's used on the CLI
when interactively prompting for values, and as a label for form inputs in the
web-UI. The *label* should start with an initial capital. For example:
>>> from ipalib import _
>>> sn = Str('sn',
... cli_name='last',
... label=_('Last name'),
... )
>>> sn.label
Gettext('Last name', domain='ipa', localedir=None)
The *doc* is a longer description of the parameter. It's used on the CLI when
displaying the help information for a command, and as extra instruction for a
form input on the web-UI. By default the *doc* is the same as the *label*:
>>> sn.doc
Gettext('Last name', domain='ipa', localedir=None)
But you can override this with the *doc* kwarg. Like the *label*, the *doc*
should also start with an initial capital and should not end with any
punctuation. For example:
>>> sn = Str('sn',
... cli_name='last',
... label=_('Last name'),
... doc=_("The user's last name"),
... )
>>> sn.doc
Gettext("The user's last name", domain='ipa', localedir=None)
Demonstration aside, you should always provide at least the *label* so the
various UIs are translatable. Only provide the *doc* if the parameter needs
a more detailed description for clarity.
� N)�MAXINT�MININT)�x509)�_)�
check_name)�ReadOnly�lock)�ConversionError�RequirementError�ValidationError)�PasswordMismatch�Base64DecodeError�CertificateFormatError�CertificateOperationError)�
TYPE_ERROR�CALLABLE_ERROR�LDAP_GENERALIZED_TIME_FORMAT)�Gettext�FixMe)�json_serialize�validate_idna_domain)�load_der_x509_certificate�IPACertificate�default_backend)�strip_csr_header�apirepr)�kerberos)�DN)�DNSNamel �� l ���� c C s&