[Repoze-dev] [issue149] Fix SAWarning messages when using repoze.who.plugins.sa plugins

2010-06-02 Thread Nuno Teixeira

New submission from Nuno Teixeira :

To avoid SAWarning messages like below request to DB should be unicoded:

SAWarning: Unicode type received non-unicode bind param value 'foo'

nteixe...@nteixeira-desktop:~/co/repoze.whoplugins.whoalchemy$ svn diff
Index: repoze/who/plugins/sa.py

===
--- repoze/who/plugins/sa.py(revision 9491)
+++ repoze/who/plugins/sa.py(working copy)
@@ -53,7 +53,7 @@
 self.translations['user_name'])
 
 query = self.dbsession.query(self.user_class)
-query = query.filter(username_attr==username)
+query = query.filter(username_attr == unicode(username))
 
 try:
 return query.one()

--
messages: 413
nosy: nteixeira
priority: bug
status: unread
title: Fix SAWarning messages when using repoze.who.plugins.sa plugins

__
Repoze Bugs 

__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


[Repoze-dev] [issue149] Fix SAWarning messages when using repoze.who.plugins.sa plugins

2010-06-02 Thread Gustavo Narea

Gustavo Narea  added the comment:

The SQLAlchemy plugin is not tied to ASCII or Unicode, and you can use it 
without 
getting any warning as long as you pass the username/password properly encoded.

I cannot apply that patch because some people use ASCII, and also the right 
place to 
fix this is the repoze.who identifier plugin that you are using, which is not 
giving 
repoze.who the username/password properly.

Are you using a built-in repoze.who identifier plugin? Or is it maintained by a 
3rd party? 

If it's a homegrown identifier, you may want to have a look at the code for 
repoze.who-
friendlyform which gives repoze.who the credentials with the right charset:
http://svn.repoze.org/whoplugins/whofriendlyforms/trunk/repoze/who/plugins/friendlyfor
m.py

Please use the mailing list if you need help to fix the identifier:
http://lists.repoze.org/listinfo/repoze-dev

Cheers.

--
assignedto:  -> Gustavo
nosy: +Gustavo
priority: bug -> wish
status: unread -> resolved
topic: +repoze.who

__
Repoze Bugs 

__
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev


Re: [Repoze-dev] [issue149] Fix SAWarning messages when using repoze.who.plugins.sa plugins

2010-06-02 Thread Nuno Teixeira
Olá Gustavo,

Thanks for your fast reply and your suggestions! ;)

That occurs when using repoze.who.plugins.cookie.InsecureCookiePlugin as 
an identifier.

As I can see cookies are stored as ASCII strings so 
cookie.value.decode('base64') (#1 @ line 25) returns an ASCII string 
which is passed to authenticator's authenticate module.

That's why SA is complaining about getting an ASCII string as username. 
Probably I'll override cookie identify method.

#1 - http://svn.repoze.org/repoze.who/trunk/repoze/who/plugins/cookie.py

Cheers,
Nuno

On 06/02/2010 02:56 PM, Gustavo Narea wrote:
>
> Gustavo Narea  added the comment:
>
> The SQLAlchemy plugin is not tied to ASCII or Unicode, and you can use it 
> without
> getting any warning as long as you pass the username/password properly 
> encoded.
>
> I cannot apply that patch because some people use ASCII, and also the right 
> place to
> fix this is the repoze.who identifier plugin that you are using, which is not 
> giving
> repoze.who the username/password properly.
>
> Are you using a built-in repoze.who identifier plugin? Or is it maintained by 
> a 3rd party?
>
> If it's a homegrown identifier, you may want to have a look at the code for 
> repoze.who-
> friendlyform which gives repoze.who the credentials with the right charset:
> http://svn.repoze.org/whoplugins/whofriendlyforms/trunk/repoze/who/plugins/friendlyfor
> m.py
>
> Please use the mailing list if you need help to fix the identifier:
> http://lists.repoze.org/listinfo/repoze-dev
>
> Cheers.
>
> --
> assignedto:  ->  Gustavo
> nosy: +Gustavo
> priority: bug ->  wish
> status: unread ->  resolved
> topic: +repoze.who
>
> __
> Repoze Bugs
> 
> __
> ___
> Repoze-dev mailing list
> Repoze-dev@lists.repoze.org
> http://lists.repoze.org/listinfo/repoze-dev
>

___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev