Changeset 750
- Timestamp:
- 04/02/07 14:59:03 (2 years ago)
- Files:
-
- PleiadesEntity/trunk/content/Place.py (modified) (1 diff)
- PleiadesEntity/trunk/tests/LoadEntity.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
PleiadesEntity/trunk/content/Place.py
r650 r750 98 98 try: 99 99 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 101 113 except AttributeError: 102 114 return 'Unnamed Place' PleiadesEntity/trunk/tests/LoadEntity.txt
r746 r750 45 45 >>> p = getattr(folder.places, pid) 46 46 >>> p.title_or_id() 47 'Aphrodisias/Ninoe /Aphrodisieus'47 'Aphrodisias/Ninoe' 48 48 >>> p.Title() 49 'Aphrodisias/Ninoe /Aphrodisieus'49 'Aphrodisias/Ninoe' 50 50 >>> p.modernLocation 51 51 u'Geyre' … … 249 249 True 250 250 >>> 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'} 252 252 253 253 >>> c = IGeoCollectionSimple(folder.places) 254 254 >>> 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'}] 256 256 257 257 Load one nameless entity
