Ejemplo n.º 1
0
class CollectionPage(WebPage):
    def __init__(self, config):
        self.config = config
        self.dao = DAO(config)
        self.um = URIManager(config)
        
    def get_collection_page(self, id):
        frag = "<h1>Collection: " + id + "</h1>"
        
        # list all of the containers in the collection
        cpath = self.dao.get_store_path(id)
        containers = os.listdir(cpath)
        frag += "<h2>Containers</h2><ul>"
        for container in containers:
            frag += "<li><a href=\"" + self.um.html_url(id, container) + "\">" + container + "</a></li>"
        frag += "</ul>"
        
        head_frag = "<link rel=\"http://purl.org/net/sword/terms/deposit\" href=\"" + self.um.col_uri(id) + "\"/>"
        
        return self._wrap_html("Collection: " + id, frag, head_frag)