Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 谷歌应用程序引擎是否有;必需的“U管理”;方法_Python_Google App Engine_Admin_Require - Fatal编程技术网

Python 谷歌应用程序引擎是否有;必需的“U管理”;方法

Python 谷歌应用程序引擎是否有;必需的“U管理”;方法,python,google-app-engine,admin,require,Python,Google App Engine,Admin,Require,我想使用此方法使用户必须是管理员。标准方法是在应用程序中使用登录:admin。yaml,但这里有一个装饰程序: @required_admin def get(self): 我通常不这么说,但你真的应该读一下手册。我觉得你把StackOverflow看作是一种避免阅读AppEngine文档的方法。我总是想要最好的答案 def admin_required(handler_method): def check_admin(self, *args): if not users.is_c

我想使用此方法使用户必须是管理员。

标准方法是在
应用程序中使用
登录:admin
。yaml
,但这里有一个装饰程序:

@required_admin
def get(self):

我通常不这么说,但你真的应该读一下手册。我觉得你把StackOverflow看作是一种避免阅读AppEngine文档的方法。我总是想要最好的答案
def admin_required(handler_method):
  def check_admin(self, *args):
    if not users.is_current_user_admin():
      self.redirect(users.create_login_url(self.request.uri))
      return
    else:
      handler_method(self, *args)
  return check_admin