jacques.ales at jacques.ales at
Tue Aug 28 15:34:48 UTC 2007


I'm using the python wrapper for memcached in it's version 
__author__    = "Evan Martin <martine at>"
__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
__author__    = "Evan Martin <martine at>"
__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 


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, 
                "unicode.  Convert your unicode strings using "

    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.
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the memcached mailing list