All pastes #277930 Raw Edit

Something

public text v1 · immutable
·published 2006-12-13 18:18 UTC
rendered paste body
from django.conf import settings
from django.template import Context, Template

class MyModule(Component):
    implements(IRequestHandler)

    # IRequestHandler methods
    def match_request(self, req):
        return req.path_info == '/myurl'

    def process_request(self, req):
        req.send_response(200)
        req.send_header('Content-Type', 'text/html')
        req.end_headers()
        
        t = Template("My name is {{ my_name }}.")
        c = Context({"my_name": "Adrian"})
        someString = t.render(c)
        
        req.write(someString)
        return None