D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
lib
/
python3.9
/
site-packages
/
ipalib
/
__pycache__
/
Filename :
parameters.cpython-39.opt-1.pyc
back
Copy
a }�fk2 � @ sN d Z ddlZddlZddlZddlZddlZddlZddlmZm Z ddl Z ddlmZ ddlZddlmZ ddlmZ ddlmZmZ ddlmZmZmZ dd lmZmZmZmZ 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. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 dZ5dZ6e6 Z7dd� Z8e j9�rRe:Z;G dd� de�Z<dd� Z=e>� Z?dd� ZG dd� de�Z@G dd� de@�ZAG d d!� d!eA�ZBG d"d#� d#e@�ZCG d$d%� d%eC�ZDG d&d'� d'eC�ZEG d(d)� d)e@�ZFG d*d+� d+eF�ZGG d,d-� d-e@�ZHG d.d/� d/e@�ZIG d0d1� d1eF�ZJG d2d3� d3eJ�ZKG d4d5� d5eJ�ZLG d6d7� d7e@�ZMG d8d9� d9eM�ZNG d:d;� d;eM�ZOG d<d=� d=eM�ZPG d>d?� d?e@�ZQG d@dA� dAeJ�ZRG dBdC� dCeG�ZSG dDdE� dEe@�ZTG dFdG� dGeJ�ZUG dHdI� dIe@�ZVdJdK� ZWG dLdM� dMe@�ZXG dNdO� dOe@�ZYG dPdQ� dQe@�ZZe+e jHe4ej[j\iZ]dRdS� Z^G dTdU� dUeJ�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&