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

Allow to access the datatime object in epn #7333

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Et7f3
Copy link

@Et7f3 Et7f3 commented Apr 24, 2024

We have internationals users and we want to format in their native language.

@rcritten
Copy link
Contributor

Please see https://www.freeipa.org/page/Contribute/Code on PR requirements.

The text of the commit doesn't match the content (this has nothing to do with i18n).

Will that strptime work? I think the value will be like 20240724200619Z

The time delta is going to display oddly, like: 3:59:59.999997

@Et7f3
Copy link
Author

Et7f3 commented Apr 26, 2024

The text of the commit doesn't match the content (this has nothing to do with i18n).

The title explain the modification: we provide the datetime object in variable for template. Thus in template we can do expiration_datetime.strfmt("with my native language").

Will that strptime work ?

Yes it can parse date from FreeIPA server. I intended to let user format as their wish. I could Have added another setting with the python format.

The time delta is going to display oddly, like: 3:59:59.999997

In template we can do .days or a formatting function.

Please see https://www.freeipa.org/page/Contribute/Code on PR requirements.

Sorry, I just opened to not lost my change. I will clean later.

@Et7f3 Et7f3 force-pushed the patch-2 branch 2 times, most recently from 0216a60 to e32de37 Compare July 16, 2024 12:29
@Et7f3
Copy link
Author

Et7f3 commented Jul 16, 2024

Please see https://www.freeipa.org/page/Contribute/Code on PR requirements.

The text of the commit doesn't match the content (this has nothing to do with i18n).

I have updated my (comment)[https://www.freeipa.org/page/Contribute/Code#create-pull-request-on-github] and think it will better describe why this change should be merged.

Will that strptime work? I think the value will be like 20240724200619Z

I saw I was duplicating code that was just below so I simply moved the code upwards and kept the format (this code was already merged so yes it will work or we have a bug)

The time delta is going to display oddly, like: 3:59:59.999997

I expect user to use .strftime because they get the raw python object.

expiration_delta print like: 1:30:02.143800 but expiration_delta.days: 1
expiration_datetime: 2024-07-16 14:00:00+00:00 and in our template expiration_datetime.strftime("%02d/%02m/%04Y"): 16/07/2024 (dd/mm/yy like French format)

@Et7f3
Copy link
Author

Et7f3 commented Jul 16, 2024

The CI error is not be related with my change:

+ which coredumpctl
which: no coredumpctl in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)

@rcritten
Copy link
Contributor

Please update the man page with the new directives. Be sure to mention that they are python objects and not strings.

…late

We have internationals users and we want to format in their native language.
Here we pass the raw datimeobject and user can now use strftime in jinja
template to format depending on user language.
This PR helps in situation where their is one instance of IPA by country
one node in country X can be configured with a date format X and node in
country Y can be confiugred with a date format Y.

Maybe a more general solution is to add a country attribute and make it
visibile to template so it can dynamically switch used template per user
in the single node case.

No related issue opened.
@Et7f3
Copy link
Author

Et7f3 commented Jul 30, 2024

I added text to man pages, reviewed by chat gpt (to improve phrasing), added examples with jinja (to highlight they are python objects). I also added the python exact class for referring to the docs.
The rendered manual section:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants