Skip to content

Instantly share code, notes, and snippets.

@garindra
Created May 23, 2011 18:47
Show Gist options
  • Save garindra/987269 to your computer and use it in GitHub Desktop.
Save garindra/987269 to your computer and use it in GitHub Desktop.
PyDOM API examples
from PyDOM import PyDOM
class ExampleViewComponent(PyDOM):
def draw(self):
self.div() #Result : '<div></div>'
class AnotherViewComponent(PyDOM):
def draw(self):
self.div('Hi!').span().text('this is a block of text') #Result : '<div>Hi</div><span></span>this is a block of text'
dom = AnotherViewComponent()
print dom.generate() #Renders : '<div>Hi</div><span></span>this is a block of text'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment