예제 #1
0
파일: test_core.py 프로젝트: PMR2/pmr2.json
    def test_update_json_collection_form_not_fail(self):
        request = TestRequest(stdin=StringIO('{}'))
        f = form.ItemForm(self.item, request)
        core.update_json_collection_form(f)
        # should not fail.

        request = TestRequest(stdin=StringIO(''))
        f = form.ItemForm(self.item, request)
        core.update_json_collection_form(f)
예제 #2
0
파일: mixin.py 프로젝트: PMR2/pmr2.json
    def update(self):
        """
        Convert JSON input into standard request.
        """

        _disable_csrf_for_webservices(self)
        update_json_collection_form(self)
        super(JsonCollectionFormMixin, self).update()
        self._jc_template = formfields_to_collection_template(self)

        return None
예제 #3
0
    def update(self):
        """
        Convert JSON input into standard request.
        """

        # XXX at some point we need to consider the security and how
        # this might be vulnerable to XSS (for browsers that do not have
        # origin policy support).
        self.disableAuthenticator = True

        update_json_collection_form(self)

        super(JsonCollectionFormMixin, self).update()

        self._jc_template = formfields_to_collection_template(self)

        return None
예제 #4
0
파일: test_core.py 프로젝트: PMR2/pmr2.json
    def test_update_json_collection_form(self):
        request = TestRequest(stdin=StringIO('''{ "template": {
            "data": [
                {
                    "name": "form.widgets.item_id",
                    "value": 2
                },
                {
                    "name": "form.widgets.name",
                    "value": "The Name"
                }
            ]
        }}'''))

        f = form.ItemForm(self.item, request)
        core.update_json_collection_form(f)
        self.assertEqual(request.form['form.widgets.item_id'], 2)
        self.assertEqual(request.form['form.widgets.name'], 'The Name')