と私はプロジェクトのためのCherryPyにを使用していますが、私は認証二つのモジュールでCherryPyはを使用したが、一つだけCherryPyにインスタンス
と呼ばれるモジュールをインポートするメインアプリ内での方法では、メインのPythonスクリプトmain.py でそれを使用しますfrom authentication import auth
し、変数argsを渡します。 CherryPyには、ここで使用されてきた私は、私がこれを使用するときに問題がエラーHTTPError: (400, 'Unexpected body parameters: username, password')
で再び
def login(self, *args):
output = "<b>"args" has %d variables</b><br/>\n" % len(args)
if cherrypy.request.body_params is None:
output += """<form action="/auth/login" method="post" name="login">
<input type="text" maxlength="255" name="username"/>
<input type="password" maxlength="255" name="password"/>
<input type="submit" value="Log In"></input>
</form>"""
output += common.barMsg('Not a member yet? Join me <a href="/auth/join">here</a>', 8)
return output
をCherryPyに含まれるように、すでに明らかに
@cherrypy.expose
def auth(self, *args):
from authentication import auth
auth = auth()
page = common.header('Log in')
authString = auth.login(*args)
if authString:
page += common.barMsg('Logged in succesfully', 1)
page += authString
else:
page += common.barMsg('Authentication failed', 0)
page += common.footer()
return page
authentication.py内から私は、セッション変数を設定します。 main.pyのcherrypyインスタンスをauthentication.pyでアクセス可能にして、ここにセッション変数を設定したいと思っています。どうやってやるの?
私もこんなに早く、これを答えることは申し訳ありませんが、少し研究は、引数が** kwargsからということが判明したが、同じエラーを取得し