<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 7/31/19 11:37 AM, Carl Boberg wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CANnFLQwcJ1Axfwo6wwJ54PnnRHqLLNcuOVgXyo+UcVpr7efZaw@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>
          <div dir="ltr" class="gmail_signature"
            data-smartmail="gmail_signature">
            <div dir="ltr">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div>
                      <div class="gmail-m_8385193948001352957gmail-gE
                        gmail-m_8385193948001352957gmail-iv
                        gmail-m_8385193948001352957gmail-gt"
                        style="padding:20px 0px
0px;font-size:0.875rem;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><span
style="font-family:Arial,Helvetica,sans-serif;font-size:small">Hi list!</span><br>
                      </div>
                      <div class="gmail-m_8385193948001352957gmail-"
style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium">
                        <div id="gmail-m_8385193948001352957gmail-:dj"
                          class="gmail-m_8385193948001352957gmail-ii
                          gmail-m_8385193948001352957gmail-gt"
                          style="font-size:0.875rem;direction:ltr;margin:8px
                          0px 0px;padding:0px">
                          <div id="gmail-m_8385193948001352957gmail-:dk"
                            class="gmail-m_8385193948001352957gmail-a3s
                            gmail-m_8385193948001352957gmail-aXjCH"
style="overflow:hidden;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:small;line-height:1.5;font-family:Arial,Helvetica,sans-serif">
                            <div dir="ltr">
                              <div><br>
                              </div>
                              <div>We have been using kallithea for
                                quite a while now and are very happy
                                with it. But recently I have upgraded
                                our two instances from 3.x to 4.1.</div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>Latest sqlite version is 3.29.0 .</p>
    <p>Latest Kallithea version is 0.4.1 . Is that the version you are
      using?</p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:CANnFLQwcJ1Axfwo6wwJ54PnnRHqLLNcuOVgXyo+UcVpr7efZaw@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div dir="ltr" class="gmail_signature"
            data-smartmail="gmail_signature">
            <div dir="ltr">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div>
                      <div class="gmail-m_8385193948001352957gmail-"
style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium">
                        <div id="gmail-m_8385193948001352957gmail-:dj"
                          class="gmail-m_8385193948001352957gmail-ii
                          gmail-m_8385193948001352957gmail-gt"
                          style="font-size:0.875rem;direction:ltr;margin:8px
                          0px 0px;padding:0px">
                          <div id="gmail-m_8385193948001352957gmail-:dk"
                            class="gmail-m_8385193948001352957gmail-a3s
                            gmail-m_8385193948001352957gmail-aXjCH"
style="overflow:hidden;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:small;line-height:1.5;font-family:Arial,Helvetica,sans-serif">
                            <div dir="ltr">
                              <div>Upgrade went fine and all seems to
                                work ok except fort this;</div>
                              <div>We have our users in Active Directory
                                (server 2012) and for those users with
                                non ascii chars in their name (åäö in
                                our case since we are in Sweden) this
                                happens when they try to login:</div>
                              <div><br>
                              </div>
                              <div>2019-07-30 16:02:55.021 ERROR
                                [kallithea.model.user] Traceback (most
                                recent call last):<br>
                                  File
"/opt/kallithea/.local/lib/python2.7/site-packages/kallithea/model/user.py",
                                line 169, in create_or_update<br>
                                    Session().flush() # make database
                                assign new_user.user_id<br>
                                 
                                ...<br>
                                  File
"/opt/kallithea/.local/lib/python2.7/site-packages/sqlalchemy/engine/default.py",
                                line 536, in do_execute<br>
                                    cursor.execute(statement,
                                parameters)<br>
                                ProgrammingError:
                                (sqlite3.ProgrammingError) You must not
                                use 8-bit bytestrings unless you use a
                                text_factory that can interpret 8-bit
                                bytestrings (like text_factory = str).
                                It is highly recommended that you
                                instead just switch your application to
                                Unicode strings. [SQL: u'INSERT INTO
                                users (username, password, active,
                                admin, firstname, lastname, email,
                                last_login, extern_type, extern_name,
                                api_key, inherit_default_permissions,
                                created_on, user_data) VALUES (?, ?, ?,
                                ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)']
                                [parameters: (u'omannen', '*masked*', 0,
                                0, u'\xf6mannen', u'man',
                                'omannen@*masked*', None, 'ldap',
                                'CN=\xc3\xb6mannen man,OU=*masked*',
                                '*masked*', 1, '2019-07-30
                                16:02:55.016018', None)] (Background on
                                this error at: <a
                                  href="http://sqlalche.me/e/f405"
                                  target="_blank" moz-do-not-send="true">http://sqlalche.me/e/f405</a>)<br>
                              </div>
                              <div><br>
                              </div>
                              This is an example with a test user called
                              "Ömannen man". It worked fine before
                              upgrade and i I rename the user in AD to
                              not have any ÅÄÖ login works...<br
                                clear="all">
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
    <p>That seems to be because you have also have non-ascii characters
      in the LDAP CN. That was not expected.</p>
    <p>You can probably fix it by changing your
<a class="moz-txt-link-freetext" href="https://kallithea-scm.org/repos/kallithea/files/0.4.1/kallithea/model/user.py#L148">https://kallithea-scm.org/repos/kallithea/files/0.4.1/kallithea/model/user.py#L148</a>
      to use "safe_unicode" instead of "safe_str". Can you confirm that
      works for you?</p>
    <p>/Mads<br>
    </p>
  </body>
</html>