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