Changeset 8

Show
Ignore:
Timestamp:
07/30/05 14:54:14 (7 years ago)
Author:
mj
Message:

Add lookup interfaces for sub-keys

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chronolog/interfaces.py

    r7 r8  
    4444 
    4545 
     46class TimeLogSubKeyLookupError(LookupError): 
     47    """A sub-key could not be found for a given id""" 
     48 
     49 
     50class ITimeLogSubKeySource(Interface): 
     51    """A source of sub-keys for a key position 
     52     
     53    For any given key position only one source can be used, but a source can 
     54    be re-used for multiple key positions. 
     55     
     56    """ 
     57    def getSubKey(id): 
     58        """Return the `ITimeLogSubKey` with the given id 
     59         
     60        A ``TimeLogSubKeyLookupError`` is raised when no sub-key with the given 
     61        id exists. 
     62         
     63        """ 
     64    def listSubKeys(): 
     65        """Return an iterable of all sub-keys""" 
     66 
     67 
     68class ITimeLogKeySource(Interface): 
     69    """A source of ITimeLogSubKeySources""" 
     70    keyLength = Int( 
     71        title=u'Key Length', 
     72        description=u'''Number of sub-key sources provided.''', 
     73        required=True, 
     74        readonly=True) 
     75 
     76    def getSubKeySource(position): 
     77        """Return an `ITimeLogSubKeySource` for a given key position 
     78 
     79        Raises an ``IndexError`` when no source exists at that position 
     80         
     81        """ 
     82 
     83 
    4684class ITimeLogEntry(Interface): 
    4785    """An entry in the timelog