Changeset 819

Show
Ignore:
Timestamp:
05/31/07 16:18:07 (2 years ago)
Author:
sgillies
Message:

Refactor interfaces and implementations, set native EOL style

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Bibliomane/trunk/bibliomane-configure.zcml

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/README.txt

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/__init__.py

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/browser/__init__.py

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/browser/configure.zcml

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/browser/work_index.pt

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/browser/workcontainer_index.pt

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/browser/works.py

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/configure.zcml

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/interfaces.py

    • Property svn:eol-style set to native
    r818 r819  
    66# Schemas 
    77 
    8 class IWork(IContained, IContainer): 
     8class ISubject(Interface): 
     9 
     10    works = Iterable( 
     11        title=u"Works", 
     12        description=u"Other works that have this entity as subject", 
     13        required=False, 
     14        readonly=True, 
     15        ) 
     16 
     17 
     18class IResponsibility(Interface): 
     19 
     20    principals = Iterable( 
     21        title=u"Principals", 
     22        description=u"Persons or corporate bodies responsible for this entity", 
     23        required=False, 
     24        readonly=True, 
     25        ) 
     26 
     27 
     28class IResponsible(Interface): 
     29 
     30    creations = Iterable( 
     31        title=u"Creations", 
     32        description=u"Works for which this entity is responsible", 
     33        required=False, 
     34        readonly=True, 
     35        ) 
     36 
     37    realizations = Iterable( 
     38        title=u"Realizations", 
     39        description=u"Expressions for which this entity is responsible", 
     40        required=False, 
     41        readonly=True, 
     42        ) 
     43 
     44    productions = Iterable( 
     45        title=u"Productions", 
     46        description=u"Manifestations for which this entity is responsible", 
     47        required=False, 
     48        readonly=True, 
     49        ) 
     50 
     51    items = Iterable( 
     52        title=u"Items", 
     53        description=u"Items for which this entity is responsible", 
     54        required=False, 
     55        readonly=True, 
     56        ) 
     57 
     58 
     59class IWork(IContained, IContainer, ISubject, IResponsibility): 
    960 
    1061    """A Work "is realized through" an Expression and "is created by" a Person 
     
    57108        ) 
    58109 
    59     works = Iterable( 
    60         title=u"Works", 
    61         description=u"Other works treating this one as a subject", 
    62         required=False, 
    63         ) 
    64  
    65     creators = Iterable( 
    66         title=u"Creators", 
    67         description=u"Creators of this work", 
    68         required=False, 
    69         ) 
    70  
    71  
    72 class IExpression(IWork): 
     110 
     111class IExpression(IContained, IContainer, ISubject, IResponsibility): 
    73112     
    74113    """An Expression "is embodied in" a Manifestation and "is realized by" a 
     
    76115    """ 
    77116    containers('bibliomane.interfaces.IWork') 
     117 
     118    title = TextLine( 
     119        title=u"Title", 
     120        description=u"The title of the work", 
     121        required=True, 
     122        ) 
     123 
     124    title_language = TextLine( 
     125        title=u"Title Language", 
     126        description=u"The language and/or script of the work's title", 
     127        required=False, 
     128        ) 
     129 
     130    form = TextLine( 
     131        title=u"Form", 
     132        description=u"Form of the work (e.g. novel, poem, atlas)", 
     133        required=False, 
     134        ) 
     135 
     136    date = Date( 
     137        title=u"Date", 
     138        description=u"The date of creation", 
     139        required=False, 
     140        ) 
     141 
     142    context = Text( 
     143        title=u"Context", 
     144        description=u"The context in which the work was created", 
     145        required=False, 
     146        ) 
    78147 
    79148    language = TextLine( 
     
    84153 
    85154 
    86 class IManifestation(IContained, IContainer): 
     155class IManifestation(IContained, IContainer, ISubject, IResponsibility): 
    87156 
    88157    """A Manifestation "is exemplified by" an Item and "is produced by" a  
     
    117186 
    118187 
    119 class IItem(IContained): 
     188class IItem(IContained, ISubject, IResponsibility): 
    120189 
    121190    """An Item "is owned by" a Person or Corporate Body. 
     
    130199 
    131200 
    132 class IPerson(Interface): 
     201class IPerson(ISubject, IResponsible): 
    133202     
    134203    name = TextLine( 
     
    150219        ) 
    151220 
    152     creations = Iterable( 
    153         title=u"Creations", 
    154         description=u"Works that the person has created", 
    155         required=False, 
    156         ) 
    157  
    158  
    159 class ICorporateBody(Interface): 
     221 
     222class ICorporateBody(ISubject, IResponsible): 
    160223     
    161224    name = TextLine( 
  • Bibliomane/trunk/bibliomane/overrides.zcml

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/principals.py

    • Property svn:eol-style set to native
    r818 r819  
    66from bibliomane.relationships import find_sources, find_targets 
    77 
    8 class Person(Persistent): 
     8 
     9class PrincipalBase(object): 
     10     
     11    @property 
     12    def creations(self): 
     13        return find_sources(self, ICreatedBy) 
     14 
     15    @property 
     16    def realizations(self): 
     17        return find_sources(self, IRealizedBy) 
     18 
     19    @property 
     20    def productions(self): 
     21        return find_sources(self, IProducedBy) 
     22 
     23    @property 
     24    def items(self): 
     25        return find_sources(self, IOwnedBy) 
     26 
     27 
     28class Person(Persistent, PrincipalBase): 
    929    implements(IPerson) 
    1030 
    1131    name = u"" 
    12     dates = None 
     32    name_language = u"" 
    1333    uri = u"" 
    1434 
     
    1636        self.name = name 
    1737 
    18     @property 
    19     def items(self): 
    20         return find_sources(self, IOwnedBy) 
    2138 
    22     @property 
    23     def creations(self): 
    24         return find_sources(self, ICreatedBy) 
     39class CorporateBody(Persistent, PrincipalBase): 
     40    implements(ICorporateBody) 
    2541 
     42    name = u"" 
     43    name_language = u"" 
     44    place = u"" 
     45 
     46    def __init__(self, name=u""): 
     47        self.name = name 
     48 
     49 
  • Bibliomane/trunk/bibliomane/skin/__init__.py

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/skin/bz/style.css

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/skin/configure.zcml

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/skin/interfaces.py

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/tests/__init__.py

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/tests/test_doctests.py

    • Property svn:eol-style set to native
  • Bibliomane/trunk/bibliomane/tests/works.txt

    • Property svn:eol-style set to native
    r818 r819  
    133133  >>> [w.title for w in herodotus.creations] 
    134134  [u'The Histories'] 
    135   >>> [c.name for c in work.creators] 
     135  >>> [c.name for c in work.principals] 
    136136  [u'Herodotus'] 
    137137 
  • Bibliomane/trunk/bibliomane/works.py

    • Property svn:eol-style set to native
    r818 r819  
    99from bibliomane.interfaces import IWork, IExpression, IManifestation, IItem 
    1010from bibliomane.interfaces import IHasSubject 
    11 from bibliomane.interfaces import ICreatedBy 
     11from bibliomane.interfaces import ICreatedBy, IRealizedBy, IProducedBy, IOwnedBy 
    1212from bibliomane.relationships import find_sources, find_targets 
    1313 
    1414 
    15 class Work(BTreeContainer, Contained): 
     15class GroupOneBase(object): 
     16 
     17    responsibility_marker = None 
     18 
     19    @property 
     20    def works(self): 
     21        return find_sources(self, IHasSubject) 
     22 
     23    @property 
     24    def principals(self): 
     25        return find_targets(self, self.responsibility_marker) 
     26 
     27 
     28class Work(BTreeContainer, Contained, GroupOneBase): 
    1629    implements(IWork) 
    1730 
     
    2437    context = u"" 
    2538    subject_tags = [] 
     39    responsibility_marker = ICreatedBy 
    2640 
    2741    def __init__(self, title=u""): 
     
    3347        return find_targets(self, IHasSubject) 
    3448 
    35     @property 
    36     def works(self): 
    37         return find_sources(self, IHasSubject) 
    38  
    39     @property 
    40     def creators(self): 
    41         return find_targets(self, ICreatedBy) 
    42  
    4349         
    44 class Expression(BTreeContainer, Contained): 
     50class Expression(BTreeContainer, Contained, GroupOneBase): 
    4551    implements(IExpression) 
    4652 
     
    5359    context = u"" 
    5460    language = u"" 
     61    responsibility_marker = IRealizedBy 
    5562 
    5663 
    57 class Manifestation(BTreeContainer, Contained): 
     64class Manifestation(BTreeContainer, Contained, GroupOneBase): 
    5865    implements(IManifestation) 
    5966 
     
    6471    series = u"" 
    6572    identifier = u"" 
     73    responsibility_marker = IProducedBy 
    6674 
    6775 
    68 class Item(Persistent, Contained): 
     76class Item(Persistent, Contained, GroupOneBase): 
    6977    implements(IItem) 
    7078 
     
    7280 
    7381    identifier = u"" 
     82    responsibility_marker = IOwnedBy 
    7483 
     84 
  • Bibliomane/trunk/setup.cfg

    • Property svn:eol-style set to native
  • Bibliomane/trunk/setup.py

    • Property svn:eol-style set to native