Did I find the right examples for you? yes no

All Samples(9)  |  Call(6)  |  Derive(0)  |  Import(3)

        def unpackkey(key) :
    return key[0:key.rindex("=")]
        


src/n/g/ng.ftp-0.1.2/src/ng/ftp/readdirectory.py   ng.ftp(Download)
 
from zope.interface import Interface,implements
from utils import packkey, unpackkey, unpacktype
from readnotdirectory import ReadNotDirectoryAdapter
 
            return super(ReadDirectoryAdapter,self).__getitem__(key)
        except KeyError :
            return self.context[unicode(unpackkey(key))]
 
    def keys(self) :
            return True
 
        key = unpackkey(key)
        return self.context.__contains__(unicode(key)) 
 

src/n/g/ng.ftp-0.1.2/src/ng/ftp/writedirectory.py   ng.ftp(Download)
from zope.interface import Interface,implements
from zope.filerepresentation.interfaces import IWriteFile,IWriteDirectory
from utils import packkey, unpackkey, unpacktype
import sys
 
    def __setitem__(self,key,value) :
        """ A KeyError is raised if there is no value for the key."""
        try :
            self.context[unicode(unpackkey(key))] = value       
        except Exception,msg :
            print sys.excepthook(*sys.exc_info())                        
 
    def __delitem__(self,key,value) :
        del self.context[unicode(unpackkey(key))] 

src/n/g/ng.ftp-0.1.2/src/ng/ftp/readannotations.py   ng.ftp(Download)
from zope.filerepresentation.interfaces import IReadFile,IReadDirectory
from interfaces import IAttribute, IAttributeDir
from utils import packkey, unpackkey, unpacktype
from zope.annotation.interfaces import IAnnotations
from zope.security.proxy import removeSecurityProxy
    def get(self,key, default=None) :
        """Get a value for a key.  The default is returned if there is no
           value for the key."""
        res = self.context.get(unicode(unpackkey(key)), default=None)
        if res and not IContained.providedBy(res) :
    def __contains__(self,key) :
        """ Tell if a key exists in the mapping.""" 
        key = unpackkey(key)
        return self.context.has_key(unicode(key))