Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add docstrings

Marcin Gębalab80a811ba72b
diff --git a/saleor/graphql/core/mutations.py b/saleor/graphql/core/mutations.py
index 49ef838be5..58f556622c 100644
--- a/saleor/graphql/core/mutations.py
+++ b/saleor/graphql/core/mutations.py
@@ -13,7 +13,8 @@ from .types import Error
registry = get_global_registry()
-def fields_for_form(form_class):
+def convert_form_fields(form_class):
+ """Convert form fields to Graphene fields"""
fields = OrderedDict()
for name, field in form_class.base_fields.items():
fields[name] = convert_form_field(field)
@@ -62,7 +63,7 @@ class ModelFormMutation(BaseMutation):
return_field_name = model_name[:1].lower() + model_name[1:]
# get mutation arguments based on model form
- arguments = fields_for_form(form_class)
+ arguments = convert_form_fields(form_class)
# get mutation output field for model instance
fields = {return_field_name: graphene.Field(model_type)}
diff --git a/saleor/graphql/utils.py b/saleor/graphql/utils.py
index c28c669bdb..41ee2d0e7e 100644
--- a/saleor/graphql/utils.py
+++ b/saleor/graphql/utils.py
@@ -19,6 +19,7 @@ class CategoryAncestorsCache:
def get_node(info, id, only_type=None):
+ """Return node or throw an error if the node with given ID does not exist."""
node = graphene.Node.get_node_from_global_id(info, id, only_type=only_type)
if not node:
raise Exception(