cone.app 2.1.0__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cone_app-2.1.0 → cone_app-2.2.0}/CHANGES.rst +64 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/PKG-INFO +70 -5
- {cone_app-2.1.0 → cone_app-2.2.0}/pyproject.toml +6 -5
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/__init__.py +45 -26
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/ajax.py +11 -6
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/authoring.py +11 -15
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/exception.py +15 -8
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/form.py +2 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/login.py +18 -2
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/referencebrowser.py +3 -3
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/utils.py +37 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/workflow.py +6 -5
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/locale/cone.app.pot +5 -0
- cone_app-2.2.0/src/cone/app/locale/de/LC_MESSAGES/cone.app.mo +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/locale/de/LC_MESSAGES/cone.app.po +5 -0
- cone_app-2.2.0/src/cone/app/locale/en/LC_MESSAGES/cone.app.mo +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/locale/en/LC_MESSAGES/cone.app.po +5 -0
- cone_app-2.2.0/src/cone/app/origin.py +66 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/security.py +19 -3
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/__init__.py +10 -0
- cone_app-2.2.0/src/cone/app/testing/data/ugm/users +6 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_app.py +47 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_ajax.py +51 -4
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_authoring.py +26 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_exception.py +73 -67
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_form.py +42 -0
- cone_app-2.2.0/src/cone/app/tests/test_browser_login.py +171 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_referencebrowser.py +75 -42
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_settings.py +2 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_utils.py +39 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_workflow.py +6 -0
- cone_app-2.2.0/src/cone/app/tests/test_origin.py +182 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_security.py +52 -0
- cone_app-2.1.0/src/cone/app/locale/de/LC_MESSAGES/cone.app.mo +0 -0
- cone_app-2.1.0/src/cone/app/locale/en/LC_MESSAGES/cone.app.mo +0 -0
- cone_app-2.1.0/src/cone/app/testing/data/ugm/users +0 -6
- cone_app-2.1.0/src/cone/app/tests/test_browser_login.py +0 -54
- {cone_app-2.1.0 → cone_app-2.2.0}/.gitignore +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/LICENSE.rst +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/README.rst +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/TODO.rst +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/biome.json +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/constraints.txt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/include.mk +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/requirements.txt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/__init__.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/actions.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/batch.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/content.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/contents.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/contextmenu.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/copysupport.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/layout.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/order.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/resources.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/search.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/settings.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/sharing.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/css/bootstrap.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/css/bootstrap.min.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/icons/bootstrap-icons.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/icons/bootstrap-icons.json +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/icons/bootstrap-icons.min.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/icons/bootstrap-icons.scss +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/icons/fonts/bootstrap-icons.woff +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/icons/fonts/bootstrap-icons.woff2 +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/js/bootstrap.bundle.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/js/bootstrap.bundle.min.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/bootstrap/js/popper.min.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/cone.app.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/cone.app.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/cone.app.min.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/cone.app.min.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/cone.app.print.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/favicon.ico +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/flags/de.svg +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/flags/en.svg +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/flags/fr.svg +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/cone/flags/it.svg +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/jquery/jquery-4.0.0.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/static/jquery/jquery-4.0.0.min.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/table.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/action_download.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/action_dropdown.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/add_dropdown.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/batch.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/batched_items.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/batched_items_footer.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/batched_items_header.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/button_action.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/byline.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/colortoggler.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/content_form.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/contextmenu.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/contextmenu_dropdown.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/default_root.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/footer.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/insufficient_privileges.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/language.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/layout.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/link_action.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/listing.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/livesearch.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/logo.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/main.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/mainmenu.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/navtree.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/navtree_recue.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/not_found.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/pathbar.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/personaltools.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/referencebrowser.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/referencebrowser_pathbar.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/resources.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/settings.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/settings_form.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/settings_sidebar.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/sharing.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/table.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/unauthorized.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/templates/wf_dropdown.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/browser/translation.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/compat.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/configure.zcml +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/interfaces.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/model.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/groups +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/roles +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/userdata/groups/group1 +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/userdata/users/admin +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/userdata/users/editor +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/userdata/users/manager +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/userdata/users/max +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/userdata/users/sepp +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/data/ugm/userdata/users/viewer +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/dummy_action.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/dummy_batched_items.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/dummy_form.yaml +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/dummy_main.pt +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/dummy_workflow.zcml +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/mock.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/static/print1.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/static/print2.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/static/script1.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/static/script2.js +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/static/style1.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/testing/static/style2.css +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_actions.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_batch.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_content.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_contents.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_contextmenu.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_copysupport.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_layout.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_order.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_resources.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_search.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_sharing.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_table.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_browser_translation.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_model.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_testing.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_ugm.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_utils.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/tests/test_workflow.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/ugm.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/utils.py +0 -0
- {cone_app-2.1.0 → cone_app-2.2.0}/src/cone/app/workflow.py +0 -0
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
Changes
|
|
2
2
|
=======
|
|
3
3
|
|
|
4
|
+
2.2.0 (2026-11-09)
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
- The ``ajaxaction`` view only accepts ``POST`` requests. Requires ``treibstoff``
|
|
8
|
+
2.1.0.
|
|
9
|
+
[rnix]
|
|
10
|
+
|
|
11
|
+
- The tile ``wf_dropdown`` only performs ``do_transition`` on ``POST`` requests.
|
|
12
|
+
[rnix]
|
|
13
|
+
|
|
14
|
+
- ``Form`` only runs form actions on ``POST`` requests. On any other request it
|
|
15
|
+
renders the form. Tests calling a form action need ``request.method = 'POST'``.
|
|
16
|
+
[rnix]
|
|
17
|
+
|
|
18
|
+
- Answer requests other than ``GET``, ``HEAD`` and ``OPTIONS`` with status ``403``
|
|
19
|
+
if a browser sends them for another site, recognized by the ``Sec-Fetch-Site``
|
|
20
|
+
and ``Origin`` headers. Clients sending neither pass. Add
|
|
21
|
+
``cone.trusted_origins`` for browser clients of other origins.
|
|
22
|
+
[rnix]
|
|
23
|
+
|
|
24
|
+
- Encode the node title in reference actions and in the link to leaf nodes, and
|
|
25
|
+
the label in display mode of the ``reference`` blueprint. Requires ``yafowil``
|
|
26
|
+
4.2.0.
|
|
27
|
+
[rnix]
|
|
28
|
+
|
|
29
|
+
- ``main`` refuses to start if ``cone.auth_secret`` is missing or has the former
|
|
30
|
+
default value ``secret``.
|
|
31
|
+
[rnix]
|
|
32
|
+
|
|
33
|
+
- Read ``cone.auth_secure``, ``cone.auth_include_ip``, ``cone.auth_http_only`` and
|
|
34
|
+
``cone.auth_wild_domain`` as booleans. ``false`` in an ini file was considered
|
|
35
|
+
true before, applications with such a value change their behavior.
|
|
36
|
+
[rnix]
|
|
37
|
+
|
|
38
|
+
- ``cone.auth_http_only`` defaults to ``True``.
|
|
39
|
+
[rnix]
|
|
40
|
+
|
|
41
|
+
- Failures in ajax actions, ajax forms and the exception view answer with a
|
|
42
|
+
general message, the traceback goes to the log. Add setting
|
|
43
|
+
``cone.show_tracebacks`` to show it to the client during development. Add
|
|
44
|
+
``browser.utils.client_error_message``.
|
|
45
|
+
[rnix]
|
|
46
|
+
|
|
47
|
+
- ``internal_server_error`` answers with status 500 instead of 200, also for
|
|
48
|
+
ajax requests. A ``default_commit_veto`` configured for ``pyramid_tm`` vetoes
|
|
49
|
+
such a request now, before it committed.
|
|
50
|
+
[rnix]
|
|
51
|
+
|
|
52
|
+
- Compare the credentials of the admin user with ``hmac.compare_digest``.
|
|
53
|
+
[rnix]
|
|
54
|
+
|
|
55
|
+
- A failed login in the login form answers with status 401 instead of 200, so a
|
|
56
|
+
throttle at the edge can recognize it. All failed logins log a warning with the
|
|
57
|
+
first two characters of the login name and the client address. The login form only
|
|
58
|
+
checks the password in the ``login`` view, not on other pages showing the form or
|
|
59
|
+
through ``ajaxaction``.
|
|
60
|
+
[rnix]
|
|
61
|
+
|
|
62
|
+
- ``logout_view`` follows ``came_from`` only to an HTTP URL on the host of the
|
|
63
|
+
application. ``CameFromNext`` considers the scheme too. Add
|
|
64
|
+
``browser.utils.is_same_host_url``.
|
|
65
|
+
[rnix]
|
|
66
|
+
|
|
67
|
+
|
|
4
68
|
2.1.0 (2026-10-31)
|
|
5
69
|
------------------
|
|
6
70
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: cone.app
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Web application stub
|
|
5
5
|
Project-URL: Homepage, http://github.com/conestack/cone.app
|
|
6
6
|
Author-email: Cone Contributors <dev@conestack.org>
|
|
@@ -14,21 +14,22 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
17
18
|
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
18
19
|
Requires-Python: >=3.10
|
|
19
20
|
Requires-Dist: chameleon
|
|
20
|
-
Requires-Dist: cone-tile>2.
|
|
21
|
-
Requires-Dist: node-ext-ugm>
|
|
21
|
+
Requires-Dist: cone-tile>2.1.99
|
|
22
|
+
Requires-Dist: node-ext-ugm>2.0.99
|
|
22
23
|
Requires-Dist: node>1.99
|
|
23
24
|
Requires-Dist: pyramid-chameleon
|
|
24
25
|
Requires-Dist: pyramid-zcml
|
|
25
26
|
Requires-Dist: pyramid>=2.0
|
|
26
27
|
Requires-Dist: repoze-workflow
|
|
27
|
-
Requires-Dist: treibstoff>
|
|
28
|
+
Requires-Dist: treibstoff>2.0.99
|
|
28
29
|
Requires-Dist: webresource>1.2.99
|
|
29
30
|
Requires-Dist: yafowil-bootstrap>1.99
|
|
30
31
|
Requires-Dist: yafowil-webob>1.99
|
|
31
|
-
Requires-Dist: yafowil>
|
|
32
|
+
Requires-Dist: yafowil>4.1.99
|
|
32
33
|
Provides-Extra: docs
|
|
33
34
|
Requires-Dist: repoze-sphinx-autointerface; extra == 'docs'
|
|
34
35
|
Requires-Dist: sphinx; extra == 'docs'
|
|
@@ -103,6 +104,70 @@ Contributors
|
|
|
103
104
|
Changes
|
|
104
105
|
=======
|
|
105
106
|
|
|
107
|
+
2.2.0 (2026-11-09)
|
|
108
|
+
------------------
|
|
109
|
+
|
|
110
|
+
- The ``ajaxaction`` view only accepts ``POST`` requests. Requires ``treibstoff``
|
|
111
|
+
2.1.0.
|
|
112
|
+
[rnix]
|
|
113
|
+
|
|
114
|
+
- The tile ``wf_dropdown`` only performs ``do_transition`` on ``POST`` requests.
|
|
115
|
+
[rnix]
|
|
116
|
+
|
|
117
|
+
- ``Form`` only runs form actions on ``POST`` requests. On any other request it
|
|
118
|
+
renders the form. Tests calling a form action need ``request.method = 'POST'``.
|
|
119
|
+
[rnix]
|
|
120
|
+
|
|
121
|
+
- Answer requests other than ``GET``, ``HEAD`` and ``OPTIONS`` with status ``403``
|
|
122
|
+
if a browser sends them for another site, recognized by the ``Sec-Fetch-Site``
|
|
123
|
+
and ``Origin`` headers. Clients sending neither pass. Add
|
|
124
|
+
``cone.trusted_origins`` for browser clients of other origins.
|
|
125
|
+
[rnix]
|
|
126
|
+
|
|
127
|
+
- Encode the node title in reference actions and in the link to leaf nodes, and
|
|
128
|
+
the label in display mode of the ``reference`` blueprint. Requires ``yafowil``
|
|
129
|
+
4.2.0.
|
|
130
|
+
[rnix]
|
|
131
|
+
|
|
132
|
+
- ``main`` refuses to start if ``cone.auth_secret`` is missing or has the former
|
|
133
|
+
default value ``secret``.
|
|
134
|
+
[rnix]
|
|
135
|
+
|
|
136
|
+
- Read ``cone.auth_secure``, ``cone.auth_include_ip``, ``cone.auth_http_only`` and
|
|
137
|
+
``cone.auth_wild_domain`` as booleans. ``false`` in an ini file was considered
|
|
138
|
+
true before, applications with such a value change their behavior.
|
|
139
|
+
[rnix]
|
|
140
|
+
|
|
141
|
+
- ``cone.auth_http_only`` defaults to ``True``.
|
|
142
|
+
[rnix]
|
|
143
|
+
|
|
144
|
+
- Failures in ajax actions, ajax forms and the exception view answer with a
|
|
145
|
+
general message, the traceback goes to the log. Add setting
|
|
146
|
+
``cone.show_tracebacks`` to show it to the client during development. Add
|
|
147
|
+
``browser.utils.client_error_message``.
|
|
148
|
+
[rnix]
|
|
149
|
+
|
|
150
|
+
- ``internal_server_error`` answers with status 500 instead of 200, also for
|
|
151
|
+
ajax requests. A ``default_commit_veto`` configured for ``pyramid_tm`` vetoes
|
|
152
|
+
such a request now, before it committed.
|
|
153
|
+
[rnix]
|
|
154
|
+
|
|
155
|
+
- Compare the credentials of the admin user with ``hmac.compare_digest``.
|
|
156
|
+
[rnix]
|
|
157
|
+
|
|
158
|
+
- A failed login in the login form answers with status 401 instead of 200, so a
|
|
159
|
+
throttle at the edge can recognize it. All failed logins log a warning with the
|
|
160
|
+
first two characters of the login name and the client address. The login form only
|
|
161
|
+
checks the password in the ``login`` view, not on other pages showing the form or
|
|
162
|
+
through ``ajaxaction``.
|
|
163
|
+
[rnix]
|
|
164
|
+
|
|
165
|
+
- ``logout_view`` follows ``came_from`` only to an HTTP URL on the host of the
|
|
166
|
+
application. ``CameFromNext`` considers the scheme too. Add
|
|
167
|
+
``browser.utils.is_same_host_url``.
|
|
168
|
+
[rnix]
|
|
169
|
+
|
|
170
|
+
|
|
106
171
|
2.1.0 (2026-10-31)
|
|
107
172
|
------------------
|
|
108
173
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cone.app"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "Web application stub"
|
|
9
9
|
dynamic = ["readme"]
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -19,22 +19,23 @@ classifiers = [
|
|
|
19
19
|
"Programming Language :: Python :: 3.12",
|
|
20
20
|
"Programming Language :: Python :: 3.13",
|
|
21
21
|
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Programming Language :: Python :: 3.15",
|
|
22
23
|
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
23
24
|
]
|
|
24
25
|
dependencies = [
|
|
25
26
|
"Chameleon",
|
|
26
|
-
"cone.tile>2.
|
|
27
|
-
"node.ext.ugm>
|
|
27
|
+
"cone.tile>2.1.99",
|
|
28
|
+
"node.ext.ugm>2.0.99",
|
|
28
29
|
"node>1.99",
|
|
29
30
|
"pyramid>=2.0",
|
|
30
31
|
"pyramid_chameleon",
|
|
31
32
|
"pyramid_zcml",
|
|
32
33
|
"repoze.workflow",
|
|
33
|
-
"treibstoff>
|
|
34
|
+
"treibstoff>2.0.99",
|
|
34
35
|
"webresource>1.2.99",
|
|
35
36
|
"yafowil.bootstrap>1.99",
|
|
36
37
|
"yafowil.webob>1.99",
|
|
37
|
-
"yafowil>
|
|
38
|
+
"yafowil>4.1.99",
|
|
38
39
|
]
|
|
39
40
|
|
|
40
41
|
[project.optional-dependencies]
|
|
@@ -15,7 +15,9 @@ from pyramid.authentication import AuthTktAuthenticationPolicy
|
|
|
15
15
|
from pyramid.authorization import ACLAuthorizationPolicy
|
|
16
16
|
from pyramid.config import Configurator
|
|
17
17
|
from pyramid.interfaces import ISecurityPolicy
|
|
18
|
+
from pyramid.settings import asbool
|
|
18
19
|
from pyramid.traversal import ResourceTreeTraverser
|
|
20
|
+
from pyramid.tweens import INGRESS
|
|
19
21
|
from yafowil.bootstrap import configure_factory
|
|
20
22
|
from zope.component import adapter
|
|
21
23
|
from zope.component import getGlobalSiteManager
|
|
@@ -33,6 +35,9 @@ logger = logging.getLogger('cone.app')
|
|
|
33
35
|
# configuration
|
|
34
36
|
cfg = Properties()
|
|
35
37
|
|
|
38
|
+
# show tracebacks to clients
|
|
39
|
+
cfg.show_tracebacks = False
|
|
40
|
+
|
|
36
41
|
# available languages
|
|
37
42
|
cfg.available_languages = []
|
|
38
43
|
|
|
@@ -223,6 +228,41 @@ def start_thread_monitor(): # pragma: no cover
|
|
|
223
228
|
monitor.start()
|
|
224
229
|
|
|
225
230
|
|
|
231
|
+
def create_security_policy(settings):
|
|
232
|
+
"""Create the security policy from application settings.
|
|
233
|
+
|
|
234
|
+
The settings used for this get removed from ``settings``.
|
|
235
|
+
|
|
236
|
+
:param settings: The application settings.
|
|
237
|
+
:return: The security policy.
|
|
238
|
+
:raises ValueError: If ``cone.auth_secret`` is missing or the former default.
|
|
239
|
+
"""
|
|
240
|
+
auth_secret = settings.pop('cone.auth_secret', None)
|
|
241
|
+
if not auth_secret or auth_secret == 'secret':
|
|
242
|
+
raise ValueError(
|
|
243
|
+
'cone.auth_secret signs the authentication cookie and must be set to a '
|
|
244
|
+
'secret value of your own.'
|
|
245
|
+
)
|
|
246
|
+
auth_reissue_time = settings.pop('cone.auth_reissue_time', None)
|
|
247
|
+
if auth_reissue_time is not None:
|
|
248
|
+
auth_reissue_time = int(auth_reissue_time)
|
|
249
|
+
auth_max_age = settings.pop('cone.auth_max_age', None)
|
|
250
|
+
if auth_max_age is not None:
|
|
251
|
+
auth_max_age = int(auth_max_age)
|
|
252
|
+
return security.SecurityPolicy(
|
|
253
|
+
secret=auth_secret,
|
|
254
|
+
cookie_name=settings.pop('cone.auth_cookie_name', 'auth_tkt'),
|
|
255
|
+
secure=asbool(settings.pop('cone.auth_secure', False)),
|
|
256
|
+
include_ip=asbool(settings.pop('cone.auth_include_ip', False)),
|
|
257
|
+
timeout=settings.pop('cone.auth_timeout', None),
|
|
258
|
+
reissue_time=auth_reissue_time,
|
|
259
|
+
max_age=auth_max_age,
|
|
260
|
+
http_only=asbool(settings.pop('cone.auth_http_only', True)),
|
|
261
|
+
path=settings.pop('cone.auth_path', '/'),
|
|
262
|
+
wild_domain=asbool(settings.pop('cone.auth_wild_domain', True)),
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
|
|
226
266
|
def main(global_config, **settings):
|
|
227
267
|
"""Returns WSGI application."""
|
|
228
268
|
# set authentication related application properties
|
|
@@ -235,33 +275,9 @@ def main(global_config, **settings):
|
|
|
235
275
|
if node_available_callback:
|
|
236
276
|
security.node_available = import_from_string(node_available_callback)
|
|
237
277
|
|
|
238
|
-
|
|
239
|
-
auth_cookie_name = settings.pop('cone.auth_cookie_name', 'auth_tkt')
|
|
240
|
-
auth_secure = settings.pop('cone.auth_secure', False)
|
|
241
|
-
auth_include_ip = settings.pop('cone.auth_include_ip', False)
|
|
242
|
-
auth_timeout = settings.pop('cone.auth_timeout', None)
|
|
243
|
-
auth_reissue_time = settings.pop('cone.auth_reissue_time', None)
|
|
244
|
-
if auth_reissue_time is not None:
|
|
245
|
-
auth_reissue_time = int(auth_reissue_time)
|
|
246
|
-
auth_max_age = settings.pop('cone.auth_max_age', None)
|
|
247
|
-
if auth_max_age is not None:
|
|
248
|
-
auth_max_age = int(auth_max_age)
|
|
249
|
-
auth_http_only = settings.pop('cone.auth_http_only', False)
|
|
250
|
-
auth_path = settings.pop('cone.auth_path', '/')
|
|
251
|
-
auth_wild_domain = settings.pop('cone.auth_wild_domain', True)
|
|
278
|
+
security_policy = create_security_policy(settings)
|
|
252
279
|
|
|
253
|
-
|
|
254
|
-
secret=auth_secret,
|
|
255
|
-
cookie_name=auth_cookie_name,
|
|
256
|
-
secure=auth_secure,
|
|
257
|
-
include_ip=auth_include_ip,
|
|
258
|
-
timeout=auth_timeout,
|
|
259
|
-
reissue_time=auth_reissue_time,
|
|
260
|
-
max_age=auth_max_age,
|
|
261
|
-
http_only=auth_http_only,
|
|
262
|
-
path=auth_path,
|
|
263
|
-
wild_domain=auth_wild_domain,
|
|
264
|
-
)
|
|
280
|
+
cfg.show_tracebacks = asbool(settings.pop('cone.show_tracebacks', False))
|
|
265
281
|
|
|
266
282
|
# create root node
|
|
267
283
|
global root
|
|
@@ -314,6 +330,9 @@ def main(global_config, **settings):
|
|
|
314
330
|
# provide locales either in yafowil resources or as entry points in
|
|
315
331
|
# all yafowil packages providing translations
|
|
316
332
|
|
|
333
|
+
# outermost, a refused request does not reach the transaction or the views
|
|
334
|
+
config.add_tween('cone.app.origin.origin_check_tween_factory', under=INGRESS)
|
|
335
|
+
|
|
317
336
|
# static routes
|
|
318
337
|
config.add_route('favicon', '/favicon.ico')
|
|
319
338
|
# XXX: robots.txt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from cone.app.browser.actions import ActionContext
|
|
2
2
|
from cone.app.browser.utils import bdajax_warning
|
|
3
|
-
from cone.app.browser.utils import
|
|
3
|
+
from cone.app.browser.utils import client_error_message
|
|
4
4
|
from cone.tile import render_tile
|
|
5
5
|
from node.utils import safe_encode
|
|
6
6
|
from pyramid.exceptions import Forbidden
|
|
@@ -21,7 +21,12 @@ failed. An application vetoes the commit on this key, e.g. with a
|
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
@view_config(
|
|
24
|
+
@view_config(
|
|
25
|
+
name='ajaxaction',
|
|
26
|
+
accept='application/json',
|
|
27
|
+
request_method='POST',
|
|
28
|
+
renderer='json',
|
|
29
|
+
)
|
|
25
30
|
def ajax_tile(model, request):
|
|
26
31
|
"""Treibstoff ajax ``ajaxaction`` implementation for cone.
|
|
27
32
|
|
|
@@ -62,8 +67,8 @@ def ajax_tile(model, request):
|
|
|
62
67
|
except Exception:
|
|
63
68
|
logging.exception('Error within ajax tile')
|
|
64
69
|
request.environ[RENDER_ERROR] = True
|
|
65
|
-
|
|
66
|
-
continuation = AjaxContinue([AjaxMessage(
|
|
70
|
+
message = client_error_message(request)
|
|
71
|
+
continuation = AjaxContinue([AjaxMessage(message, 'error', None)])
|
|
67
72
|
return dict(
|
|
68
73
|
mode='NONE',
|
|
69
74
|
selector='NONE',
|
|
@@ -368,12 +373,12 @@ def render_ajax_form(model, request, name):
|
|
|
368
373
|
request.response.body = safe_encode(rendered)
|
|
369
374
|
return request.response
|
|
370
375
|
except Exception:
|
|
376
|
+
logging.exception('Error within ajax form')
|
|
371
377
|
request.environ[RENDER_ERROR] = True
|
|
372
378
|
result = '<div>Form rendering error</div>'
|
|
373
379
|
selector = request.environ.get('cone.app.form.selector', '#content')
|
|
374
380
|
mode = request.environ.get('cone.app.form.mode', 'inner')
|
|
375
|
-
|
|
376
|
-
operations = AjaxMessage(tb, 'error', None)
|
|
381
|
+
operations = AjaxMessage(client_error_message(request), 'error', None)
|
|
377
382
|
form_continue = AjaxFormContinue(result, [operations])
|
|
378
383
|
rendered = ajax_form_template % dict(
|
|
379
384
|
form=form_continue.form.replace('\n', ' '),
|
|
@@ -10,6 +10,7 @@ from cone.app.browser.ajax import AjaxOverlay
|
|
|
10
10
|
from cone.app.browser.ajax import AjaxPath
|
|
11
11
|
from cone.app.browser.ajax import render_ajax_form
|
|
12
12
|
from cone.app.browser.form import FormTarget
|
|
13
|
+
from cone.app.browser.utils import is_same_host_url
|
|
13
14
|
from cone.app.browser.utils import make_query
|
|
14
15
|
from cone.app.browser.utils import make_url
|
|
15
16
|
from cone.app.interfaces import ICategories
|
|
@@ -131,8 +132,8 @@ class CameFromNext(Behavior):
|
|
|
131
132
|
computed.
|
|
132
133
|
|
|
133
134
|
If ``came_from`` is set, it is considered as URL to use. The given URL
|
|
134
|
-
must
|
|
135
|
-
and URL of current model is computed.
|
|
135
|
+
must be an HTTP URL on the host of the application, otherwise an error
|
|
136
|
+
gets logged and URL of current model is computed.
|
|
136
137
|
|
|
137
138
|
If ``came_from`` is set to empty value, URL of current model is
|
|
138
139
|
computed.
|
|
@@ -153,24 +154,19 @@ class CameFromNext(Behavior):
|
|
|
153
154
|
# consider came_from a URL
|
|
154
155
|
else:
|
|
155
156
|
url = compat.unquote(came_from)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
# matches came_from location
|
|
160
|
-
if app_loc != parsed.netloc:
|
|
157
|
+
# behave as if no came_from given if it leads off the application
|
|
158
|
+
# host
|
|
159
|
+
if not is_same_host_url(self.request, url):
|
|
161
160
|
logger.error(
|
|
162
|
-
f'CameFromNext.next():
|
|
163
|
-
|
|
164
|
-
'computing instead'
|
|
161
|
+
f'CameFromNext.next(): came_from {url!r} is not an HTTP URL on '
|
|
162
|
+
'the host of the application. Use model for URL computing instead'
|
|
165
163
|
)
|
|
166
164
|
url = make_url(request.request, node=self.model)
|
|
167
165
|
path = '/'.join(node_path(self.model))
|
|
168
|
-
# include query to path
|
|
169
|
-
elif parsed.query:
|
|
170
|
-
path = f'{parsed.path}?{parsed.query}'
|
|
171
|
-
# query without path
|
|
172
166
|
else:
|
|
173
|
-
|
|
167
|
+
parsed = compat.urlparse.urlparse(url)
|
|
168
|
+
# include query to path
|
|
169
|
+
path = f'{parsed.path}?{parsed.query}' if parsed.query else parsed.path
|
|
174
170
|
# ajax continuation operations if ajax request
|
|
175
171
|
if self.ajax_request:
|
|
176
172
|
event = AjaxEvent(url, 'contextchanged', '#layout')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from cone.app.browser import render_main_template
|
|
2
2
|
from cone.app.browser.login import login_view
|
|
3
|
-
from cone.app.browser.utils import
|
|
3
|
+
from cone.app.browser.utils import client_error_message
|
|
4
4
|
from cone.tile import Tile
|
|
5
5
|
from cone.tile import tile
|
|
6
6
|
from pyramid.httpexceptions import HTTPForbidden
|
|
@@ -8,6 +8,10 @@ from pyramid.httpexceptions import HTTPNotFound
|
|
|
8
8
|
from pyramid.response import Response
|
|
9
9
|
from pyramid.view import view_config
|
|
10
10
|
import json
|
|
11
|
+
import logging
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger('cone.app')
|
|
11
15
|
|
|
12
16
|
|
|
13
17
|
###############################################################################
|
|
@@ -26,25 +30,28 @@ ERROR_PAGE = """
|
|
|
26
30
|
|
|
27
31
|
@view_config(context=Exception)
|
|
28
32
|
def internal_server_error(request):
|
|
29
|
-
"""Internal server error view.
|
|
30
|
-
|
|
33
|
+
"""Internal server error view.
|
|
34
|
+
|
|
35
|
+
Answers with status 500, a commit veto of a transaction manager decides by
|
|
36
|
+
the status.
|
|
37
|
+
"""
|
|
38
|
+
logger.exception('Error while processing request')
|
|
39
|
+
message = client_error_message(request)
|
|
31
40
|
if not request.is_xhr:
|
|
32
|
-
|
|
33
|
-
# return {'errors': error_dict}
|
|
34
|
-
return Response(ERROR_PAGE % {'error': tb})
|
|
41
|
+
return Response(ERROR_PAGE % {'error': message}, status=500)
|
|
35
42
|
# XXX: Check request relates to ajax action
|
|
36
43
|
# Check if json request and modify response as needed
|
|
37
44
|
from cone.app.browser.ajax import AjaxContinue
|
|
38
45
|
from cone.app.browser.ajax import AjaxMessage
|
|
39
46
|
|
|
40
|
-
continuation = AjaxContinue([AjaxMessage(
|
|
47
|
+
continuation = AjaxContinue([AjaxMessage(message, 'error', None)])
|
|
41
48
|
ret = {
|
|
42
49
|
'mode': 'NONE',
|
|
43
50
|
'selector': 'NONE',
|
|
44
51
|
'payload': '',
|
|
45
52
|
'continuation': continuation.operations,
|
|
46
53
|
}
|
|
47
|
-
response = Response(json.dumps(ret))
|
|
54
|
+
response = Response(json.dumps(ret), status=500)
|
|
48
55
|
response.content_type = 'application/json'
|
|
49
56
|
return response
|
|
50
57
|
|
|
@@ -174,6 +174,8 @@ class Form(Tile):
|
|
|
174
174
|
self.prepare_ajax()
|
|
175
175
|
if not self.show:
|
|
176
176
|
return ''
|
|
177
|
+
if self.request.method != 'POST':
|
|
178
|
+
return self.form(request=self.request)
|
|
177
179
|
controller = Controller(self.form, self.request)
|
|
178
180
|
if not controller.next:
|
|
179
181
|
return controller.rendered
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from cone.app.browser import render_main_template
|
|
2
2
|
from cone.app.browser.form import Form
|
|
3
|
+
from cone.app.browser.utils import is_same_host_url
|
|
3
4
|
from cone.app.browser.utils import make_url
|
|
4
5
|
from cone.app.security import authenticate
|
|
5
6
|
from cone.tile import tile
|
|
@@ -16,13 +17,19 @@ _ = TranslationStringFactory('cone.app')
|
|
|
16
17
|
|
|
17
18
|
@view_config(name='login')
|
|
18
19
|
def login_view(model, request):
|
|
19
|
-
|
|
20
|
+
response = render_main_template(model, request, contenttile='loginform')
|
|
21
|
+
# The template rendering creates its own response.
|
|
22
|
+
if request.response.status_int == 401:
|
|
23
|
+
response.status_int = 401
|
|
24
|
+
return response
|
|
20
25
|
|
|
21
26
|
|
|
22
27
|
@view_config(name='logout')
|
|
23
28
|
def logout_view(model, request):
|
|
24
29
|
headers = forget(request)
|
|
25
|
-
location = request.params.get('came_from',
|
|
30
|
+
location = request.params.get('came_from', '')
|
|
31
|
+
if not is_same_host_url(request, location):
|
|
32
|
+
location = request.application_url
|
|
26
33
|
return HTTPFound(location=location, headers=headers)
|
|
27
34
|
|
|
28
35
|
|
|
@@ -82,9 +89,18 @@ class LoginForm(Form):
|
|
|
82
89
|
def login(self, widget, data):
|
|
83
90
|
login = data.fetch('loginform.user').extracted
|
|
84
91
|
password = data.fetch('loginform.password').extracted
|
|
92
|
+
# Forms extract on every rendering, this is no login attempt then.
|
|
93
|
+
if not login or not password:
|
|
94
|
+
return data.extracted
|
|
95
|
+
# The form posts to the login view. Pages showing it for anonymous users and
|
|
96
|
+
# ajaxaction render it too, a throttle at the edge would not see them.
|
|
97
|
+
if self.request.view_name != 'login':
|
|
98
|
+
raise ExtractionError(_('invalid_credentials', default='Invalid Credentials'))
|
|
85
99
|
webob_req = data.request.request
|
|
86
100
|
self.headers = authenticate(webob_req, login, password)
|
|
87
101
|
if not self.headers:
|
|
102
|
+
# Lets the edge recognize failed logins, see configuration docs.
|
|
103
|
+
self.request.response.status_int = 401
|
|
88
104
|
raise ExtractionError(_('invalid_credentials', default='Invalid Credentials'))
|
|
89
105
|
|
|
90
106
|
def next(self, request):
|
|
@@ -127,7 +127,7 @@ class ReferenceAction(LinkAction):
|
|
|
127
127
|
'style': 'display:none;',
|
|
128
128
|
}
|
|
129
129
|
title = self.model.metadata.get('title', self.model.name)
|
|
130
|
-
return rendered + tag('span', title, **attrs)
|
|
130
|
+
return rendered + tag('span', tag.escape(title), **attrs)
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
class ActionAddReference(ReferenceAction):
|
|
@@ -184,7 +184,7 @@ class ReferencableChildrenLink(LinkAction):
|
|
|
184
184
|
def render(self):
|
|
185
185
|
if INavigationLeaf.providedBy(self.model):
|
|
186
186
|
return '{} {}'.format(
|
|
187
|
-
tag('span', class_=self.icon), tag('span', self.text)
|
|
187
|
+
tag('span', class_=self.icon), tag('span', tag.escape(self.text))
|
|
188
188
|
)
|
|
189
189
|
return LinkAction.render(self)
|
|
190
190
|
|
|
@@ -402,7 +402,7 @@ def reference_display_renderer(widget, data):
|
|
|
402
402
|
'id': cssid(widget, 'display'),
|
|
403
403
|
'class_': 'display-{}'.format(widget.attrs['class'] or 'generic'),
|
|
404
404
|
}
|
|
405
|
-
return data.tag('div', label, **attrs)
|
|
405
|
+
return data.tag('div', data.tag.escape(label), **attrs)
|
|
406
406
|
|
|
407
407
|
|
|
408
408
|
factory.register(
|
|
@@ -3,6 +3,7 @@ from cone.app.utils import app_config
|
|
|
3
3
|
from cone.app.utils import format_traceback as _format_traceback
|
|
4
4
|
from cone.app.utils import node_path
|
|
5
5
|
from node.utils import safe_encode
|
|
6
|
+
from pyramid.i18n import get_localizer
|
|
6
7
|
from pyramid.i18n import TranslationStringFactory
|
|
7
8
|
import copy
|
|
8
9
|
import datetime
|
|
@@ -122,6 +123,42 @@ def format_traceback():
|
|
|
122
123
|
return f'<pre>{_format_traceback()}</pre>'
|
|
123
124
|
|
|
124
125
|
|
|
126
|
+
def client_error_message(request):
|
|
127
|
+
"""Message telling the client about the exception being handled.
|
|
128
|
+
|
|
129
|
+
A traceback discloses paths and code, so it stays in the log unless the
|
|
130
|
+
``cone.show_tracebacks`` setting is enabled.
|
|
131
|
+
|
|
132
|
+
:param request: The current request.
|
|
133
|
+
:return: The message, HTML if it contains the traceback.
|
|
134
|
+
"""
|
|
135
|
+
if app_config().show_tracebacks:
|
|
136
|
+
return format_traceback()
|
|
137
|
+
return get_localizer(request).translate(
|
|
138
|
+
_('internal_error', default='An internal error occurred. Please try again later.')
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def is_same_host_url(request, url):
|
|
143
|
+
"""Check whether URL is an absolute HTTP URL on the host of the application.
|
|
144
|
+
|
|
145
|
+
URLs which cannot be judged reliably are refused: ``urlparse`` drops line
|
|
146
|
+
breaks and raises on a malformed host.
|
|
147
|
+
|
|
148
|
+
:param request: The current request.
|
|
149
|
+
:param url: The URL to check.
|
|
150
|
+
:return: Whether redirecting to the URL stays on the host of the application.
|
|
151
|
+
"""
|
|
152
|
+
if not url.isprintable():
|
|
153
|
+
return False
|
|
154
|
+
try:
|
|
155
|
+
parsed = compat.urlparse.urlparse(url)
|
|
156
|
+
except ValueError:
|
|
157
|
+
return False
|
|
158
|
+
app_host = compat.urlparse.urlparse(request.application_url).netloc
|
|
159
|
+
return parsed.scheme in ('http', 'https') and parsed.netloc == app_host
|
|
160
|
+
|
|
161
|
+
|
|
125
162
|
def bdajax_warning(attr):
|
|
126
163
|
warnings.warn(
|
|
127
164
|
f'``bdajax.{attr}`` parameter received. Bdajax is no longer '
|
|
@@ -22,16 +22,17 @@ logger = logging.getLogger('cone.app')
|
|
|
22
22
|
class WfDropdown(Tile):
|
|
23
23
|
"""Transition dropdown.
|
|
24
24
|
|
|
25
|
-
If ``do_transition`` is found in ``request.params
|
|
26
|
-
transition on ``self.model`` immediately before dropdown gets
|
|
25
|
+
If ``do_transition`` is found in ``request.params`` of a ``POST`` request,
|
|
26
|
+
perform given transition on ``self.model`` immediately before dropdown gets
|
|
27
|
+
rendered.
|
|
27
28
|
"""
|
|
28
29
|
|
|
29
30
|
def do_transition(self):
|
|
30
|
-
"""if ``do_transition`` is found on request.params
|
|
31
|
-
transition.
|
|
31
|
+
"""if ``do_transition`` is found on request.params and it is a ``POST``
|
|
32
|
+
request, perform transition.
|
|
32
33
|
"""
|
|
33
34
|
transition = self.request.params.get('do_transition')
|
|
34
|
-
if not transition:
|
|
35
|
+
if not transition or self.request.method != 'POST':
|
|
35
36
|
return
|
|
36
37
|
workflow = self.workflow
|
|
37
38
|
workflow.transition(self.model, self.request, transition)
|
|
Binary file
|
|
@@ -506,3 +506,8 @@ msgstr "Sprache"
|
|
|
506
506
|
#: src/cone/app/browser/templates/add_dropdown.pt:13
|
|
507
507
|
msgid "add"
|
|
508
508
|
msgstr "Hinzufügen"
|
|
509
|
+
|
|
510
|
+
#. Default: An internal error occurred. Please try again later.
|
|
511
|
+
#: src/cone/app/browser/utils.py:138
|
|
512
|
+
msgid "internal_error"
|
|
513
|
+
msgstr "Ein interner Fehler ist aufgetreten. Bitte versuchen Sie es später erneut."
|
|
Binary file
|
|
@@ -502,3 +502,8 @@ msgstr "Language"
|
|
|
502
502
|
#: src/cone/app/browser/templates/add_dropdown.pt:13
|
|
503
503
|
msgid "add"
|
|
504
504
|
msgstr "Add"
|
|
505
|
+
|
|
506
|
+
#. Default: An internal error occurred. Please try again later.
|
|
507
|
+
#: src/cone/app/browser/utils.py:138
|
|
508
|
+
msgid "internal_error"
|
|
509
|
+
msgstr "An internal error occurred. Please try again later."
|