1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-02-02 09:47:13 +03:00

Fixed cache decorator for functions without arguments and fixed server registration certification validation to allow empty certificate

This commit is contained in:
Adolfo Gómez García 2024-09-10 03:45:52 +02:00
parent b0ffdb5492
commit 4c755f548e
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 4 additions and 2 deletions

View File

@ -84,6 +84,7 @@ class ServerRegisterBase(Handler):
validators.validate_fqdn(hostname)
validators.validate_mac(mac)
validators.validate_json(data)
if certificate: # Emtpy certificate is allowed
validators.validate_certificate(certificate)
except Exception as e:
raise rest_exceptions.RequestError(str(e)) from e

View File

@ -247,7 +247,8 @@ def cached(
# or if args[0] is an object, use its class name as cache name
# or use the global 'functionCache' (generic, common cache, may clash with other functions)
cache = inner_cache or Cache(
getattr(getattr(args[0], '__class__', None), '__name__', None) or 'functionCache'
(getattr(getattr(args[0], '__class__', None), '__name__', None) if len(args) > 0 else None)
or 'functionCache'
)
# if timeout is a function, call it