priestc / giotto

Python web development simplified
BSD 2-Clause "Simplified" License
59 stars 10 forks source link

Create program namespaces #2

Closed priestc closed 11 years ago

priestc commented 11 years ago

Currently all programs are under the same 'root' namespace:

# web
http://localhost:5000/multiply?x=5&y=4

Change it so you can easiely add namespaces, so programs with the same name can coexist:

# web
http://localhost:5000/math/multiply?x=5&y=4
http://localhost:5000/other/multiply?x=5&y=4

Do this by adding a namespace wrapper when defining programs:

class Math(GiottoProgramNamespace):
    name = "math"

    class Multiply(GiottoProgram):
        name = "multiply"
        model = (multiply, )
        view = (MultiplyViewer, )
        controllers = ('http-get', 'irc')

class SomethingElse(GiottoProgramNamespace):
    name = "other"

    class Multiply(GiottoProgram):
        name = "multiply"
        model = (multiply, )
        view = (AnotherMultiplyViewer, )
        controllers = ('http-get', 'irc')
priestc commented 11 years ago

fixed with the commit that adds ma nifests