Re: Unicode + memcache = bug

2007-07-16 Thread Jeremy Dunck
On 7/12/07, Simon G. <[EMAIL PROTECTED]> wrote: > > #4845 is probably related here in some way, giving this traceback: I've attached my patch and tests to that ticket. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Unicode + memcache = bug

2007-07-12 Thread Simon G.
#4845 is probably related here in some way, giving this traceback: PythonHandler django.core.handlers.modpython: MemcachedStringEncodingError: Keys must be str()'s, not unicode. Convert your unicode strings using mystring.encode(charset)! There's a few patches there which force the keys to ASCII

Re: Unicode + memcache = bug

2007-07-12 Thread Bryan
probably my headache is limiting my ability to rationally articulate. :) On Jul 12, 11:24 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote: > On 7/12/07, Bryan <[EMAIL PROTECTED]> wrote: > > > trying to do a .set with bytestrings that contain non ascii char > > values doesn't work. It has to do a .

Re: Unicode + memcache = bug

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Bryan <[EMAIL PROTECTED]> wrote: > trying to do a .set with bytestrings that contain non ascii char > values doesn't work. It has to do a .encode('UTF-8') on the string I > was attempting to push into memcached. and likewise on pulling it > back out I had to do a .decode('UTF-8').

Re: Unicode + memcache = bug

2007-07-12 Thread Bryan
I ran into a similar issue when accessing the memcached python api. When running django unicode the value returned from the database was valid. However when running the non unicode version of django it'd blow up in my face. trying to do a .set with bytestrings that contain non ascii char value

Re: Unicode + memcache = bug

2007-07-12 Thread Chad Maine
I did notice this bug, but it went away when I switched to cmemcache (a much faster alternative if its availble to you). On 7/12/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > > When using the low-level cache and memcache as the backend, you're > likely to run into this stack trace: > > ... > Fil

Re: Unicode + memcache = bug

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 08:55 -0500, Jeremy Dunck wrote: > On 7/12/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > > > On Thu, 2007-07-12 at 05:34 -0500, Jeremy Dunck wrote: > ... > > > What's going on here is that the memcache.py library does this with > > > the passed parameters: > > > > > >

Re: Unicode + memcache = bug

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > On Thu, 2007-07-12 at 05:34 -0500, Jeremy Dunck wrote: ... > > What's going on here is that the memcache.py library does this with > > the passed parameters: > > > > fullcmd = "%s %s %d %d %d\r\n%s" % (cmd, key, flags, time, len(val), v

Re: Unicode + memcache = bug

2007-07-12 Thread Malcolm Tredinnick
On Thu, 2007-07-12 at 05:34 -0500, Jeremy Dunck wrote: > When using the low-level cache and memcache as the backend, you're > likely to run into this stack trace: > > ... > File "/pegasus/code/current/django/core/cache/backends/memcached.py" in set > 48. self._cache.set(key, value, timeout or s

Re: Unicode + memcache = bug

2007-07-12 Thread Jeremy Dunck
On 7/12/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote: ... > It may be that only the memcache backend has this problem, but the > general solution I'd suggest is to use smart_str on the key given to > each low-level cache's backend set method. Works-for-me. To be clear, if this is accepted as a so

Unicode + memcache = bug

2007-07-12 Thread Jeremy Dunck
When using the low-level cache and memcache as the backend, you're likely to run into this stack trace: ... File "/pegasus/code/current/django/core/cache/backends/memcached.py" in set 48. self._cache.set(key, value, timeout or self.default_timeout) File "/usr/lib/python2.5/site-packages/memcach