Changeset 21 for trunk

Show
Ignore:
Timestamp:
08/12/05 00:02:20 (7 years ago)
Author:
mj
Message:

Refactoring time again:

  • Completely get rid of key domains collections. Instead, rely on registration of domains as named utilities. This way domains can be mixed local and global, and can have local overrides. Much better setup all round
  • Simplify the Domain interface somewhat. Title and description can be supplied by Dublin Core instead.
  • Remove a now redundant key lookup error exception
  • Provide a simple persistent domain with tests
Location:
trunk/src/chronolog
Files:
2 added
1 removed
3 modified

Legend:

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

    r18 r21  
    5252 
    5353 
    54 class TimeLogKeyLookupError(LookupError): 
    55     """A key could not be found for a given id""" 
    56  
    57  
    5854class ITimeLogKeyDomain(IEnumerableMapping): 
    5955    """A key domain 
    6056     
    61     A key domain is the source where keys are obtained, like principals or 
    62     projects. ITimeLogKeys are keyed on their id, and their domain property 
    63     should be set to the id of this domain. 
     57    A key domain is the source where keys are obtained, like 'principals' or 
     58    'projects'. ITimeLogKeys are keyed on their id. Domains are looked up as 
     59    named utilities. 
    6460     
    6561    """ 
     
    6763        title=_(u'Id'), 
    6864        description=_(u'The identifier of the domain.'), 
    69         required=True) 
    70      
    71     title = TextLine( 
    72         title=_(u'Title'), 
    73         description=_(u'The domain title for UI display'), 
    74         required=False) 
    75      
    76     description = Text( 
    77         title=_(u'Description'), 
    78         description=_(u'A detailed description of the domain.'), 
    79         required=False) 
    80  
    81  
    82 class ITimeLogKeyDomainsCollection(IEnumerableMapping): 
    83     """A utility providing a collection of ITimeLogKeyDomians 
    84  
    85     ITimeLogKeyDomains are keyed on their id. 
    86      
    87     """ 
     65        required=True, 
     66        readonly=True) 
    8867 
    8968 
     
    9877    allowed to delete it. 
    9978     
    100     .. note:: 
    101        All keys **must** be from obtainable from the domains collection  
    102        available as utility. 
    103  
    10479    """ 
    10580    keys = Set( 
     
    143118        None can be discarded from the store completely. 
    144119 
    145         .. note:: 
    146            All keys on entries **must** be from obtainable from the domains  
    147            collection available as utility. 
    148  
    149120        """ 
    150121 
     
    166137        ((A, B, D),) 
    167138  
    168         .. note:: 
    169            All keys **must** be from obtainable from the domains collection  
    170            available as utility. 
    171           
    172139        """ 
    173140 
     
    184151        eligable, but a log entry against (A, B, C) is. 
    185152 
    186         .. note:: 
    187            All keys **must** be from obtainable from the domains collection  
    188            available as utility. 
    189  
    190153        """ 
    191154 
     
    204167        logged. Never terminates. 
    205168 
    206         .. note:: 
    207            All keys **must** be from obtainable from the domains collection  
    208            available as utility. 
    209  
    210169        """ 
    211170 
     
    225184        limited by the start_date and end_date. 
    226185 
    227         .. note:: 
    228            All keys **must** be from obtainable from the domains collection  
    229            available as utility. 
    230  
    231186    """ 
    232187 
     
    236191 
    237192    A timesheet is a view on a ITimeLogStore for a given time period and keys. 
    238  
    239     .. note:: 
    240        All keys **must** be from obtainable from the domains collection  
    241        available as utility. 
    242193 
    243194    """ 
  • trunk/src/chronolog/keys/browser/configure.zcml

    r16 r21  
    33    xmlns="http://namespaces.zope.org/browser"> 
    44 
    5 <!-- key domains collection --> 
     5<!-- simple key domain --> 
    66<tool 
    7     interface="chronolog.interfaces.ITimeLogKeyDomainsCollection" 
    8     title="TimeLog Key Domains Collection" 
     7    interface="chronolog.interfaces.ITimeLogKeyDomain" 
     8    title="TimeLog Key Domain" 
    99    description="TimeLog entries are logged against a set of keys coming 
    10                  from various domains. The domains are looked up in a domains 
    11                  collection" 
    12     unique="True" 
     10                 from various domains. These domains are looked up as named 
     11                 utilities." 
    1312    /> 
    1413     
    1514<addMenuItem 
    16     title="TimeLog Key Domains Collection" 
     15    title="TimeLog Simple Key Domain" 
    1716    description="TimeLog entries are logged against a set of keys coming 
    18                  from various domains. The domains are looked up in a domains 
    19                  collection" 
    20     class="..domainscollection.LocalKeyDomainsCollection" 
     17                 from various domains. This is a simple persistent domain." 
     18    class="..simpledomain.SimpleKeyDomain" 
    2119    permission="zope.ManageContent" 
    2220    /> 
    2321 
    24  
    2522</configure> 
  • trunk/src/chronolog/keys/configure.zcml

    r19 r21  
    22   xmlns="http://namespaces.zope.org/zope"> 
    33    
    4 <localUtility class=".domainscollection.LocalKeyDomainsCollection"> 
     4<localUtility class=".simpledomain.SimpleKeyDomain"> 
    55  <implements 
    66      interface="zope.app.container.interfaces.IContainerNamesContainer" 
     
    1414      interface="zope.app.container.interfaces.IWriteContainer" 
    1515      /> 
    16   <factory id="chronolog.keys.domainscollection" /> 
    1716</localUtility> 
    1817 
    1918<adapter 
    20     for=".domainscollection.ILocalTimeLogKeyDomainsCollection" 
     19    for=".simpledomain.ILocalTimeLogKeyDomain" 
    2120    provides="zope.app.container.interfaces.INameChooser" 
    2221    factory="..common.IdAttributeNameChooser"