Changeset 529

Show
Ignore:
Timestamp:
02/08/10 18:55:30 (7 months ago)
Author:
olivier
Message:

(start to) fix displaying multiple location paths

Location:
trunk/telemeta
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/telemeta/models/crem.py

    r528 r529  
    633633        return None                     
    634634 
    635     def sequences(self): 
    636         sequence = [] 
     635    def paths(self): 
     636        #FIXME: need to handle multiple (polyhierarchical) paths 
     637        path = [] 
    637638        location = self 
    638639        while location: 
    639             sequence.append(location) 
    640             location = location.parent() 
    641         return sequence 
     640            path.append(location) 
     641            try: 
     642                location = location.ancestors(direct=True)[0] 
     643            except IndexError: 
     644                location = None 
     645        return [path] 
    642646 
    643647    def fullnames(self): 
    644          
    645         return u', '.join([unicode(l) for l in self.sequence()]) 
     648        names = [] 
     649        for path in self.paths(): 
     650            names.append(u', '.join([unicode(l) for l in path])) 
     651        return names 
    646652 
    647653class LocationType(ModelCore): 
  • trunk/telemeta/models/dublincore.py

    r517 r529  
    212212        date, 
    213213        Date(item.collection.year_published, refinement='issued'), 
    214         Element('coverage',         item.location.fullname(), 'spatial'), 
     214        Element.multiple('coverage', item.location.fullnames(), 'spatial'), 
    215215        Element('coverage',         item.location_comment, 'spatial'), 
    216216        Element('rights',           item.collection.legal_rights, 'license'), 
  • trunk/telemeta/templates/telemeta_default/mediaitem_detail.html

    r528 r529  
    147147                {% if item.location %} 
    148148                    <dt>{% trans "Location" %}</dt> 
    149                     <dd>{{ item.location.fullname }}</dd> 
     149                    <dd>{{ item.location.fullnames|join:"<br/>" }}</dd> 
    150150                {% endif %} 
    151151                {% dl_field item "location_comment" %}