From e29b45183f7c8332fbbf278d68249f3e62f6eb1c Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Mon, 6 Jun 2022 11:33:08 +0200 Subject: [PATCH 1/2] docs(ext): fix rendering for RequiredOptional dataclass --- docs/ext/manager_tmpl.j2 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/ext/manager_tmpl.j2 b/docs/ext/manager_tmpl.j2 index c6fd125ba..aef516496 100644 --- a/docs/ext/manager_tmpl.j2 +++ b/docs/ext/manager_tmpl.j2 @@ -7,21 +7,21 @@ {% if cls._create_attrs %} **Object Creation** -{% if cls._create_attrs[0] %} -Mandatory attributes for object create: +{% if cls._create_attrs.required %} +Required attributes for object create: {% for item in cls._create_attrs.required %} - ``{{ item }}`` {% endfor %} {% endif %} -{% if cls._create_attrs[1] %} +{% if cls._create_attrs.optional %} Optional attributes for object create: {% for item in cls._create_attrs.optional %} - ``{{ item }}`` {% endfor %} {% endif %} -{% if cls._create_attrs[2] %} +{% if cls._create_attrs.exclusive %} Mutually exclusive attributes for object create: -{% for item in cls._create_attrs.exlusive %} +{% for item in cls._create_attrs.exclusive %} - ``{{ item }}`` {% endfor %} {% endif %} @@ -29,21 +29,21 @@ Mutually exclusive attributes for object create: {% if cls._update_attrs %} **Object update** -{% if cls._update_attrs[0] %} -Mandatory attributes for object update: +{% if cls._update_attrs.required %} +Required attributes for object update: {% for item in cls._update_attrs.required %} - ``{{ item }}`` {% endfor %} {% endif %} -{% if cls._update_attrs[1] %} +{% if cls._update_attrs.optional %} Optional attributes for object update: {% for item in cls._update_attrs.optional %} - ``{{ item }}`` {% endfor %} {% endif %} -{% if cls._update_attrs[2] %} +{% if cls._update_attrs.exclusive %} Mutually exclusive attributes for object update: -{% for item in cls._update_attrs.exlusive %} +{% for item in cls._update_attrs.exclusive %} - ``{{ item }}`` {% endfor %} {% endif %} From 9571c47b08f3ef9733f506374ef7619c46214222 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Mon, 6 Jun 2022 11:38:54 +0200 Subject: [PATCH 2/2] docs(usage): refer to upsteam docs instead of custom attributes --- docs/api-usage.rst | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/api-usage.rst b/docs/api-usage.rst index 6d323b98e..426513af9 100644 --- a/docs/api-usage.rst +++ b/docs/api-usage.rst @@ -102,28 +102,26 @@ Examples: for project in group.projects.list(iterator=True): print(project) - # create a new user - user_data = {'email': 'jen@foo.com', 'username': 'jen', 'name': 'Jen'} - user = gl.users.create(user_data) - print(user) - .. warning:: Calling ``list()`` without any arguments will by default not return the complete list of items. Use either the ``all=True`` or ``iterator=True`` parameters to get all the items when using listing methods. See the :ref:`pagination` section for more information. -You can list the mandatory, optional, and mutually exclusive attributes for object -creation and update with the manager's ``get_create_attrs()`` and ``get_update_attrs()`` -methods. They return 3 tuples. The first tuple is the list of mandatory attributes. -The second tuple is the list of optional attributes. The third tuple is the mutually -exclusive attributes: - .. code-block:: python - # v4 only - print(gl.projects.get_create_attrs()) - (('name',), ('path', 'namespace_id', ...)) + # create a new user + user_data = {'email': 'jen@foo.com', 'username': 'jen', 'name': 'Jen'} + user = gl.users.create(user_data) + print(user) + +.. note:: + python-gitlab attempts to sync the required, optional, and mutually exclusive attributes + for resource creation and update with the upstream API. + + You are encouraged to follow upstream API documentation for each resource to find these - + each resource documented here links to the corresponding upstream resource documentation + at the top of the page. The attributes of objects are defined upon object creation, and depend on the GitLab API itself. To list the available information associated with an object pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy