Modify

Opened 8 weeks ago

Closed 3 weeks ago

#13222 closed defect (fixed)

String Formating "%s" output in user creation error

Reported by: conloos@… Owned by: Ryan J Ollos
Priority: low Component: AccountManagerPlugin
Severity: minor Keywords:
Cc: Trac Release: 1.2

Description (last modified by Ryan J Ollos)

Hi,

If i try to create a user account and the account isn't compatible with the regexp policy, an error message is shown. In this error message the string formatting field %s is displayed, not the username who should be created.

Attachments (0)

Change History (8)

comment:1 Changed 8 weeks ago by Ryan J Ollos

Providing the actual error message would be useful.

comment:2 Changed 8 weeks ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 8 weeks ago by Ryan J Ollos

This appears to be an error in [12384/accountmanagerplugin/trunk/acct_mgr/register.py]. The message args are stored in msg_args, but nothing is done with them. I'm unsure why a noop translation marker needs to be used in this case. The following patch might be sufficient:

  • acct_mgr/register.py

     
    313313            req.args.get('username', '').strip())
    314314        if req.path_info != '/prefs' and self.username_regexp != '' and \
    315315                not re.match(self.username_regexp.strip(), username):
    316             raise RegistrationError(N_(
    317                 "Username %s doesn't match local naming policy."),
    318                 tag.b(username)
    319             )
     316            raise RegistrationError(tag_(
     317                "Username %(username)s doesn't match local naming policy.",
     318                username=tag.b(username)
     319            ))
    320320
    321321        email = req.args.get('email', '').strip()
    322322        if self.env.is_enabled(EmailCheck) and \

Similar changes likely need to be made elsewhere in the module.

Last edited 8 weeks ago by Ryan J Ollos (previous) (diff)

comment:4 Changed 8 weeks ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 16680:

TracAccountManager 0.5dev: Fix messages not interpolated

Fixes #13222.

comment:5 Changed 8 weeks ago by Jun Omae

Since [16680], _("revoked") and _('pending') are passed to set_user_attribute(). Those localized revoked and pending would be stored in session_attribute.value column.

I consider we should localize the values when displaying on browser and console rather than storing localized values.

comment:6 Changed 8 weeks ago by Ryan J Ollos

Resolution: fixed
Status: closedreopened

comment:7 Changed 8 weeks ago by Ryan J Ollos

Status: reopenedaccepted

comment:8 Changed 3 weeks ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 16720:

TracAccountManager 0.5dev: Don't store translated strings in session attributes

Fixes #13222.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.