]> git.parisson.com Git - telemeta.git/commitdiff
(start to) fix displaying multiple location paths
authorolivier <>
Mon, 8 Feb 2010 17:55:30 +0000 (17:55 +0000)
committerolivier <>
Mon, 8 Feb 2010 17:55:30 +0000 (17:55 +0000)
telemeta/models/crem.py
telemeta/models/dublincore.py
telemeta/templates/telemeta_default/mediaitem_detail.html

index cd9a4447a02fa45cafb56aa175f7407493827f3a..4c75f2a23372d49dd3747f8fd49cd7c98e5dab20 100755 (executable)
@@ -632,17 +632,23 @@ class Location(ModelCore):
 
         return None                    
 
-    def sequences(self):
-        sequence = []
+    def paths(self):
+        #FIXME: need to handle multiple (polyhierarchical) paths
+        path = []
         location = self
         while location:
-            sequence.append(location)
-            location = location.parent()
-        return sequence
+            path.append(location)
+            try:
+                location = location.ancestors(direct=True)[0]
+            except IndexError:
+                location = None
+        return [path]
 
     def fullnames(self):
-        
-        return u', '.join([unicode(l) for l in self.sequence()])
+        names = []
+        for path in self.paths():
+            names.append(u', '.join([unicode(l) for l in path]))
+        return names
 
 class LocationType(ModelCore):
     "Location types"
index a839e7f646f48b2d75ce589d7804c18f663b50db..b59cca8e82693bec0506b05194622b057319cef1 100644 (file)
@@ -211,7 +211,7 @@ def express_item(item):
         Element('publisher',        settings.TELEMETA_ORGANIZATION),
         date,
         Date(item.collection.year_published, refinement='issued'),
-        Element('coverage',         item.location.fullname(), 'spatial'),
+        Element.multiple('coverage', item.location.fullnames(), 'spatial'),
         Element('coverage',         item.location_comment, 'spatial'),
         Element('rights',           item.collection.legal_rights, 'license'),
         Element('rights',           media_access_rights(item.collection), 'accessRights'),
index 8cc58a9380028686e4bd795ea3a6b49423b4ec62..001301b19da3899011fcb09f6e6e2a451e9c759d 100644 (file)
@@ -146,7 +146,7 @@ load_player({{ item.get_duration }});
             <dl class="listing">\r
                 {% if item.location %}\r
                     <dt>{% trans "Location" %}</dt>\r
-                    <dd>{{ item.location.fullname }}</dd>\r
+                    <dd>{{ item.location.fullnames|join:"<br/>" }}</dd>\r
                 {% endif %}\r
                 {% dl_field item "location_comment" %}\r
                 {% dl_field item "cultural_area" %}\r