<br>
<br><font size=2 face="sans-serif">ok, thanks.. </font>
<br>
<br><font size=2 face="sans-serif"> it thus an internal implementation
that cause this</font>
<br><font size=2 face="sans-serif">I was afraid spage had become a control
char, deprecating me :)</font>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><font size=6 face="Tahoma"><b>I</b></font><font size=5 face="Tahoma">nternet</font>
<br><font size=1 face="sans-serif">xiaocong.hust@gmail.com - 08/29/2007
04:53 PM</font>
<br><font size=1 face="sans-serif"> </font>
<br>
<p><font size=1 color=#800080 face="sans-serif">To:
</font><font size=1 face="sans-serif">Jacques ALES</font>
<p><font size=1 color=#800080 face="sans-serif">cc:
</font><font size=1 face="sans-serif">philipn, memcached</font>
<p><font size=1 color=#800080 face="sans-serif">Subject:
</font><font size=1 face="sans-serif"><b>Re: check_key</b></font>
<br>
<br><font size=3>when you set a key,for example key is 'key1'<br>
you will send a command 'set key1 0 0 1' to the server and server
will use space as separator,<br>
if your key is 'key 1',<br>
the command will be 'set key 1 0 0 1', <br>
that would cause an error<br>
</font>
<br><font size=3>2007/8/29, </font><a href=mailto:jacques.ales@bnpparibas.com><font size=3 color=blue><u>jacques.ales@bnpparibas.com</u></font></a><font size=3>
<</font><a href=mailto:jacques.ales@bnpparibas.com><font size=3 color=blue><u>jacques.ales@bnpparibas.com
</u></font></a><font size=3>>:</font>
<br><font size=2 face="sans-serif"><br>
I don't understand why space is considered as a control char,</font><font size=3>
</font><font size=2 face="sans-serif"><br>
while and del is not considered so.</font><font size=3> <br>
<br>
<br>
<br>
<br>
</font><font size=6 face="Tahoma"><b><br>
I</b></font><font size=5 face="Tahoma">nternet</font><font size=3> </font><font size=1 face="sans-serif"><br>
philipn@gmail.com@</font><a href=http://lists.danga.com/ target=_blank><font size=1 color=blue face="sans-serif"><u>lists.danga.com</u></font></a><font size=1 face="sans-serif">
- 08/28/2007 06:13 PM</font><font size=3> </font><font size=1 face="sans-serif"><br>
</font><font size=3> </font>
<p><font size=1 color=#800080 face="sans-serif">Sent by:
</font><a href="mailto:memcached-bounces@lists.danga.com" target=_blank><font size=1 color=blue face="sans-serif"><u>memcached-bounces@lists.danga.com</u></font></a><font size=3>
</font>
<p><font size=1 color=#800080 face="sans-serif">To:
</font><font size=1 face="sans-serif">memcached</font><font size=3>
</font>
<p><font size=1 color=#800080 face="sans-serif">cc:
</font><font size=3> </font>
<p><font size=1 color=#800080 face="sans-serif">Subject:
</font><font size=1 face="sans-serif"><b>Re: check_key</b></font><font size=3>
</font>
<p><font size=3><br>
</font><font size=2><tt><br>
>>> c = 'hi there'<br>
>>> space = c[2]<br>
>>> ord(space)<br>
32<br>
<br>
The memcached protocol spec says no control chars. ord(c) < 33
does that.<br>
<br>
That is the latest version of the client. You can grab new releases<br>
here: </tt></font><a href="http://www.tummy.com/Community/software/python-memcached/" target=_blank><font size=2 color=blue><tt><u>http://www.tummy.com/Community/software/python-memcached/</u></tt></font></a><font size=2><tt><br>
<br>
--Philip Neustrom<br>
<br>
On 8/28/07, </tt></font><a href=mailto:jacques.ales@bnpparibas.com target=_blank><font size=2 color=blue><tt><u>jacques.ales@bnpparibas.com</u></tt></font></a><font size=2><tt>
<</tt></font><a href=mailto:jacques.ales@bnpparibas.com target=_blank><font size=2 color=blue><tt><u>
jacques.ales@bnpparibas.com</u></tt></font></a><font size=2><tt>> wrote:<br>
><br>
> hello<br>
><br>
> I'm using the python wrapper for memcached in it's version<br>
> __author__ = "Evan Martin <</tt></font><a href=mailto:martine@danga.com target=_blank><font size=2 color=blue><tt><u>martine@danga.com</u></tt></font></a><font size=2><tt>>"<br>
> __version__ = "1.36"<br>
> __copyright__ = "Copyright (C) 2003 Danga Interactive"<br>
> __license__ = "Python"<br>
><br>
> I can't figure out if this is the latest since the verion available
in the<br>
> svn repository is<br>
> </tt></font><a href=http://code.sixapart.com/svn/memcached/trunk/api/python/memcache.py target=_blank><font size=2 color=blue><tt><u>http://code.sixapart.com/svn/memcached/trunk/api/python/memcache.py
</u></tt></font></a><font size=2><tt><br>
> __author__ = "Evan Martin <</tt></font><a href=mailto:martine@danga.com target=_blank><font size=2 color=blue><tt><u>martine@danga.com</u></tt></font></a><font size=2><tt>>"<br>
> __version__ = "1.2"<br>
> __copyright__ = "Copyright (C) 2003 Danga Interactive"<br>
> __license__ = "Python"<br>
><br>
><br>
> anyway, my concern is that version 1.36 checks key validity with the<br>
> followinf function, that excludes spaces char (ascii32)<br>
> as being 'control characters'.<br>
><br>
> I was wondering is this is correct.<br>
> and also wondering why other chars as DEL(ascii127) are not excluded<br>
><br>
> thanks for your clues<br>
><br>
> jacques<br>
><br>
><br>
><br>
> def check_key(key, key_extra_len=0):<br>
> """Checks sanity of key. Fails
if:<br>
> Key length is > SERVER_MAX_KEY_LENGTH
(Raises MemcachedKeyLength).<br>
> Contains control characters (Raises
MemcachedKeyCharacterError).<br>
> Is not a string (Raises MemcachedStringEncodingError)<br>
> """<br>
> if not isinstance(key, str):<br>
> raise Client.MemcachedStringEncodingError,
("Keys<br>
> must be str()'s, not"<br>
> "unicode.
Convert your unicode strings using "<br>
> "mystring.encode(charset)!")<br>
><br>
> if isinstance(key, basestring):<br>
> if len(key) + key_extra_len > SERVER_MAX_KEY_LENGTH:<br>
> raise Client.MemcachedKeyLengthError,
("Key length is > %s"<br>
>
% SERVER_MAX_KEY_LENGTH)<br>
> for char in key:<br>
> if ord(char) < 33:<br>
> raise Client.MemcachedKeyCharacterError,<br>
> "Control characters not allowed"<br>
><br>
><br>
><br>
><br>
><br>
><br>
> This message and any attachments (the "message") is intended
solely for the<br>
> addressees and is confidential.<br>
> If you receive this message in error, please delete it and immediately<br>
> notify the sender. Any use not in accord with<br>
> its purpose, any dissemination or disclosure, either whole or partial,
is<br>
> prohibited except formal approval.<br>
> The internet can not guarantee the integrity of this message.<br>
> BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable
for<br>
> the message if modified.<br>
> Do not print this message unless it is necessary, consider the environment.<br>
> ---------------------------------------------<br>
> Ce message et toutes les pieces jointes (ci-apres le "message")
sont etablis<br>
> a l'intention exclusive de ses destinataires et sont confidentiels.
Si vous<br>
> recevez ce<br>
> message par erreur, merci de le detruire et d'en avertir immediatement<br>
> l'expediteur.<br>
> Toute utilisation de ce message non conforme a sa destination, toute<br>
> diffusion ou toute publication, totale ou partielle, est interdite,
sauf<br>
> autorisation expresse.<br>
> L'internet ne permettant pas d'assurer l'integrite de ce message,
BNP<br>
> PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre
de ce<br>
> message, dans l'hypothese ou il aurait ete modifie.<br>
> N'imprimez ce message que si necessaire, pensez a l'environnement.<br>
><br>
></tt></font><font size=3><br>
</font>
<p>
<p>