RoR like (was : SPE 0.8.1.b Python IDE...)
Adrian Holovaty
holovaty at gmail.com
Fri Dec 16 10:23:16 EST 2005
bruno at modulix wrote:
> Adrian, what you describe here is *exactly* what I call "no Ajax
> support": you have to handle the whole thing manually, the framework
> doesn't provide anything by itself. Would you say the CGI module offers
> support for templating, data persistance and Ajax as well ?-)
Hey Bruno,
Sorry for the misunderstanding. Here's the Django code I use on the
Ajax bit of the chicagocrime.org "Find your District" page
(http://www.chicagocrime.org/districts/). See the "Guess district"
button on that page.
"""
def rpc_guess_district(request, longitude, latitude):
try:
b = beats.guess_by_coordinates(float(longitude),
float(latitude))
except beats.BeatDoesNotExist:
return HttpResponse("Looks like you're not centered on a point
in Chicago. " + \
"Please move the map to Chicago and try again.")
return HttpResponse("You're centered on %s" %
b.get_name_and_district())
"""
My point is, you don't need a huge serialization framework to do Ajax
easily. As long as a server can return snippets of code (or even plain
text), you can do it.
These pages work the same way:
http://www.chicagocrime.org/map/
http://www.chicagocrime.org/wards/
http://www.chicagocrime.org/route/
Hope that clears up my point of view,
Adrian
More information about the Python-list
mailing list