Changeset 750

Show
Ignore:
Timestamp:
04/02/07 14:59:03 (2 years ago)
Author:
thomase
Message:

Closes ticket #284. Place title construction now only uses associated geographic names, if they are available. If there are no geographic names, then ethnica are used.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • PleiadesEntity/trunk/content/Place.py

    r650 r750  
    9898        try: 
    9999            associations = self.listFolderContents() 
    100             return '/'.join([a.Title() for a in associations if not a.Title().startswith('Unnamed')]) 
     100            nametitles = [] 
     101            nametypes = [] 
     102            for a in associations: 
     103                try: 
     104                    name = a.getRefs('hasName')[0]              # there can only be one name per association 
     105                    nametitles.append(name.Title()) 
     106                    nametypes.append(name.getNameType()) 
     107                except: 
     108                    pass 
     109            title = '/'.join([title for i, title in enumerate(nametitles) if nametypes[i] == 'geographic' and not title.startswith('Unnamed')]) 
     110            if title == '': 
     111                '/'.join([title for title in nametitles if not title.startswith('Unnamed')]) 
     112            return title 
    101113        except AttributeError: 
    102114            return 'Unnamed Place' 
  • PleiadesEntity/trunk/tests/LoadEntity.txt

    r746 r750  
    4545    >>> p = getattr(folder.places, pid) 
    4646    >>> p.title_or_id() 
    47     'Aphrodisias/Ninoe/Aphrodisieus
     47    'Aphrodisias/Ninoe
    4848    >>> p.Title() 
    49     'Aphrodisias/Ninoe/Aphrodisieus
     49    'Aphrodisias/Ninoe
    5050    >>> p.modernLocation 
    5151    u'Geyre' 
     
    249249    True 
    250250    >>> g.getInfo() 
    251     {'description': 'An ancient settlement, attested during the Classical, Roman and Late Antique periods (modern location: Geyre). It was known in antiquity by the names: Aphrodisias and Ninoe.', 'spatialCoordinates': '37.71446 28.72886 0.0', 'url': 'http://nohost/plone/Members/test_user_1_/places/638753', 'title': 'Aphrodisias/Ninoe/Aphrodisieus', 'srs': 'EPSG:4326', 'geometryType': 'point', 'id': '638753'} 
     251    {'description': 'An ancient settlement, attested during the Classical, Roman and Late Antique periods (modern location: Geyre). It was known in antiquity by the names: Aphrodisias and Ninoe.', 'spatialCoordinates': '37.71446 28.72886 0.0', 'url': 'http://nohost/plone/Members/test_user_1_/places/638753', 'title': 'Aphrodisias/Ninoe', 'srs': 'EPSG:4326', 'geometryType': 'point', 'id': '638753'} 
    252252 
    253253    >>> c = IGeoCollectionSimple(folder.places) 
    254254    >>> c.getItemsInfo() 
    255     [{'description': 'An ancient settlement, attested during the Classical, Roman and Late Antique periods (modern location: Geyre). It was known in antiquity by the names: Aphrodisias and Ninoe.', 'spatialCoordinates': '37.71446 28.72886 0.0', 'url': 'http://nohost/plone/Members/test_user_1_/places/638753', 'title': 'Aphrodisias/Ninoe/Aphrodisieus', 'srs': 'EPSG:4326', 'geometryType': 'point', 'id': '638753'}] 
     255    [{'description': 'An ancient settlement, attested during the Classical, Roman and Late Antique periods (modern location: Geyre). It was known in antiquity by the names: Aphrodisias and Ninoe.', 'spatialCoordinates': '37.71446 28.72886 0.0', 'url': 'http://nohost/plone/Members/test_user_1_/places/638753', 'title': 'Aphrodisias/Ninoe', 'srs': 'EPSG:4326', 'geometryType': 'point', 'id': '638753'}] 
    256256 
    257257Load one nameless entity