Changeset 1416
- Timestamp:
- 09/10/08 22:57:51 (2 months ago)
- Files:
-
- PleiadesEntity/trunk/Extensions/loader.py (modified) (2 diffs)
- PleiadesEntity/trunk/content/TemporalAttestation.py (modified) (1 diff)
- PleiadesEntity/trunk/skins/PleiadesEntity/makeSmartFolders.py (deleted)
- PleiadesEntity/trunk/tests/LoadEntity.txt (modified) (6 diffs)
- PleiadesEntity/trunk/tests/TemporalAttestations.txt (modified) (6 diffs)
- PleiadesEntity/trunk/time.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
PleiadesEntity/trunk/Extensions/loader.py
r1415 r1416 143 143 } 144 144 145 periods = {"Archaic":"Archaic (pre-550 BC)", 146 "Classical":"Classical (550 - 330 BC)", 147 "Hellenistic (Roman Republic)":"Hellenistic/Republican (330 - 30 BC)", 148 "Roman":"Roman (30 BC - AD 300)", 149 "Late Antique":"Late Antique (AD 300 - 625)"} 150 period_ids = {"Archaic":"archaic", 151 "Classical":"classical", 152 "Hellenistic (Roman Republic)":"hellenistic-republican", 153 "Roman":"roman", 154 "Late Antique":"late-antique"} 145 periods = { 146 "Archaic": "Archaic (pre-550 BC)", 147 "Classical": "Classical (550 - 330 BC)", 148 "Hellenistic (Roman Republic)": "Hellenistic (Roman Republic; 330 - 30 BC)", 149 "Roman": "Roman (Early Empire; 30 BC - AD 300)", 150 "Late Antique": "Late Antique (AD 300 - 640)" 151 } 152 period_ids = { 153 "Archaic": "archaic", 154 "Classical": "classical", 155 "Hellenistic (Roman Republic)": "hellenistic-republican", 156 "Roman": "roman", 157 "Late Antique": "late-antique" 158 } 155 159 156 160 def parse_periods(xmlcontext, portalcontext, **kw): … … 184 188 portalcontext.invokeFactory('TemporalAttestation', 185 189 id=id, 186 timePeriod= period,190 timePeriod=id, 187 191 attestationConfidence=confidence, 188 192 **kw PleiadesEntity/trunk/content/TemporalAttestation.py
r1401 r1416 87 87 security.declareProtected(permissions.View, 'get_title') 88 88 def get_title(self): 89 """Return a title string derived from the associated time period and attestation certainty """ 90 title = "Attested: %s" % self.getTimePeriod() 89 """Return a title string derived from the associated time period and 90 attestation certainty """ 91 vocab = self.getField('timePeriod').vocabulary 92 vd = dict(vocab.getDisplayList(self).items()) 93 tv = vd.get(self.getTimePeriod(), None) 94 title = "Attested: %s" % tv 91 95 confidence = self.getAttestationConfidence() 92 96 if confidence.startswith('less-'): PleiadesEntity/trunk/tests/LoadEntity.txt
r1401 r1416 87 87 >>> tps0 = tps[0].getObject() 88 88 >>> tps0.Title() 89 'Attested: Roman ( 30 BC - AD 300)'89 'Attested: Roman (Early Empire; 30 BC - AD 300)' 90 90 >>> tps0.getId() 91 91 'roman' … … 94 94 >>> tps1 = tps[1].getObject() 95 95 >>> tps1.Title() 96 'Attested: Late Antique (AD 300 - 6 25)'96 'Attested: Late Antique (AD 300 - 640)' 97 97 >>> tps1.getId() 98 98 'late-antique' … … 111 111 112 112 >>> n0.getTimePeriods() 113 [' Roman (30 BC - AD 300)', 'Late Antique (AD 300 - 625)']113 ['roman', 'late-antique'] 114 114 115 115 >>> n1 = folder['names'][nids[1]] … … 168 168 >>> tps1 = tps[1].getObject() 169 169 >>> tps1.Title() 170 'Attested: Roman ( 30 BC - AD 300)'170 'Attested: Roman (Early Empire; 30 BC - AD 300)' 171 171 >>> tps1.getId() 172 172 'roman' … … 175 175 >>> tps2 = tps[2].getObject() 176 176 >>> tps2.Title() 177 'Attested: Late Antique (AD 300 - 6 25)'177 'Attested: Late Antique (AD 300 - 640)' 178 178 >>> tps2.getId() 179 179 'late-antique' … … 181 181 'confident' 182 182 >>> l.getTimePeriods() 183 [' Classical (550 - 330 BC)', 'Roman (30 BC - AD 300)', 'Late Antique (AD 300 - 625)']183 ['classical', 'roman', 'late-antique'] 184 184 185 185 Check Place time periods 186 186 187 187 >>> p.getTimePeriods() 188 [' Classical (550 - 330 BC)', 'Roman (30 BC - AD 300)', 'Late Antique (AD 300 - 625)']188 ['classical', 'roman', 'late-antique'] 189 189 190 190 Test associations PleiadesEntity/trunk/tests/TemporalAttestations.txt
r1356 r1416 56 56 >>> tps1 = tps[1].getObject() 57 57 >>> tps1.Title() 58 'Attested: Hellenistic /Republican (330 - 30 BC)?'58 'Attested: Hellenistic (Roman Republic; 330 - 30 BC)?' 59 59 >>> tps1.getId() 60 60 'hellenistic-republican' … … 68 68 >>> tps0 = tps[0].getObject() 69 69 >>> tps0.Title() 70 'Attested: Roman ( 30 BC - AD 300) - inferred'70 'Attested: Roman (Early Empire; 30 BC - AD 300) - inferred' 71 71 >>> tps0.getId() 72 72 'roman' … … 76 76 >>> tps1 = tps[1].getObject() 77 77 >>> tps1.Title() 78 'Attested: Late Antique (AD 300 - 6 25)? - inferred'78 'Attested: Late Antique (AD 300 - 640)? - inferred' 79 79 >>> tps1.getId() 80 80 'late-antique' … … 107 107 >>> tps2 = tps[2].getObject() 108 108 >>> tps2.Title() 109 'Attested: Hellenistic /Republican (330 - 30 BC)?'109 'Attested: Hellenistic (Roman Republic; 330 - 30 BC)?' 110 110 >>> tps2.getId() 111 111 'hellenistic-republican' … … 115 115 >>> tps3 = tps[3].getObject() 116 116 >>> tps3.Title() 117 'Attested: Roman ( 30 BC - AD 300)'117 'Attested: Roman (Early Empire; 30 BC - AD 300)' 118 118 >>> tps3.getId() 119 119 'roman' … … 123 123 >>> tps4 = tps[4].getObject() 124 124 >>> tps4.Title() 125 'Attested: Late Antique (AD 300 - 6 25)?'125 'Attested: Late Antique (AD 300 - 640)?' 126 126 >>> tps4.getId() 127 127 'late-antique' PleiadesEntity/trunk/time.py
r1401 r1416 8 8 vt = self.vtool.getVocabularyByName('time-periods') 9 9 self.t_keys = vt.getDisplayList(vt).keys() 10 self.t_vals = vt.getDisplayList(vt).values()11 10 12 11 def __call__(self, a, b): 13 12 if a in self.t_keys: 14 13 ai = self.t_keys.index(a) 15 elif a in self.t_vals:16 ai = self.t_vals.index(a)17 14 else: 18 15 # a value not in the vocab is greater … … 20 17 if b in self.t_keys: 21 18 bi = self.t_keys.index(b) 22 elif b in self.t_vals:23 bi = self.t_vals.index(b)24 19 else: 25 20 # a value not in the vocab is greater 26 21 return -1 27 28 22 return ai - bi
