Exemple #1
0
def build_plugin_links(dirname, fnames):
    links = []
    for fname in fnames:
        fpath = os.path.join(dirname, fname)
        if not os.path.exists(fpath):
            continue
        name, ext = os.path.splitext(fname)
        name = xutils.unquote(name)
        item = link(name, "/plugins/" + name)
        item.editable = True
        # st = os.stat(fpath)
        # item.atime = xutils.format_date(st.st_atime)
        atime = cacheutil.zscore("plugins.history", fname)
        if atime:
            item.atime = xutils.format_date(atime)
        else:
            item.atime = ""

        item.edit_link = "/code/edit?path=" + fpath
        plugin_context = xconfig.PLUGINS.get(fname)
        item.title = ''
        if plugin_context is not None:
            item.title = plugin_context.title
            item.category = plugin_context.category
        else:
            item.title = name
        links.append(item)
    return links
Exemple #2
0
def build_plugin_links(plugins):
    links = []
    for plugin in plugins:
        fname = plugin.fname
        fpath = plugin.fpath

        item = link(plugin.title, plugin.url)
        item.editable = True
        atime = cacheutil.zscore("plugins.history", plugin.name)
        if atime:
            item.atime = xutils.format_date(atime)
        else:
            item.atime = ""

        item.edit_link = "/code/edit?path=" + fpath
        item.title = plugin.title

        links.append(item)

    return links