Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add universal relations service #1602

Merged
merged 91 commits into from
May 23, 2023
Merged
Changes from 1 commit
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
d782bb7
Query relations with universal endpoint.
ksuess Mar 19, 2023
bf3d063
Catch Products.CMFPlone.relationhelper ImportError
ksuess Mar 20, 2023
d272b15
Remove unused imports
ksuess Mar 20, 2023
a6b9abb
Add option to restrict number of queried relations.
ksuess Mar 20, 2023
9c989fb
Rebuild relations
ksuess Mar 20, 2023
17f5415
@relations: onlyBroken: Return broken relations
ksuess Mar 21, 2023
c6c190a
Update relations.md
ksuess Mar 21, 2023
272223a
Add tests for relations
ksuess Mar 21, 2023
b8a3a72
Merge branch 'master' into one-relations-endpoint
avoinea Mar 21, 2023
3d0ee49
Draft/placeholder: provide vocabulary query of relation
ksuess Mar 22, 2023
755046b
Provide vocabulary query of relation for …
ksuess Mar 22, 2023
44d43f6
Add relations
ksuess Mar 23, 2023
64013e4
Modification of relations only if plone.api.relation available
ksuess Mar 23, 2023
ae40a67
Delete relations.
ksuess Mar 23, 2023
ccbabdd
flake
ksuess Mar 23, 2023
0f2ccc4
Create 1432.feature
ksuess Mar 23, 2023
63036e4
Add UID to relationvalue_converter summary
ksuess Mar 25, 2023
b96c94c
Update resps
ksuess Mar 25, 2023
7a9d0c7
Fix exceptions
ksuess Mar 25, 2023
3211ab7
Update resps
ksuess Mar 25, 2023
7f1d240
Restore make_summary
ksuess Mar 25, 2023
e0f85fd
Update tests
ksuess Mar 25, 2023
3c9bf4a
More tests
ksuess Mar 26, 2023
1a985ed
Delete relations by relation name, source, or target, or combination
ksuess Mar 26, 2023
1dfd97b
Remove debug logging
ksuess Mar 26, 2023
7bb849a
Fix f-strings
ksuess Mar 26, 2023
b3eed50
Fix error messages
ksuess Mar 26, 2023
59d04c8
Update test_relations_get.py: test if relation stuff available
ksuess Mar 26, 2023
0ee8df2
Merge branch 'master' into one-relations-endpoint
ksuess Mar 26, 2023
b531db3
Update test_relations_get.py
ksuess Mar 27, 2023
a326d27
Delete test_relations_get.py
ksuess Mar 27, 2023
9c77d48
Test: Is vocabulary query included in response
ksuess Mar 27, 2023
4a9885d
Moooree tests
ksuess Mar 27, 2023
5d7b623
How to use @relations service to query or modify relations
ksuess Mar 27, 2023
dd9c659
Update relations.md
ksuess Mar 27, 2023
a5cb934
broken link
ksuess Mar 28, 2023
b84cffb
Delete by relation name
ksuess Mar 28, 2023
4ea511e
more tests for deleting relations
ksuess Mar 28, 2023
3a384a2
Test for anonymous
ksuess Mar 28, 2023
734b4b4
Use api.content.get with authorization check included
ksuess Mar 28, 2023
bc57a84
Revert "Use api.content.get with authorization check included"
ksuess Mar 28, 2023
083b2b0
make flake shake
ksuess Mar 28, 2023
d892595
Update docu
ksuess Mar 29, 2023
6aa48cf
Merge branch 'master' into one-relations-endpoint
ksuess Apr 7, 2023
197b89a
Merge branch 'master' into one-relations-endpoint
tisto Apr 26, 2023
5483d7f
prettier
ksuess Apr 28, 2023
641d903
Provide querying by source and target (SearchableText or path)
ksuess Apr 28, 2023
57f417c
Merge branch 'master' into one-relations-endpoint
ksuess Apr 28, 2023
e26ce74
Merge branch 'master' into one-relations-endpoint
tisto May 15, 2023
f5da7e8
Fix required permissions in documentation
ksuess May 16, 2023
1530e4f
Log errors on creating relations
ksuess May 16, 2023
89c7832
Log which source or target not found
ksuess May 18, 2023
1fd3b7e
myst fix
ksuess May 18, 2023
e5c4849
Update upgrade-guide.md
ksuess May 18, 2023
db34966
Apply suggestions from code review
ksuess May 18, 2023
1a03491
Apply suggestions from code review
ksuess May 18, 2023
0008ccb
Log source, target if not found. Log and reply with requested source,…
ksuess May 18, 2023
dbb1079
Do not remove image info from summary of relation source and target o…
ksuess May 18, 2023
3542701
Run black
ksuess May 18, 2023
cdfd17b
Enhance response on failure on creating or deleting relation
ksuess May 18, 2023
08971a0
Fix error type
ksuess May 18, 2023
238b2b3
Amend documentation of querying options
ksuess May 18, 2023
079b147
Merge branch 'one-relations-endpoint' of ssh://github.com/plone/plone…
ksuess May 18, 2023
e8bf957
Deleting relations: Rely on plone.api
ksuess May 19, 2023
a97149f
Fix documentation
ksuess May 19, 2023
b5a2eaa
Merge branch 'master' into one-relations-endpoint
ksuess May 19, 2023
1b76935
Update delete.py
ksuess May 19, 2023
5f78b48
Merge branch 'one-relations-endpoint' of ssh://github.com/plone/plone…
ksuess May 19, 2023
12ff36f
Apply suggestions from code review
ksuess May 19, 2023
f4682c9
Apply suggestions from code review
ksuess May 19, 2023
c92bd48
Update response code and content on deleting relations
ksuess May 19, 2023
b46f7d9
Update format of @relations GET
ksuess May 19, 2023
54f4521
Request to rebuild relations now POST with /rebuild
ksuess May 19, 2023
9059b16
run black
ksuess May 19, 2023
cf12ddb
black
davisagli May 19, 2023
64a8446
Update docs description as suggested by Steve
davisagli May 19, 2023
5e9a9d2
Update response format in onlyBroken docs, and remove old unused example
davisagli May 19, 2023
4b9078b
Change relations -> stats in the get_stats response
davisagli May 19, 2023
ce5050f
Fix tests according to 'Change relations -> stats in the get_stats re…
ksuess May 19, 2023
7d8ae68
Merge branch 'master' into one-relations-endpoint
ksuess May 19, 2023
6e6df7f
Uncomment "delete by relation name" after release of plone.api 2.0.2
ksuess May 20, 2023
0e60356
Respond with "Unprocessable Entity" if creating fails
ksuess May 20, 2023
d2200c1
docu more precise
ksuess May 20, 2023
5d927d4
run black
ksuess May 20, 2023
72d1f9f
Apply suggestions from code review
ksuess May 20, 2023
646ea46
Apply suggestions from code review
ksuess May 20, 2023
0a6f7ac
Precise documentation on deleting list of relations
ksuess May 20, 2023
9a51857
run black
ksuess May 20, 2023
10ebdff
Fix format for broken relations according format for relations
ksuess May 20, 2023
7dd7422
run black
ksuess May 20, 2023
1c47262
Apply docs suggestions from code review
ericof May 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix format for broken relations according format for relations
ksuess committed May 20, 2023
commit 10ebdff3e439dd5c5affabc814ead8a9263358bd
18 changes: 11 additions & 7 deletions src/plone/restapi/services/relations/get.py
Original file line number Diff line number Diff line change
@@ -205,16 +205,20 @@ def reply(self):

# Get broken relations for all relation types
if onlyBroken:
data = {}
relationNames = getBrokenRelationNames()
for relationName in relationNames:
foo = get_relations(relationship=relationName, onlyBroken=True)
data.update(foo)
return {
if len(relationNames) == 0:
return self.reply_no_content(status=204)
result = {
"@id": f'{self.request["SERVER_URL"]}{self.request.environ["REQUEST_URI"]}',
"items": data,
"items_total": dict([(el, len(data[el])) for el in data]),
"relations": {}
}
for relationName in relationNames:
rels = get_relations(relationship=relationName, onlyBroken=True)
result["relations"][relationName] = {
"items": rels[relationName],
"items_total": len(rels)
}
return result

# Stats
if not source and not target and not relationship: