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><br><div><span class="gmail_quote">2007/8/29, <a href="mailto:jacques.ales@bnpparibas.com">jacques.ales@bnpparibas.com</a> <<a href="mailto:jacques.ales@bnpparibas.com">jacques.ales@bnpparibas.com
</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><font face="sans-serif" size="2">I don't understand why space is considered
as a control char,</font>
<br><font face="sans-serif" size="2">while and del is not considered so.</font>
<br>
<br>
<br>
<br>
<br>
<br><font face="Tahoma" size="6"><b>I</b></font><font face="Tahoma" size="5">nternet</font>
<br><font face="sans-serif" size="1">philipn@gmail.com@<a href="http://lists.danga.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">lists.danga.com</a> -
08/28/2007 06:13 PM</font>
<br><font face="sans-serif" size="1"> </font>
<p><font color="#800080" face="sans-serif" size="1">Sent by:
<a href="mailto:memcached-bounces@lists.danga.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">memcached-bounces@lists.danga.com</a></font>
</p><p>
</p><p><font color="#800080" face="sans-serif" size="1">To:
</font><font face="sans-serif" size="1">memcached</font>
</p><p><font color="#800080" face="sans-serif" size="1">cc:
</font>
</p><p><font color="#800080" face="sans-serif" size="1">Subject:
</font><font face="sans-serif" size="1"><b>Re: check_key</b></font>
</p><div><span class="e" id="q_114ad4925e30bdd4_1"><br>
<br><font size="2"><tt>>>> 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: <a href="http://www.tummy.com/Community/software/python-memcached/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.tummy.com/Community/software/python-memcached/</a><br>
<br>
--Philip Neustrom<br>
<br>
On 8/28/07, <a href="mailto:jacques.ales@bnpparibas.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">jacques.ales@bnpparibas.com</a> <<a href="mailto:jacques.ales@bnpparibas.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
jacques.ales@bnpparibas.com</a>>
wrote:<br>
><br>
> hello<br>
><br>
> I'm using the python wrapper for memcached in it's version<br>
> __author__ = "Evan Martin <<a href="mailto:martine@danga.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">martine@danga.com</a>>"<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>
> <a href="http://code.sixapart.com/svn/memcached/trunk/api/python/memcache.py" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://code.sixapart.com/svn/memcached/trunk/api/python/memcache.py
</a><br>
> __author__ = "Evan Martin <<a href="mailto:martine@danga.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">martine@danga.com</a>>"<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>
><br>
</tt></font>
<br></span></div><p></p><p></p><p></p><p></p><p></p></blockquote></div><br>