From 0e189ad2edff00ad45f929e09b2bd976029dce90 Mon Sep 17 00:00:00 2001 From: mymage Date: Wed, 10 Jan 2024 14:34:36 +0000 Subject: [PATCH 1/4] Added translation using Weblate (Italian) --- graphql_base/i18n/it.po | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 graphql_base/i18n/it.po diff --git a/graphql_base/i18n/it.po b/graphql_base/i18n/it.po new file mode 100644 index 00000000..eab72751 --- /dev/null +++ b/graphql_base/i18n/it.po @@ -0,0 +1,20 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * graphql_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: graphql_base +#: model_terms:ir.ui.view,arch_db:graphql_base.graphiql +msgid "Loading..." +msgstr "" From 0a010ca75f17b5f4c6f8ee22f63693aec999df98 Mon Sep 17 00:00:00 2001 From: mymage Date: Mon, 15 Jan 2024 14:57:56 +0000 Subject: [PATCH 2/4] Translated using Weblate (Italian) Currently translated at 100.0% (1 of 1 strings) Translation: rest-framework-16.0/rest-framework-16.0-graphql_base Translate-URL: https://translation.odoo-community.org/projects/rest-framework-16-0/rest-framework-16-0-graphql_base/it/ --- graphql_base/i18n/it.po | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/graphql_base/i18n/it.po b/graphql_base/i18n/it.po index eab72751..ac2289a8 100644 --- a/graphql_base/i18n/it.po +++ b/graphql_base/i18n/it.po @@ -6,15 +6,17 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2024-01-15 17:34+0000\n" +"Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" #. module: graphql_base #: model_terms:ir.ui.view,arch_db:graphql_base.graphiql msgid "Loading..." -msgstr "" +msgstr "Caricamento ..." From 3691eaa06fe60f1f73b0fdf12b912c58f82ed58d Mon Sep 17 00:00:00 2001 From: Diogo Duarte Date: Mon, 19 Aug 2024 16:05:19 +0100 Subject: [PATCH 3/4] [MIG] graphql_base: Migration to 17.0 --- .pre-commit-config.yaml | 2 - graphql_base/README.rst | 108 +++++++++--------- graphql_base/__manifest__.py | 4 +- graphql_base/controllers/main.py | 2 +- graphql_base/pyproject.toml | 3 + graphql_base/readme/DESCRIPTION.md | 5 + graphql_base/readme/DESCRIPTION.rst | 6 - graphql_base/readme/USAGE.md | 61 ++++++++++ graphql_base/readme/USAGE.rst | 62 ---------- graphql_base/static/description/index.html | 66 +++++------ graphql_base/types.py | 2 +- graphql_demo/README.rst | 24 ++-- graphql_demo/__manifest__.py | 5 +- graphql_demo/controllers/main.py | 1 - graphql_demo/i18n/it.po | 31 +++++ graphql_demo/pyproject.toml | 3 + .../{DESCRIPTION.rst => DESCRIPTION.md} | 4 +- graphql_demo/readme/USAGE.md | 5 + graphql_demo/readme/USAGE.rst | 5 - graphql_demo/static/description/index.html | 22 ++-- graphql_demo/tests/test_graphene.py | 2 +- requirements.txt | 2 + 22 files changed, 231 insertions(+), 194 deletions(-) create mode 100644 graphql_base/pyproject.toml create mode 100644 graphql_base/readme/DESCRIPTION.md delete mode 100644 graphql_base/readme/DESCRIPTION.rst create mode 100644 graphql_base/readme/USAGE.md delete mode 100644 graphql_base/readme/USAGE.rst create mode 100644 graphql_demo/i18n/it.po create mode 100644 graphql_demo/pyproject.toml rename graphql_demo/readme/{DESCRIPTION.rst => DESCRIPTION.md} (59%) create mode 100644 graphql_demo/readme/USAGE.md delete mode 100644 graphql_demo/readme/USAGE.rst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 18638b3a..8d47337b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,8 +13,6 @@ exclude: | ^extendable_fastapi/| ^fastapi_auth_jwt/| ^fastapi_auth_jwt_demo/| - ^graphql_base/| - ^graphql_demo/| ^model_serializer/| ^rest_log/| # END NOT INSTALLABLE ADDONS diff --git a/graphql_base/README.rst b/graphql_base/README.rst index ee1454b6..f73b655b 100644 --- a/graphql_base/README.rst +++ b/graphql_base/README.rst @@ -17,23 +17,22 @@ Graphql Base :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github - :target: https://github.com/OCA/rest-framework/tree/16.0/graphql_base + :target: https://github.com/OCA/rest-framework/tree/17.0/graphql_base :alt: OCA/rest-framework .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/rest-framework-16-0/rest-framework-16-0-graphql_base + :target: https://translation.odoo-community.org/projects/rest-framework-17-0/rest-framework-17-0-graphql_base :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This modules enables the creation of `GraphQL `__ endpoints. -In itself, it does nothing and must be used by a developer to +This modules enables the creation of `GraphQL `__ +endpoints. In itself, it does nothing and must be used by a developer to create the GraphQL schema and resolvers using -`graphene `__, -and expose them through a controller. -An example is available in the ``graphql_demo`` module. +`graphene `__, and expose them through a +controller. An example is available in the ``graphql_demo`` module. **Table of contents** @@ -45,66 +44,67 @@ Usage To use this module, you need to -- create your graphene schema -- create your controller to expose your GraphQL endpoint, - and optionally a GraphiQL IDE. +- create your graphene schema +- create your controller to expose your GraphQL endpoint, and + optionally a GraphiQL IDE. -This module does not attempt to expose the whole Odoo object model. -This could be the purpose of another module based on this one. -We believe however that it is preferable to expose a specific well tested -endpoint for each customer, so as to reduce coupling by knowing precisely -what is exposed and needs to be tested when upgrading Odoo. +This module does not attempt to expose the whole Odoo object model. This +could be the purpose of another module based on this one. We believe +however that it is preferable to expose a specific well tested endpoint +for each customer, so as to reduce coupling by knowing precisely what is +exposed and needs to be tested when upgrading Odoo. To start working with this module, we recommend the following approach: -- Learn `GraphQL basics `__ -- Learn `graphene `__, the python library - used to create GraphQL schemas and resolvers. -- Examine the ``graphql_demo`` module in this repo, copy it, - adapt the controller to suit your needs (routes, authentication methods). -- Start building your own schema and resolver. +- Learn `GraphQL basics `__ +- Learn `graphene `__, the python library + used to create GraphQL schemas and resolvers. +- Examine the ``graphql_demo`` module in this repo, copy it, adapt the + controller to suit your needs (routes, authentication methods). +- Start building your own schema and resolver. Building your schema -~~~~~~~~~~~~~~~~~~~~ +-------------------- -The schema can be built using native graphene types. -An ``odoo.addons.graphql_base.types.OdooObjectType`` -is provided as a convenience. It is a graphene ``ObjectType`` with a -default attribute resolver which: +The schema can be built using native graphene types. An +``odoo.addons.graphql_base.types.OdooObjectType`` is provided as a +convenience. It is a graphene ``ObjectType`` with a default attribute +resolver which: -- converts False to None (except for Boolean types), to avoid Odoo's weird - ``False`` strings being rendered as json ``"false"``; -- adds the user timezone to Datetime fields; -- raises an error if an attribute is absent to avoid field name typing errors. +- converts False to None (except for Boolean types), to avoid Odoo's + weird ``False`` strings being rendered as json ``"false"``; +- adds the user timezone to Datetime fields; +- raises an error if an attribute is absent to avoid field name typing + errors. Creating GraphQL controllers -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +---------------------------- -The module provides an ``odoo.addons.graphql_base.GraphQLControllerMixin`` -class to help you build GraphQL controllers providing GraphiQL and/or GraphQL -endpoints. +The module provides an +``odoo.addons.graphql_base.GraphQLControllerMixin`` class to help you +build GraphQL controllers providing GraphiQL and/or GraphQL endpoints. -.. code-block:: python +.. code:: python - from odoo import http - from odoo.addons.graphql_base import GraphQLControllerMixin + from odoo import http + from odoo.addons.graphql_base import GraphQLControllerMixin - from ..schema import schema + from ..schema import schema - class GraphQLController(http.Controller, GraphQLControllerMixin): + class GraphQLController(http.Controller, GraphQLControllerMixin): - # The GraphiQL route, providing an IDE for developers - @http.route("/graphiql/demo", auth="user") - def graphiql(self, **kwargs): - return self._handle_graphiql_request(schema) + # The GraphiQL route, providing an IDE for developers + @http.route("/graphiql/demo", auth="user") + def graphiql(self, **kwargs): + return self._handle_graphiql_request(schema) - # The graphql route, for applications. - # Note csrf=False: you may want to apply extra security - # (such as origin restrictions) to this route. - @http.route("/graphql/demo", auth="user", csrf=False) - def graphql(self, **kwargs): - return self._handle_graphql_request(schema) + # The graphql route, for applications. + # Note csrf=False: you may want to apply extra security + # (such as origin restrictions) to this route. + @http.route("/graphql/demo", auth="user", csrf=False) + def graphql(self, **kwargs): + return self._handle_graphql_request(schema) Bug Tracker =========== @@ -112,7 +112,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -120,12 +120,12 @@ Credits ======= Authors -~~~~~~~ +------- * ACSONE SA/NV Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -145,6 +145,6 @@ Current `maintainer `__: |maintainer-sbidoul| -This module is part of the `OCA/rest-framework `_ project on GitHub. +This module is part of the `OCA/rest-framework `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/graphql_base/__manifest__.py b/graphql_base/__manifest__.py index 0cf75a33..e4f3a1c3 100644 --- a/graphql_base/__manifest__.py +++ b/graphql_base/__manifest__.py @@ -5,7 +5,7 @@ "name": "Graphql Base", "summary": """ Base GraphQL/GraphiQL controller""", - "version": "16.0.1.0.1", + "version": "17.0.1.0.1", "license": "LGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/rest-framework", @@ -14,5 +14,5 @@ "external_dependencies": {"python": ["graphene", "graphql_server"]}, "development_status": "Production/Stable", "maintainers": ["sbidoul"], - "installable": False, + "installable": True, } diff --git a/graphql_base/controllers/main.py b/graphql_base/controllers/main.py index fe195f66..ca2469df 100644 --- a/graphql_base/controllers/main.py +++ b/graphql_base/controllers/main.py @@ -15,7 +15,7 @@ from odoo import http -class GraphQLControllerMixin(object): +class GraphQLControllerMixin: def _parse_body(self): req = http.request.httprequest # We use mimetype here since we don't need the other diff --git a/graphql_base/pyproject.toml b/graphql_base/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/graphql_base/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/graphql_base/readme/DESCRIPTION.md b/graphql_base/readme/DESCRIPTION.md new file mode 100644 index 00000000..7e47902a --- /dev/null +++ b/graphql_base/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +This modules enables the creation of [GraphQL](https://graphql.org/) +endpoints. In itself, it does nothing and must be used by a developer to +create the GraphQL schema and resolvers using +[graphene](https://graphene-python.org/), and expose them through a +controller. An example is available in the `graphql_demo` module. diff --git a/graphql_base/readme/DESCRIPTION.rst b/graphql_base/readme/DESCRIPTION.rst deleted file mode 100644 index bc975b21..00000000 --- a/graphql_base/readme/DESCRIPTION.rst +++ /dev/null @@ -1,6 +0,0 @@ -This modules enables the creation of `GraphQL `__ endpoints. -In itself, it does nothing and must be used by a developer to -create the GraphQL schema and resolvers using -`graphene `__, -and expose them through a controller. -An example is available in the ``graphql_demo`` module. diff --git a/graphql_base/readme/USAGE.md b/graphql_base/readme/USAGE.md new file mode 100644 index 00000000..067e857a --- /dev/null +++ b/graphql_base/readme/USAGE.md @@ -0,0 +1,61 @@ +To use this module, you need to + + - create your graphene schema + - create your controller to expose your GraphQL endpoint, and + optionally a GraphiQL IDE. + +This module does not attempt to expose the whole Odoo object model. This +could be the purpose of another module based on this one. We believe +however that it is preferable to expose a specific well tested endpoint +for each customer, so as to reduce coupling by knowing precisely what is +exposed and needs to be tested when upgrading Odoo. + +To start working with this module, we recommend the following approach: + + - Learn [GraphQL basics](https://graphql.org/learn/) + - Learn [graphene](https://graphene-python.org/), the python library + used to create GraphQL schemas and resolvers. + - Examine the `graphql_demo` module in this repo, copy it, adapt the + controller to suit your needs (routes, authentication methods). + - Start building your own schema and resolver. + +## Building your schema + +The schema can be built using native graphene types. An +`odoo.addons.graphql_base.types.OdooObjectType` is provided as a +convenience. It is a graphene `ObjectType` with a default attribute +resolver which: + + - converts False to None (except for Boolean types), to avoid Odoo's + weird `False` strings being rendered as json `"false"`; + - adds the user timezone to Datetime fields; + - raises an error if an attribute is absent to avoid field name typing + errors. + +## Creating GraphQL controllers + +The module provides an `odoo.addons.graphql_base.GraphQLControllerMixin` +class to help you build GraphQL controllers providing GraphiQL and/or +GraphQL endpoints. + +``` python +from odoo import http +from odoo.addons.graphql_base import GraphQLControllerMixin + +from ..schema import schema + + +class GraphQLController(http.Controller, GraphQLControllerMixin): + + # The GraphiQL route, providing an IDE for developers + @http.route("/graphiql/demo", auth="user") + def graphiql(self, **kwargs): + return self._handle_graphiql_request(schema) + + # The graphql route, for applications. + # Note csrf=False: you may want to apply extra security + # (such as origin restrictions) to this route. + @http.route("/graphql/demo", auth="user", csrf=False) + def graphql(self, **kwargs): + return self._handle_graphql_request(schema) +``` diff --git a/graphql_base/readme/USAGE.rst b/graphql_base/readme/USAGE.rst deleted file mode 100644 index 18dad495..00000000 --- a/graphql_base/readme/USAGE.rst +++ /dev/null @@ -1,62 +0,0 @@ -To use this module, you need to - -- create your graphene schema -- create your controller to expose your GraphQL endpoint, - and optionally a GraphiQL IDE. - -This module does not attempt to expose the whole Odoo object model. -This could be the purpose of another module based on this one. -We believe however that it is preferable to expose a specific well tested -endpoint for each customer, so as to reduce coupling by knowing precisely -what is exposed and needs to be tested when upgrading Odoo. - -To start working with this module, we recommend the following approach: - -- Learn `GraphQL basics `__ -- Learn `graphene `__, the python library - used to create GraphQL schemas and resolvers. -- Examine the ``graphql_demo`` module in this repo, copy it, - adapt the controller to suit your needs (routes, authentication methods). -- Start building your own schema and resolver. - -Building your schema -~~~~~~~~~~~~~~~~~~~~ - -The schema can be built using native graphene types. -An ``odoo.addons.graphql_base.types.OdooObjectType`` -is provided as a convenience. It is a graphene ``ObjectType`` with a -default attribute resolver which: - -- converts False to None (except for Boolean types), to avoid Odoo's weird - ``False`` strings being rendered as json ``"false"``; -- adds the user timezone to Datetime fields; -- raises an error if an attribute is absent to avoid field name typing errors. - -Creating GraphQL controllers -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The module provides an ``odoo.addons.graphql_base.GraphQLControllerMixin`` -class to help you build GraphQL controllers providing GraphiQL and/or GraphQL -endpoints. - -.. code-block:: python - - from odoo import http - from odoo.addons.graphql_base import GraphQLControllerMixin - - from ..schema import schema - - - class GraphQLController(http.Controller, GraphQLControllerMixin): - - # The GraphiQL route, providing an IDE for developers - @http.route("/graphiql/demo", auth="user") - def graphiql(self, **kwargs): - return self._handle_graphiql_request(schema) - - # The graphql route, for applications. - # Note csrf=False: you may want to apply extra security - # (such as origin restrictions) to this route. - @http.route("/graphql/demo", auth="user", csrf=False) - def graphql(self, **kwargs): - return self._handle_graphql_request(schema) diff --git a/graphql_base/static/description/index.html b/graphql_base/static/description/index.html index 00742914..d49f71a9 100644 --- a/graphql_base/static/description/index.html +++ b/graphql_base/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,13 +369,12 @@

Graphql Base

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:7cce5e4816ad8b14f69ef2998f98b1fa1ae2ff494da1ca0c1a247b4ababdd463 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runboat

-

This modules enables the creation of GraphQL endpoints. -In itself, it does nothing and must be used by a developer to +

Production/Stable License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runboat

+

This modules enables the creation of GraphQL +endpoints. In itself, it does nothing and must be used by a developer to create the GraphQL schema and resolvers using -graphene, -and expose them through a controller. -An example is available in the graphql_demo module.

+graphene, and expose them through a +controller. An example is available in the graphql_demo module.

Table of contents

    @@ -397,41 +396,42 @@

    Usage

    To use this module, you need to

    • create your graphene schema
    • -
    • create your controller to expose your GraphQL endpoint, -and optionally a GraphiQL IDE.
    • +
    • create your controller to expose your GraphQL endpoint, and +optionally a GraphiQL IDE.
    -

    This module does not attempt to expose the whole Odoo object model. -This could be the purpose of another module based on this one. -We believe however that it is preferable to expose a specific well tested -endpoint for each customer, so as to reduce coupling by knowing precisely -what is exposed and needs to be tested when upgrading Odoo.

    +

    This module does not attempt to expose the whole Odoo object model. This +could be the purpose of another module based on this one. We believe +however that it is preferable to expose a specific well tested endpoint +for each customer, so as to reduce coupling by knowing precisely what is +exposed and needs to be tested when upgrading Odoo.

    To start working with this module, we recommend the following approach:

    • Learn GraphQL basics
    • Learn graphene, the python library used to create GraphQL schemas and resolvers.
    • -
    • Examine the graphql_demo module in this repo, copy it, -adapt the controller to suit your needs (routes, authentication methods).
    • +
    • Examine the graphql_demo module in this repo, copy it, adapt the +controller to suit your needs (routes, authentication methods).
    • Start building your own schema and resolver.

    Building your schema

    -

    The schema can be built using native graphene types. -An odoo.addons.graphql_base.types.OdooObjectType -is provided as a convenience. It is a graphene ObjectType with a -default attribute resolver which:

    +

    The schema can be built using native graphene types. An +odoo.addons.graphql_base.types.OdooObjectType is provided as a +convenience. It is a graphene ObjectType with a default attribute +resolver which:

      -
    • converts False to None (except for Boolean types), to avoid Odoo’s weird -False strings being rendered as json "false";
    • +
    • converts False to None (except for Boolean types), to avoid Odoo’s +weird False strings being rendered as json "false";
    • adds the user timezone to Datetime fields;
    • -
    • raises an error if an attribute is absent to avoid field name typing errors.
    • +
    • raises an error if an attribute is absent to avoid field name typing +errors.

    Creating GraphQL controllers

    -

    The module provides an odoo.addons.graphql_base.GraphQLControllerMixin -class to help you build GraphQL controllers providing GraphiQL and/or GraphQL -endpoints.

    +

    The module provides an +odoo.addons.graphql_base.GraphQLControllerMixin class to help you +build GraphQL controllers providing GraphiQL and/or GraphQL endpoints.

     from odoo import http
     from odoo.addons.graphql_base import GraphQLControllerMixin
    @@ -460,7 +460,7 @@ 

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -474,13 +474,15 @@

    Authors

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    Current maintainer:

    sbidoul

    -

    This module is part of the OCA/rest-framework project on GitHub.

    +

    This module is part of the OCA/rest-framework project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/graphql_base/types.py b/graphql_base/types.py index eb1e504b..6af554c5 100644 --- a/graphql_base/types.py +++ b/graphql_base/types.py @@ -38,6 +38,6 @@ def __init_subclass_with_meta__(cls, default_resolver=None, **options): if default_resolver is None: default_resolver = odoo_attr_resolver - return super(OdooObjectType, cls).__init_subclass_with_meta__( + return super().__init_subclass_with_meta__( default_resolver=default_resolver, **options ) diff --git a/graphql_demo/README.rst b/graphql_demo/README.rst index 2b86a78b..327d3cf9 100644 --- a/graphql_demo/README.rst +++ b/graphql_demo/README.rst @@ -17,19 +17,19 @@ GraphQL Demo :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github - :target: https://github.com/OCA/rest-framework/tree/16.0/graphql_demo + :target: https://github.com/OCA/rest-framework/tree/17.0/graphql_demo :alt: OCA/rest-framework .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/rest-framework-16-0/rest-framework-16-0-graphql_demo + :target: https://translation.odoo-community.org/projects/rest-framework-17-0/rest-framework-17-0-graphql_demo :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This is a demonstration module providing a sample GraphQL endpoint, -as well as tests for ``graphql_base``. +This is a demonstration module providing a sample GraphQL endpoint, as +well as tests for ``graphql_base``. **Table of contents** @@ -41,9 +41,9 @@ Usage This module can be used in different ways: -* as an example: copy the code and hack your way; -* to test ``graphql_base`` (install it with ``--test-enable``); -* on runbot, login and change the url to ``/graphiql/demo``. +- as an example: copy the code and hack your way; +- to test ``graphql_base`` (install it with ``--test-enable``); +- on runbot, login and change the url to ``/graphiql/demo``. Bug Tracker =========== @@ -51,7 +51,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -59,12 +59,12 @@ Credits ======= Authors -~~~~~~~ +------- * ACSONE SA/NV Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -84,6 +84,6 @@ Current `maintainer `__: |maintainer-sbidoul| -This module is part of the `OCA/rest-framework `_ project on GitHub. +This module is part of the `OCA/rest-framework `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/graphql_demo/__manifest__.py b/graphql_demo/__manifest__.py index fe9e865e..eedab572 100644 --- a/graphql_demo/__manifest__.py +++ b/graphql_demo/__manifest__.py @@ -3,13 +3,12 @@ { "name": "GraphQL Demo", - "version": "16.0.1.0.1", + "version": "17.0.1.0.1", "license": "LGPL-3", "author": "ACSONE SA/NV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/rest-framework", "depends": ["graphql_base"], - "external_dependencies": {"python": ["graphene"]}, "development_status": "Beta", "maintainers": ["sbidoul"], - "installable": False, + "installable": True, } diff --git a/graphql_demo/controllers/main.py b/graphql_demo/controllers/main.py index aa75cdf7..6ec163e9 100644 --- a/graphql_demo/controllers/main.py +++ b/graphql_demo/controllers/main.py @@ -9,7 +9,6 @@ class GraphQLController(http.Controller, GraphQLControllerMixin): - # The GraphiQL route, providing an IDE for developers @http.route("/graphiql/demo", auth="user") def graphiql(self, **kwargs): diff --git a/graphql_demo/i18n/it.po b/graphql_demo/i18n/it.po new file mode 100644 index 00000000..50287490 --- /dev/null +++ b/graphql_demo/i18n/it.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * graphql_demo +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-07-01 11:47+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: graphql_demo +#. odoo-python +#: code:addons/graphql_demo/schema.py:0 +#, python-format +msgid "UserError example" +msgstr "Esempio errore utente" + +#. module: graphql_demo +#. odoo-python +#: code:addons/graphql_demo/schema.py:0 +#, python-format +msgid "as requested" +msgstr "come richiesto" diff --git a/graphql_demo/pyproject.toml b/graphql_demo/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/graphql_demo/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/graphql_demo/readme/DESCRIPTION.rst b/graphql_demo/readme/DESCRIPTION.md similarity index 59% rename from graphql_demo/readme/DESCRIPTION.rst rename to graphql_demo/readme/DESCRIPTION.md index 9be14d69..bc29cbcb 100644 --- a/graphql_demo/readme/DESCRIPTION.rst +++ b/graphql_demo/readme/DESCRIPTION.md @@ -1,2 +1,2 @@ -This is a demonstration module providing a sample GraphQL endpoint, -as well as tests for ``graphql_base``. +This is a demonstration module providing a sample GraphQL endpoint, as +well as tests for `graphql_base`. diff --git a/graphql_demo/readme/USAGE.md b/graphql_demo/readme/USAGE.md new file mode 100644 index 00000000..713606b7 --- /dev/null +++ b/graphql_demo/readme/USAGE.md @@ -0,0 +1,5 @@ +This module can be used in different ways: + + - as an example: copy the code and hack your way; + - to test `graphql_base` (install it with `--test-enable`); + - on runbot, login and change the url to `/graphiql/demo`. diff --git a/graphql_demo/readme/USAGE.rst b/graphql_demo/readme/USAGE.rst deleted file mode 100644 index 9f7e7d89..00000000 --- a/graphql_demo/readme/USAGE.rst +++ /dev/null @@ -1,5 +0,0 @@ -This module can be used in different ways: - -* as an example: copy the code and hack your way; -* to test ``graphql_base`` (install it with ``--test-enable``); -* on runbot, login and change the url to ``/graphiql/demo``. diff --git a/graphql_demo/static/description/index.html b/graphql_demo/static/description/index.html index 433ceb33..77016998 100644 --- a/graphql_demo/static/description/index.html +++ b/graphql_demo/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,9 +369,9 @@

    GraphQL Demo

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:2a0309d8d523454d154f0b5fb46479ea8ba8eb9dd0942ebb0ef0328b84102355 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runboat

    -

    This is a demonstration module providing a sample GraphQL endpoint, -as well as tests for graphql_base.

    +

    Beta License: LGPL-3 OCA/rest-framework Translate me on Weblate Try me on Runboat

    +

    This is a demonstration module providing a sample GraphQL endpoint, as +well as tests for graphql_base.

    Table of contents

      @@ -398,7 +398,7 @@

      Bug Tracker

      Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

      +feedback.

      Do not contact contributors directly about support or help with technical issues.

    @@ -412,13 +412,15 @@

    Authors

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +Odoo Community Association +

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    Current maintainer:

    sbidoul

    -

    This module is part of the OCA/rest-framework project on GitHub.

    +

    This module is part of the OCA/rest-framework project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/graphql_demo/tests/test_graphene.py b/graphql_demo/tests/test_graphene.py index 445b727e..ab44d6db 100644 --- a/graphql_demo/tests/test_graphene.py +++ b/graphql_demo/tests/test_graphene.py @@ -13,7 +13,7 @@ class TestGraphene(TransactionCase): @classmethod def setUpClass(cls): - super(TestGraphene, cls).setUpClass() + super().setUpClass() cls.client = Client(schema) # disable logging for the graphql executor because we are testing # errors and OCA's test runner considers the two errors being logged diff --git a/requirements.txt b/requirements.txt index 058f53da..a4ccc4e8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,8 @@ a2wsgi>=1.10.6 contextvars fastapi>=0.110.0 +graphene +graphql_server parse-accept-language pydantic python-multipart From 512a4fd4a36ea62e607c0751633060a70daf4c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Thu, 3 Oct 2024 13:49:26 +0200 Subject: [PATCH 4/4] [FIX] graphql_base: rename types.py This conflicts with the build system, as the project root directory is in sys.path when building and there is confusion with the stdlib types module. --- graphql_base/__init__.py | 2 +- graphql_base/{types.py => graphene_types.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename graphql_base/{types.py => graphene_types.py} (100%) diff --git a/graphql_base/__init__.py b/graphql_base/__init__.py index e08d6dbc..7fded2bb 100644 --- a/graphql_base/__init__.py +++ b/graphql_base/__init__.py @@ -2,4 +2,4 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). from .controllers import GraphQLControllerMixin -from .types import OdooObjectType +from .graphene_types import OdooObjectType, odoo_attr_resolver diff --git a/graphql_base/types.py b/graphql_base/graphene_types.py similarity index 100% rename from graphql_base/types.py rename to graphql_base/graphene_types.py