Hi, On Sat, Jun 18, 2022 at 1:43 PM Leo O via FreeIPA-users < [email protected]> wrote:
> Hello guys, > > Inside my mailalias.py, I'm using: > "default_from=lambda givenname, sn: '%s.%s@%s' % (givenname.lower(), > sn.lower(), api.env.realm.lower())," > > Which pretty much blocks the user creation if the first- or last name > contains a whitespace. Is there a function similar to "lower()", let's say > a kind of "trim()" or anything else which removes whitespaces, or replaces > them with a dash etc.? > It's a python question rather than an IPA one :) You can combine split and join like this: "".join(givenname.split()) split() without the sep parameter considers consecutive whitespaces as a single separator (see https://docs.python.org/3/library/stdtypes.html#string-methods) and join concatenates the items that were found in the previous step. HTH, flo _______________________________________________ > FreeIPA-users mailing list -- [email protected] > To unsubscribe send an email to [email protected] > Fedora Code of Conduct: > https://docs.fedoraproject.org/en-US/project/code-of-conduct/ > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines > List Archives: > https://lists.fedorahosted.org/archives/list/[email protected] > Do not reply to spam on the list, report it: > https://pagure.io/fedora-infrastructure >
_______________________________________________ FreeIPA-users mailing list -- [email protected] To unsubscribe send an email to [email protected] Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/[email protected] Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
