• Remember Mailing List

Why fullname cannot be a unicode string?

from Claudio Battaglino on Jul 29, 2008 11:33 AM
 This is the "register" method into the file remember/content/member.py (remember 1.0rc1):


    def register(self):
        """
        perform any registration information necessary after a member is registered
        """
        rtool = getToolByName(self, 'portal_registration')
        site_props = getToolByName(self, 'portal_properties').site_properties

        # XXX unicode names break sending the email
        unicode_name = self.getFullname()
        self.setFullname(str(unicode_name))
        if site_props.validate_email or self.getMail_me():
            rtool.registeredNotify(self.getUserName())


Often, registering a new member with a script, I have this error: 

....
    * Module None, line 2, in registerAndSendEmails
      <PythonScript at /Plone/portal_workflow/eumember_approval_workflow/scripts/registerAndSendEmails>
      Line 2
    * Module Products.remember.content.member, line 635, in register

UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 2: ordinal not in range(128)


The error happens at this line: self.setFullname(str(unicode_name))

Why is there a cast of the string "unicode_name" ?

If I modify that line in this way: self.setFullname(unicode_name) I have no errors.
According to you, is this modification right?


claudio





Return to date view: threaded or flat