Exemplo n.º 1
0
def permcheck(startpage, context, what1, what2, default):
    for page in utils.walk_to_root(startpage):
        if page.type == "dir":
            spage = page.child(access_file)
        else:
            spage = page
        if not spage.realpage():
            continue
        res = wikirend.gen_page_features(spage, context)
        if what1 in res:
            return what2 in res
    return default
Exemplo n.º 2
0
def permcheck(startpage, context, what1, what2, default):
	for page in utils.walk_to_root(startpage):
		if page.type == "dir":
			spage = page.child(access_file)
		else:
			spage = page
		if not spage.realpage():
			continue
		res = wikirend.gen_page_features(spage, context)
		if what1 in res:
			return what2 in res
	return default
Exemplo n.º 3
0
	def pref_view_and_dir(self, dpage, views):
		if dpage.type != "dir":
			return (None, None)
		for cp in utils.walk_to_root(dpage.me()):
			for posview in views:
				if posview == 'index' and cp != dpage:
					continue
				flagn = ".flag.prefview:" + posview
				fpath = utils.pjoin(cp.path, flagn)
				if self.pstore.exists(fpath):
					return (posview, cp)
		return (None, None)
Exemplo n.º 4
0
def upreadme(context):
    """Like _inject::readme_, except it searches for ((__readme)) all
	the way back to the DWiki root directory, not just in the current
	directory."""
    page = context.page.me().curdir()
    if page.type != "dir":
        return ''

    for pdir in utils.walk_to_root(page):
        rpage = pdir.child("__readme")
        if rpage.exists():
            break
    else:
        return ''

    # Once we find something called __readme we stop looking, even
    # if the found thing is not a file or not displayable.
    if rpage.type != "file" or not rpage.displayable():
        return ''
    return render_page(context, rpage)
Exemplo n.º 5
0
def upreadme(context):
	"""Like _inject::readme_, except it searches for ((__readme)) all
	the way back to the DWiki root directory, not just in the current
	directory."""
	page = context.page.me().curdir()
	if page.type != "dir":
		return ''

	for pdir in utils.walk_to_root(page):
		rpage = pdir.child("__readme")
		if rpage.exists():
			break
	else:
		return ''

	# Once we find something called __readme we stop looking, even
	# if the found thing is not a file or not displayable.
	if rpage.type != "file" or not rpage.displayable():
		return ''
	return render_page(context, rpage)