Exemplo n.º 1
0
def uri_params(uri):
    args = {}
    allstr = uri.split('?')
    if len(allstr) > 1:
        uri, argstr = allstr
        argstr = argstr.split('&')

        for arg in argstr:
            key, val = arg.split('=')
            # Do not encode the already-encoded attachments
            if key == 'attachment':
                key = url_unquote(key)
                val = url_unquote(val)
                # Attachment strings are encoded,
                # although Moin gives them as unicode ->
                # decode to unicode. This should be actually
                # done in the inline-bit in ViewDot-action,
                # but is done here to assure functionality
                # of existing wiki pages
                val = val.encode('raw_unicode_escape')
                val = unicode(val, config.charset)

                args.setdefault(key,
                                []).append(val)
            else:
                args.setdefault(encode(url_unquote(key)),
                                []).append(encode(url_unquote(val)))

    return uri, args
Exemplo n.º 2
0
                          p.nameidmap[end])


for node, in p.graph.nodes:
    nodedir = os.path.join(basedir, quoteWikinameFS(node))
    curf = os.path.join(nodedir, 'current')
    nro = 1
    revdir = os.path.join(nodedir, 'revisions')
    if not os.path.exists(nodedir):
        os.mkdir(nodedir)
    if not os.path.exists(revdir):
        os.mkdir(revdir)
    if os.path.exists(curf):
        nro = int(file(curf).read()[:-1]) + 1
        os.unlink(curf)
    curver = "%08d" % nro
    file(curf, 'w').write(curver + '\n')
    out = file(os.path.join(revdir, curver), 'w')    

    for par, chi in p.graph.edges:
        if not par == node:
            continue
        out.write('["%s"]\n\n' % encode(chi))

    if cat:
        out.write('%s\n' % cat)

    out.close()

#print p.glinks
Exemplo n.º 3
0
    for end in p.glinks[start]:
        p.graph.edges.add(p.nameidmap[start], p.nameidmap[end])

for node, in p.graph.nodes:
    nodedir = os.path.join(basedir, quoteWikinameFS(node))
    curf = os.path.join(nodedir, 'current')
    nro = 1
    revdir = os.path.join(nodedir, 'revisions')
    if not os.path.exists(nodedir):
        os.mkdir(nodedir)
    if not os.path.exists(revdir):
        os.mkdir(revdir)
    if os.path.exists(curf):
        nro = int(file(curf).read()[:-1]) + 1
        os.unlink(curf)
    curver = "%08d" % nro
    file(curf, 'w').write(curver + '\n')
    out = file(os.path.join(revdir, curver), 'w')

    for par, chi in p.graph.edges:
        if not par == node:
            continue
        out.write('["%s"]\n\n' % encode(chi))

    if cat:
        out.write('%s\n' % cat)

    out.close()

#print p.glinks