Skip to content

Instantly share code, notes, and snippets.

@shylent
Created July 23, 2010 08:32
Show Gist options
  • Save shylent/487174 to your computer and use it in GitHub Desktop.
Save shylent/487174 to your computer and use it in GitHub Desktop.
def handle_foo(request):
format_handlers = {
'xml':handle_foo_xml
}
format = request.GET.get('format', None)
if format is not None and format in format_handlers:
return format_handlers[format](request)
...
def handle_foo_xml(request):
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment