Archive
Have a flair for color?
/ software/ remap/

Remap

What is Remap?


Remap is an alternate routing module for Twisted's http module. Remap uses an xml map where each node in the document represents a tier in the site path.

What is it good for?


Remap is good for situations where are you using Twisted's http module and you don't like the built in routing.

Example


from twisted.internet import reactor
import remap

site = remap.RemapSite(actionimport='website.actions')
site.digestMap('''
    <root action="mainpage" defaultaction="notfound">
        <node match="login"/>
        <node match="item">
            <node match="add" action="itemadd" />
            <node match="\d+" action="iteminfo">
                <node match="remove" action="itemremove"
            </node>
        </node>
    </root>
    ''')
reactor.listenTCP(80, site)
reactor.run()

License - Contact