-
Notifications
You must be signed in to change notification settings - Fork 6
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 view that lists all links in a tool #781
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some suggestions. But it seems to work when I try it locally.
attributes_checked = [ | ||
"description", | ||
"introduction", | ||
"solution_direction", | ||
"legal_reference", | ||
"action", | ||
"action_plan", | ||
"prevention_plan", | ||
"requirements", | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure these are all the fields in all relevant content types?
You could dynamically get all text fields and iterate over them. See how collective.searchandreplace does it. Ignore the Archetypes-related code. ;-)
url_regex = re.compile( | ||
r"https?://[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b" | ||
r"(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably fine. Alternative idea: look for contents of href/src, so ="http..."
, with at the dots anything except a double quote or a space. Something like this:
>>> re.compile(r'="(https?://[^ "]*)"').match('="https://some.url"').groups()
('https://some.url',)
if hasattr(obj, "objectValues"): | ||
for child in obj.objectValues(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically objectValues
can contain non-contentish items, for example an object for local workflow policies. If I want only content I prefer contentValues
:
if hasattr(obj, "objectValues"): | |
for child in obj.objectValues(): | |
if hasattr(obj, "contentValues"): | |
for child in obj.contentValues(): |
<dt tal:define=" | ||
obj python:item['object']; | ||
"> | ||
<a href="${obj/absolute_url}">${obj/title}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you suggest in the issue, I would say it is better to link to the edit form directly:
<a href="${obj/absolute_url}">${obj/title}</a> | |
<a href="${obj/absolute_url}/edit">${obj/title}</a> |
Ref https://github.com/syslabcom/scrum/issues/2757