From cc3e669101de7ce2ac2bdd7a2f7b17ec68507406 Mon Sep 17 00:00:00 2001 From: Daniel <daniel@harvey> Date: Wed, 8 Jul 2020 17:12:01 +0200 Subject: [PATCH] DOC: Documentation. --- .../connection/authentication/unauthenticated.py | 2 +- src/caosdb/utils/caosdb_admin.py | 3 ++- src/caosdb/utils/server_side_scripting.py | 11 +++++++++++ unittests/test_add_property.py | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/caosdb/connection/authentication/unauthenticated.py b/src/caosdb/connection/authentication/unauthenticated.py index 70ef40e6..53a2756e 100644 --- a/src/caosdb/connection/authentication/unauthenticated.py +++ b/src/caosdb/connection/authentication/unauthenticated.py @@ -25,7 +25,7 @@ # """unauthenticated. -An Authentictor which suppresses any authentication and also ignores auth_token +An Authenticator which suppresses any authentication and also ignores auth_token cookies. """ from __future__ import absolute_import, unicode_literals, print_function diff --git a/src/caosdb/utils/caosdb_admin.py b/src/caosdb/utils/caosdb_admin.py index c7e3024f..250c2878 100755 --- a/src/caosdb/utils/caosdb_admin.py +++ b/src/caosdb/utils/caosdb_admin.py @@ -291,7 +291,8 @@ USAGE "`password_method` of the connection is set to " "`auth_token` and the respective configuration " "from the pycaosdb.ini is effectively being " - "overridden.")) + "overridden.\nTODO: Also allow passing the token " + "via environmenty variables.")) subparsers = parser.add_subparsers( title="commands", metavar="COMMAND", diff --git a/src/caosdb/utils/server_side_scripting.py b/src/caosdb/utils/server_side_scripting.py index 861b5fb6..663178dc 100644 --- a/src/caosdb/utils/server_side_scripting.py +++ b/src/caosdb/utils/server_side_scripting.py @@ -34,6 +34,12 @@ from caosdb.connection.encode import MultipartParam, multipart_encode def _make_params(pos_args, opts): + """Create and return option string components. + +The return value is a dict with be something like `-O<key>`:`<value>` from `opts` and +`-p{0,1,2,3,...}`:`<value>` from `pos_args`. + + """ result = {} for key, val in opts.items(): result["-O{key}".format(key=key)] = str(val) @@ -43,6 +49,8 @@ def _make_params(pos_args, opts): def _make_multipart_request(call, pos_args, opts, files): + """Return body and header for an HTTP request. + """ parts = list() params = _make_params(pos_args, opts) @@ -59,6 +67,7 @@ def _make_multipart_request(call, pos_args, opts, files): def _make_form_request(call, pos_args, opts): + """Return URL from call and argumewnts, and headers for urlencoding.""" form = dict() form["call"] = call @@ -73,6 +82,8 @@ def _make_form_request(call, pos_args, opts): def _make_request(call, pos_args, opts, files=None): """ + Multipart if with files, otherwise url-encoded. + Return ------ path_segments, body, headers diff --git a/unittests/test_add_property.py b/unittests/test_add_property.py index 1f8c7e3b..5bae6c21 100644 --- a/unittests/test_add_property.py +++ b/unittests/test_add_property.py @@ -5,6 +5,8 @@ # # Copyright (C) 2018 Research Group Biomedical Physics, # Max-Planck-Institute for Dynamics and Self-Organization Göttingen +# Copyright (C) 2020 Indiscale GmbH <info@indiscale.com> +# Copyright (C) 2020 Timm Fitschen <f.fitschen@indiscale.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as -- GitLab