Thank you

I had to change L40
-from kallithea.lib.utils2 import safe_str, generate_api_key, 
get_current_authuser
+from kallithea.lib.utils2 import safe_str, safe_unicode, generate_api_key, 
get_current_authuser

And change L148 (i also changed L150) to safe_unicode

Now it works.

Best regards
------------------
Carl Boberg
Sysadmin / Operations
Switch: +46 8 729 88 50
Tegnérgatan 34 | 113 59 Stockholm | Sweden
www.unifaun.com<http://www.unifaun.com>


On Wed, 31 Jul 2019 at 14:00, Mads Kiilerich 
<[email protected]<mailto:[email protected]>> wrote:
On 7/31/19 11:37 AM, Carl Boberg wrote:
Hi list!

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.


Latest sqlite version is 3.29.0 .

Latest Kallithea version is 0.4.1 . Is that the version you are using?


Upgrade went fine and all seems to work ok except fort this;
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:

2019-07-30 16:02:55.021 ERROR [kallithea.model.user] Traceback (most recent 
call last):
  File 
"/opt/kallithea/.local/lib/python2.7/site-packages/kallithea/model/user.py", 
line 169, in create_or_update
    Session().flush() # make database assign new_user.user_id
  ...
  File 
"/opt/kallithea/.local/lib/python2.7/site-packages/sqlalchemy/engine/default.py",
 line 536, in do_execute
    cursor.execute(statement, parameters)
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: 
http://sqlalche.me/e/f405)

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...


That seems to be because you have also have non-ascii characters in the LDAP 
CN. That was not expected.

You can probably fix it by changing your 
https://kallithea-scm.org/repos/kallithea/files/0.4.1/kallithea/model/user.py#L148
 to use "safe_unicode" instead of "safe_str". Can you confirm that works for 
you?

/Mads
_______________________________________________
kallithea-general mailing list
[email protected]
https://lists.sfconservancy.org/mailman/listinfo/kallithea-general

Reply via email to