Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit 78dc6b5

Browse files
committed
Merge pull request #148 from inklesspen/auth_level_warning
Add warning when auth_level is used.
2 parents 7d10590 + 13b228a commit 78dc6b5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

endpoints/api_config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ def _Enum(docstring, *names):
152152

153153
AUTH_LEVEL = _Enum(_AUTH_LEVEL_DOCSTRING, 'REQUIRED', 'OPTIONAL',
154154
'OPTIONAL_CONTINUE', 'NONE')
155+
_AUTH_LEVEL_WARNING = ("Due to a design error, auth_level has never actually been functional. "
156+
"It will likely be removed and replaced by a functioning alternative "
157+
"in a future version of the framework. Please stop using auth_level now.")
155158

156159

157160
def _GetFieldAttributes(field):
@@ -808,6 +811,8 @@ def api_class(self, resource_name=None, path=None, audiences=None,
808811
Returns:
809812
A decorator function to decorate a class that implements an API.
810813
"""
814+
if auth_level is not None:
815+
_logger.warn(_AUTH_LEVEL_WARNING)
811816

812817
def apiserving_api_decorator(api_class):
813818
"""Decorator for ProtoRPC class that configures Google's API server.
@@ -1046,6 +1051,8 @@ class Books(remote.Service):
10461051
Returns:
10471052
Class decorated with api_info attribute, an instance of ApiInfo.
10481053
"""
1054+
if auth_level is not None:
1055+
_logger.warn(_AUTH_LEVEL_WARNING)
10491056

10501057
return _ApiDecorator(name, version, description=description,
10511058
hostname=hostname, audiences=audiences, scopes=scopes,
@@ -1275,6 +1282,8 @@ def greeting_insert(request):
12751282
TypeError: if the request_type or response_type parameters are not
12761283
proper subclasses of messages.Message.
12771284
"""
1285+
if auth_level is not None:
1286+
_logger.warn(_AUTH_LEVEL_WARNING)
12781287

12791288
# Default HTTP method if one is not specified.
12801289
DEFAULT_HTTP_METHOD = 'POST'

0 commit comments

Comments
 (0)