summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2021-11-30 08:35:58 -0800
committerJohn L. Villalovos <john@sodarock.com>2021-11-30 08:35:58 -0800
commit1839c9e7989163a5cc9a201241942b7faca6e214 (patch)
treef6fcb4f19fb62e6db8234a6f96d367ec093cab27 /docs
parent09a973ee379d82af05a5080decfaec16d2f4eab3 (diff)
downloadgitlab-jlvillal/attribute_help.tar.gz
chore: attempt to be more informative for missing attributesjlvillal/attribute_help
A commonly reported issue from users on Gitter is that they get an AttributeError for an attribute that should be present. This is often caused due to the fact that they used the `list()` method to retrieve the object and objects retrieved this way often only have a subset of the full data. Add more details in the AttributeError message that explains the situation to users. This will hopefully allow them to resolve the issue. Update the FAQ in the docs to add a section discussing the issue. Closes #1138
Diffstat (limited to 'docs')
-rw-r--r--docs/faq.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/faq.rst b/docs/faq.rst
index 0f914ed..cdc81a8 100644
--- a/docs/faq.rst
+++ b/docs/faq.rst
@@ -16,6 +16,18 @@ I cannot edit the merge request / issue I've just retrieved
See the :ref:`merge requests example <merge_requests_examples>` and the
:ref:`issues examples <issues_examples>`.
+.. _attribute_error_list:
+
+I get an ``AttributeError`` when accessing attributes of an object retrieved via a ``list()`` call.
+ Fetching a list of objects, doesn’t always include all attributes in the
+ objects. To retrieve an object with all attributes use a ``get()`` call.
+
+ Example with projects::
+
+ for projects in gl.projects.list():
+ # Retrieve project object with all attributes
+ project = gl.projects.get(project.id)
+
How can I clone the repository of a project?
python-gitlab doesn't provide an API to clone a project. You have to use a
git library or call the ``git`` command.