Commit 44c7de3e authored by Fabien Amarger's avatar Fabien Amarger
Browse files

merge 3.32 into default

Pipeline #72542 failed with stages
in 27 minutes and 40 seconds
......@@ -693,3 +693,5 @@ f0007241c4773160b6c2b93a0b56a9617a74389c 3.31.1
e106c287f71a1f49e681214a20ee26e81f695043 3.31.2
ef46f909341c31472545c693e63d4ad79a3087da 3.31.3
b43a0459d50017c6a85a7def26fdd551c2308240 3.32.0
955e3a5725f8d47ffc878723281b91aee1210b76 3.32.1
9965ff53bda2cbe0378a32d4d34feb94641116b2 3.32.2
......@@ -22,7 +22,7 @@ software
modname = distname = "cubicweb"
numversion = (3, 32, 0)
numversion = (3, 32, 2)
version = ".".join(str(num) for num in numversion)
description = "a repository of entities / relations for knowledge management"
......
......@@ -14,17 +14,22 @@ class TestApp(webtest.TestApp):
self.admin_password = admin_password
self._ident_cookie = None
def reset(self):
super().reset()
self._ident_cookie = None
def post(
self,
route,
params,
params=None,
do_not_grab_the_crsf_token=False,
do_not_inject_origin=False,
form_with_csrf_token_url="/login",
form_number=0,
**kwargs,
):
if params is None:
params = {}
if self._ident_cookie:
if "headers" in kwargs and "Cookie" not in kwargs["headers"]:
kwargs["headers"]["Cookie"] = self._ident_cookie
......
---
default:
image: python
# avoid running duplicate pipelines for both topic head and MR
# see: https://docs.gitlab.com/ee/ci/yaml/#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_REF_NAME =~ /^topic\/.*/ && $CI_OPEN_MERGE_REQUESTS'
when: never
- when: always
image: python:3.7
include:
- project: "open-source/gitlab-ci-templates"
ref: "branch/default"
file:
- "templates/no-duplicated-ci-pipelines.yml" # use workflow to avoid duplicated pipelines
- "templates/lint/flake8.yml" # will do the equivalent of 'tox -e flake8'
- "templates/lint/black.yml" # will do the equivalent of 'tox -e black'
- "templates/lint/check-manifest.yml" # will do the equivalent of 'tox -e check-manifest'
- "templates/lint/yamllint.yml" # will do the equivalent of 'tox -e yamllint'
- "templates/tests/py3.yml" # will do the equivalent of 'tox -e py3'
- "templates/create-release-on-heptapod.yml" # this will create a release on heptapod
- "templates/upload-to-pypi.yml" # on a new mercurial tag (expected to be done with release-new), will push a release on pypi
# - "templates/lint/mypy.yml" # will do the equivalent of 'tox -e mypy'
# - "templates/upload-python-package-to-heptapod.yml" # upload the package to heptapod registry on new tag
stages:
- lint
- tests
- after-tests
before_script:
- pip install tox
flake8:
stage: lint
script: tox -e flake8
check-manifest:
stage: lint
script: tox -e check-manifest
black:
stage: lint
script: tox -e black
yamllint:
rules:
- changes:
- "**/*.yaml"
- "**/*.yml"
stage: lint
before_script:
- pip install tox
script:
- tox -e yamllint
# If you have mypy set up
# mypy:
# stage: lint
# script: tox -e mypy
py3:
stage: tests
script: tox -e py3
# If you have your project on readthedocs, you can automatically trigger its
# build by setting:
# - READTHEDOCS_TOKEN
# - READTHEDOCS_ID
# in your heptapod project Settings > CI/CD > Variables.
# You can find those secrets by creating a new integration in your readthedocs
# project here: https://readthedocs.org/dashboard/cubicweb_%(cubename)s/integrations/
#
# Related documentation:
# https://docs.readthedocs.io/en/latest/webhooks.html#using-the-generic-api-integration
#
# trigger-readthedocs:
# only:
# refs:
# - branch/default
# stage: after-tests
# script:
# # regarding the " everywhere when there is a '%%': yaml is extremly weird when %% are involved
# - curl -X POST -d "token=${READTHEDOCS_TOKEN}" https://readthedocs.org/api/v2/webhook/cubicweb_%(cubename)s/${READTHEDOCS_ID} -w "\nhttp code:"\ "%%{http_code}\n" -f
- release
- publish
# for el5, force use of python2.6
%%if 0%%{?el5}
%%define python python26
%%define __python /usr/bin/python2.6
%%else
%%define python python
%%define __python /usr/bin/python
%%endif
%%{!?_python_sitelib: %%define _python_sitelib %%(%%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: %(distname)s
Version: 0.1.0
Release: logilab.1%%{?dist}
Summary: %(shortdesc)s
Group: Applications/Internet
License: %(license)s
Source0: %(distname)s-%%{version}.tar.gz
BuildArch: noarch
BuildRoot: %%{_tmppath}/%%{name}-%%{version}-%%{release}-buildroot
BuildRequires: %%{python} %%{python}-setuptools
Requires: cubicweb >= %(version)s
Requires: %%{python}-six >= 1.4.0
%%description
%(longdesc)s
%%prep
%%setup -q -n %(distname)s-%%{version}
%%if 0%%{?el5}
# change the python version in shebangs
find . -name '*.py' -type f -print0 | xargs -0 sed -i '1,3s;^#!.*python.*$;#! /usr/bin/python2.6;'
%%endif
%%install
%%{__python} setup.py --quiet install --no-compile --prefix=%%{_prefix} --root="$RPM_BUILD_ROOT"
%%clean
rm -rf $RPM_BUILD_ROOT
%%files
%%defattr(-, root, root)
%%{_python_sitelib}/*
......@@ -6,6 +6,5 @@ recursive-include cubicweb_%(cubename)s/i18n *.po
recursive-include cubicweb_%(cubename)s/wdoc *
recursive-include test/data bootstrap_cubes *.py
include *.ini
exclude cubicweb-%(cubename)s.spec
exclude .gitlab-ci.yml
exclude .yamllint
......@@ -17,6 +17,24 @@
* with CubicWeb. If not, see <https://www.gnu.org/licenses/>.
*/
function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
const cookies = document.cookie.split(';');
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i].trim();
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) === (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
const CSRF_TOKEN = getCookie('csrf_token');
/**
* .. function:: Deferred
*
......@@ -378,6 +396,7 @@ function loadRemote(url, form, reqtype, sync) {
type: (reqtype || 'POST').toUpperCase(),
data: form,
traditional: true,
headers: { 'X-CSRF-Token': CSRF_TOKEN },
async: true,
beforeSend: function(xhr) {
......@@ -415,6 +434,7 @@ function loadRemote(url, form, reqtype, sync) {
data: form,
traditional: true,
async: false,
headers: { 'X-CSRF-Token': CSRF_TOKEN },
success: function(res) {
result = res;
}
......
......@@ -114,6 +114,7 @@ class Personne(EntityType):
description = String()
salary = Float()
travaille = SubjectRelation("Societe")
tags = SubjectRelation("BlogEntry")
class connait(RelationDefinition):
......
......@@ -393,6 +393,7 @@ class RQLSuggestionsBuilderTC(CubicWebTC):
"Any X WHERE X is Personne, X promo A",
"Any X WHERE X is Personne, X salary A",
"Any X WHERE X is Personne, X sexe A",
"Any X WHERE X is Personne, X tags A",
"Any X WHERE X is Personne, X tel A",
"Any X WHERE X is Personne, X test A",
"Any X WHERE X is Personne, X titre A",
......@@ -404,6 +405,7 @@ class RQLSuggestionsBuilderTC(CubicWebTC):
)
self.assertListEqual(
[
"Any X WHERE X is Personne, X tags A",
"Any X WHERE X is Personne, X tel A",
"Any X WHERE X is Personne, X test A",
"Any X WHERE X is Personne, X titre A",
......@@ -415,6 +417,7 @@ class RQLSuggestionsBuilderTC(CubicWebTC):
# try completion on selected
self.assertListEqual(
[
"Any X WHERE X is Personne, Y is Societe, X tags A",
"Any X WHERE X is Personne, Y is Societe, X tel A",
"Any X WHERE X is Personne, Y is Societe, X test A",
"Any X WHERE X is Personne, Y is Societe, X titre A",
......
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# copyright 2003-2021 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact https://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
......@@ -97,6 +97,18 @@ class ClickAndEditFormTC(ReleditMixinTC, CubicWebTC):
fields["manager"] = """&lt;not specified&gt;"""
self._test_fields(fields, login="contrib")
def test_admins_edit_permissions_multiple(self):
"""
Add test for the permission of relation for all subjects possibles.
- Personne has the relation "tags" only with "BlogEntry" but
- Tag could have the relations "tags" with "BlogEntry" and "CWUser"
This test check that do not generate the KeyError when trying to get
the relation between "Personne" <--> "CWUser"
"""
with self.new_access("admin").web_request() as cnx:
entity = cnx.find("Personne").limit(1).one()
entity.view("reledit", rtype="tags", role="subject")
def test_default_forms(self):
self.skipTest(
"Need to check if this test should still run post reledit/doreledit merge"
......
......@@ -179,6 +179,7 @@ class AutomaticEntityFormTC(CubicWebTC):
("travaille", "subject"),
("manager", "object"),
("connait", "object"),
("tags", "subject"),
],
)
self.assertListEqual(rbc(e, "main", "hidden"), [])
......
......@@ -436,9 +436,12 @@ class AutoClickAndEditFormView(EntityView):
ttypes = self._compute_ttypes(rschema, role)
# check permission which are not rqlexprs
for target in ttypes:
rdef = rschema.role_rdef(self.entity.e_schema, target, role)
if rdef.has_perm(self._cw, "add", **perm_args):
return True
try:
rdef = rschema.role_rdef(self.entity.e_schema, target, role)
if rdef.has_perm(self._cw, "add", **perm_args):
return True
except KeyError:
pass
# can delete related entities
related_rset = self.entity.related(rschema.type, role)
if related_rset:
......
3.32.2 (2021-07-30)
===================
🎉 New features
--------------
- use open-source/gitlab-ci-templates in cube skeleton
👷 Bug fixes
-----------
- add default value for params argument of PyramidCWTest.webapp.post (#350)
- csrf: give CSRF token when using /ajax route
- empty identification cookie on webapp.reset()
- remove *.spec from skeleton
- views: Fix reledit errors when trying modify relation with multi subjects
3.32.1 (2021-07-23)
===================
👷 Bug fixes
-----------
- pin rdflib < 6.0.0 to avoid compatibility issues
🤖 Continuous integration
------------------------
- use image from heptapod registry since r.intra was shut down
3.32.0 (2021-07-13)
===================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment