Пример #1
0
def defaultAction(req_info):
    folder = req_info.url_path
    
    LOG.debug("Root: %s; Folder: %s" % (req_info.root, folder))
        
    files, is_empty = io.getFilelist(req_info.root, folder)
    title_desc = io.get_title_and_description(req_info.root, folder)
    
    description = '\n\n'.join(title_desc['description'])
    
    title =  title_desc['title']
    if  title == '':
        title = path.basename(folder)
    LOG.debug("[showEditFolderPageAction] Title: %s; Description: %s" % (title, description))
    
    req_info.resp_data['files'] = files
    req_info.resp_data['is_empty'] = is_empty
    req_info.resp_data['description'] = description
    req_info.resp_data['title'] = title
    
    LOG.debug('[showEditFolderPageAction] url_path: %s' % req_info.url_path)
    
    req_info.resp_forward = 'templates.editfolder'
    
    return req_info
Пример #2
0
def fill_template(req, templ):
    scanner = Scanner(req)
    triples = scanner.image_triples

    index = Template(source=templ)
    index.info = io.get_title_and_description(scanner.root)
    index.image_triples = triples
    index.imagearray = scanner.preload_js_array
    index.initialimage = scanner.preload_first
    index.folders = scanner.subdirs
    index.movies = scanner.movies
    index.context = scanner.baseUrl

    fields = util.FieldStorage(req)
    admin_url = fields.getfirst("admin_url")
    index.admin_url = admin_url

    uri = req.uri
    if uri.endswith("/"):
        uri = uri[:-1]

    LOG.debug("[getIndexPage] URI: %s" % uri)

    index.parent = path.split(uri)[0]
    index.parent_name = path.basename(index.parent)

    return index