0

私の flash-pyamf-gae はうまく動作します。ここで、Google のチュートリアルに従ってクラシックな Django フォームを作成したいと思います: http://code.google.com/appengine/articles/djangoforms.html やったのですが、フォームに入力したデータを投稿すると、次のメッセージが表示されます。 pyamf から:

不正なストリーム (amfVersion=110)

400 Bad Request リクエスト本文を正常にデコードできませんでした。

トレースバック:

トレースバック (最後の最後の呼び出し):
ファイル "C:\Users\Giil\Documents\dev\gae\moviesbuilder\pyamf\remoting\gateway\google.py"、79 行目、post logger=self.logger、timezone_offset=timezone_offset 内)
ファイル "C:\Users\Giil\Documents\dev\gae\moviesbuilder\pyamf\remoting_ init _.py"、640 行目、デコード msg.amfVersion) DecodeError: 不正なストリーム (amfVersion=110)不正なストリーム (amfVersion=) 110)

私がフォームから送信したものはamfではないので、これは私には理にかなっています。どうすればこれに対処できますか?

注: 問題は私の app.yaml にあると感じています。このフォームを別の方法で処理するようにアプリケーションに指示する特別なハンドラーがありません...不正なストリーム (amfVersion=110)

4

1 に答える 1

0

私は自分の方法で問題を解決しました:

私のフォーム(投稿は、Googleの例のように「/」だけでなく、別の機能に向けられています):

class Projects(webapp.RequestHandler):
    def get(self):
        self.response.out.write('<html><body>'
                                '<form method="POST" '
                                'action="/ProjectsPage">'
                                '<table>')
        self.response.out.write(ProjectForm())
        self.response.out.write('</table>'
                                '<input type="submit">'
                                '</form></body></html>')

そして、dataStore に書き込んでリストを表示する必要があるもの:

class ProjectsPage(webapp.RequestHandler):
     #getting data and saving
     def post(self):
        data = ProjectForm(data=self.request.POST)
        if data.is_valid():
            # Save the data, and redirect to the view page
            entity = data.save(commit=False)
            entity.added_by = users.get_current_user()
            entity.put()
            self.redirect('/projects.html')
        else:
            # Reprint the form
            self.response.out.write('<html><body>'
                                    '<form method="POST" '
                                    'action="/">'
                                    '<table>')
            self.response.out.write(data)
            self.response.out.write('</table>'
                                    '<input type="submit">'
                                    '</form></body></html>')
    #display list of projects
    def get(self):
        query = db.GqlQuery("SELECT * FROM Project WHERE added_by=:1 ORDER BY name",users.get_current_user())
        template_values = {
            'projects': query,
        }
        path = os.path.join(os.path.dirname(__file__), 'templates/projects.html')
        self.response.out.write(template.render(path, template_values))   
于 2010-11-13T14:59:48.777 に答える