Re: [Django] #9180: Low-level cache interface incorrectly tries to typecast bytestring

2010-04-23 Thread Django
#9180: Low-level cache interface incorrectly tries to typecast bytestring
+---
  Reporter:  p  | Owner:  nobody
Status:  closed | Milestone:
 Component:  Cache system   |   Version:  1.1   
Resolution:  duplicate  |  Keywords:
 Stage:  Ready for checkin  | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by obeattie):

  * status:  new => closed
  * resolution:  => duplicate

Comment:

 Alright, guess this was already fixed in [12637]. Marking this as a
 duplicate of #11012, even though that's strictly a dupe of this.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #9180: Low-level cache interface incorrectly tries to typecast bytestring

2010-04-23 Thread Django
#9180: Low-level cache interface incorrectly tries to typecast bytestring
+---
  Reporter:  p  | Owner:  nobody
Status:  new| Milestone:
 Component:  Cache system   |   Version:  1.1   
Resolution: |  Keywords:
 Stage:  Ready for checkin  | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by obeattie):

 * cc: obeattie (added)

Comment:

 Any update on the checkin status of this patch? The use case I came across
 this on was storing zlib-compressed data in the cache. Since that needs to
 be preserved as raw bytes, it's not possible to store and retrieve without
 further processing (thus lengthening the compressed data).

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #9180: Low-level cache interface incorrectly tries to typecast bytestring

2009-09-30 Thread Django
#9180: Low-level cache interface incorrectly tries to typecast bytestring
+---
  Reporter:  p  | Owner:  nobody
Status:  new| Milestone:
 Component:  Cache system   |   Version:  1.1   
Resolution: |  Keywords:
 Stage:  Ready for checkin  | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by lvscar):

 * cc: lvscar (added)
  * version:  1.0 => 1.1
  * stage:  Accepted => Ready for checkin

Comment:

 django 1.1 lack the patch!

 i patch it to django1.1 while cmemcache as my cache backend.
 it make  django.core.cache.cache.get method work great with pickled data

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9180: Low-level cache interface incorrectly tries to typecast bytestring

2009-07-19 Thread Django
#9180: Low-level cache interface incorrectly tries to typecast bytestring
---+
  Reporter:  p | Owner:  nobody
Status:  new   | Milestone:
 Component:  Cache system  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by gonz):

 * cc: gonz (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9180: Low-level cache interface incorrectly tries to typecast bytestring

2008-10-13 Thread Django
#9180: Low-level cache interface incorrectly tries to typecast bytestring
---+
  Reporter:  p | Owner:  nobody
Status:  new   | Milestone:
 Component:  Cache system  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by AdamG):

 * cc: [EMAIL PROTECTED] (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9180: Low-level cache interface incorrectly tries to typecast bytestring

2008-10-13 Thread Django
#9180: Low-level cache interface incorrectly tries to typecast bytestring
---+
  Reporter:  p | Owner:  nobody
Status:  new   | Milestone:
 Component:  Cache system  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by AdamG):

  * has_patch:  0 => 1

Comment:

 I've tested `9180.diff` using the `memcache` library; I'd appreciate it if
 someone could test it with `cmemcache` so we could get this to ready for
 checkin.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9180: Low-level cache interface incorrectly tries to typecast bytestring

2008-09-24 Thread Django
#9180: Low-level cache interface incorrectly tries to typecast bytestring
---+
  Reporter:  p | Owner:  nobody
Status:  new   | Milestone:
 Component:  Cache system  |   Version:  1.0   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by AdamG):

 See also #5589. I would greatly prefer the `raw` kwarg, as using the
 1-tuple solution would mean that Python pickles are actually being cached,
 which would mean that the cache can only be primed by Python code - and
 when using something like memcached, that's not always the case. For
 example, I often put output from imagemagick into memcached; right now,
 that's innaccessible from `django.core.cache.cache` due to this issue.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #9180: Low-level cache interface incorrectly tries to typecast bytestring

2008-09-22 Thread Django
#9180: Low-level cache interface incorrectly tries to typecast bytestring
--+-
 Reporter:  p |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Cache system  | Version:  1.0   
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 The low-level Django cache API encodes basestrings as UTF-8 when
 {{{set}}}ting, and decodes basestrings as Unicode when {{{get}}}ting.

 If you're trying to store a string of bytes in the cache -- for instance,
 the raw bytes of an image -- the set operation will possibly modify the
 data by encoding it, and the get operation will potentially raise a
 !DjangoUnicodeDecodeError if the codec can't decode bytes in the string.

 {{{
 #!python
 from django.core.cache import cache
 from django.utils.encoding import DjangoUnicodeDecodeError

 # The simplest possible GIF: a 43-byte, 1x1-pixel transparent image
 EMPTY_GIF_BYTES =
 
'GIF89a\x01\x00\x01\x00\xf0\x00\x00\xb0\x8cZ\x00\x00\x00!\xf9\x04\x00\x00\x00\x00\x00,\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;'

 cache.set('empty_gif', EMPTY_GIF_BYTES)

 try:
 cache.get('empty_gif')
 except DjangoUnicodeDecodeError:
 print 'Tried to decode GIF bytestring as a Unicode string'
 else:
 print 'Got the raw GIF bytestring'
 }}}

 A workaround is to create a one-tuple from the bytestring when storing,
 and when retrieving, returning the single element from the tuple.

 {{{
 #!python

 def raw_cache_set(key, value, timeout_seconds=None):
 cache.set(key, (value,), timeout_seconds=timeout_seconds)

 def raw_cache_get(key):
 value = cache.get(key)
 if value is not None:
 return value[0]

 raw_cache_set('empty_gif', EMPTY_GIF_BYTES)

 assert raw_cache_get('empty_gif') == EMPTY_GIF_BYTES
 }}}

 One possible fix would be to expose a {{{raw}}} keyword argument boolean
 to {{{cache.get}}}, {{{cache.set}}}, {{{cache.add}}}, {{{cache.get_many}}}
 that would conditionally skip any {{{smart_unicode}}} or other
 encoding/decoding logic when storing or retrieving from the cache.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---