Skip to content

timothycrosley/thedom

Repository files navigation

thedom

PyPI version PyPi downloads Build Status License Bitdeli Badge

thedom is a collection of python objects that enable developers to generate and interact with web apps server side. It encourages object oriented website development, and code reuse by seperating each DOM element into its own object, and then allowing inheritance and child elements to come together to form new elements not defined in the standard DOM.

write this:

from thedom import layout, document, buttons

page = document.Document()
layout = page.addChildElement(layout.Center()).addChildElement(layout.Horizontal())
layout += buttons.Button(text="Use thedom.", **{'class':'MainAction'})
layout += buttons.Button(text="Enjoy writing less code.", **{'class':'DeleteAction'})
layout += buttons.Button(text="100% Python.")

print page.toHTML(formatted=True)

get this:

<!DOCTYPE html>
<html>
    <head>
    <title>
    </title>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    </meta>
    </head>
    <body>
        <div class="WCenter">
            <div class="WOuter">
                <div class="WInner">
                    <div class="WClear">
                        <input class="WBlock WLeft MainAction" type="button" value="Use thedom." />
                        <input class="WBlock WLeft DeleteAction" type="button" value="Enjoy writing less code." />
                        <input class="WBlock WLeft" type="button" value="100% Python." />
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>

Installing thedom

Installing thedom is as simple as:

pip install thedom

or if you prefer

easy_install thedom

Thanks and I hope you find thedom useful!

~Timothy Crosley

About

A python framework to generate html and JavaScript from reusable and combine-able widgets.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published