You are writing a comment about A Django Anti-Pattern, Rolling Your Own REST, here is a quick summary:

Almost every web project ends up with a little slice of REST to call its own. One of the great conveniences of working with Django is that it makes rolling these slices of REST very simple. Simple enough that we as a community are still haven't come up with a compelling unified REST solution. Hopefully we can refocus on this problem a bit with the new 1.0 roadmap, and have something really useful ready to go when Django 1.0 hits the newsstands.


You are responding to this comment written by anonymous on June 13th 2008, 07:52.

Your locate_class_by_string function is a python anti-pattern.

Better use generator expressions (30% faster):

capitalized_string = '_'.join(part.capitalize() for part in string.split('_'))
   

But more pythonic way is to not reinvent the wheel and use title() method (10 times faster!):

capitalized_string = string.title()
   


Please be aware that comment forms go stale after one hour.





Comments may make use of LifeFlow MarkDown. Raw html will be escaped.


Quick Introduction to LifeFlow MarkDown Syntax

A highlighted code block:

@@ ruby
def a (b, c):
  b * c
end
@@

Other common languages work as well: scheme, python, java, html, etc.

Other markdown syntax:

 ### This is an h3 title
#### This is an h4 title
**this is bold**
*this is italics*

1. This is an
2. ordered list

* And an unordered
* list too

[this is a link](http://www.lethain.com/ "Lethain")