def widget_display_undecorated(request, user_to_display__username): """We leave this function unwrapped by @view """ """so it can referenced by widget_display_string.""" # {{{ user = get_object_or_404(User, username=user_to_display__username) person = get_object_or_404(Person, user=user) data = get_personal_data(person) data.update( mysite.base.view_helpers. get_uri_metadata_for_generating_absolute_links(request)) return (request, 'profile/widget.html', data) # }}} widget_display = view(widget_display_undecorated) def widget_display_string(request, user_to_display__username): request, template, data = widget_display_undecorated( request, user_to_display__username) return render_to_string(template, data) def widget_display_js(request, user_to_display__username): # FIXME: In the future, use: html_doc = widget_display_string(request, user_to_display__username) # to generate html_doc encoded_for_js = json.dumps(html_doc) # Note: using application/javascript as suggested by # http://www.ietf.org/rfc/rfc4329.txt
# FIXME: Test this. def widget_display_undecorated(request, user_to_display__username): """We leave this function unwrapped by @view """ """so it can referenced by widget_display_string.""" # {{{ user = get_object_or_404(User, username=user_to_display__username) person = get_object_or_404(Person, user=user) data = get_personal_data(person) data.update(mysite.base.controllers.get_uri_metadata_for_generating_absolute_links( request)) return (request, 'profile/widget.html', data) # }}} widget_display = view(widget_display_undecorated) def widget_display_string(request, user_to_display__username): request, template, data = widget_display_undecorated(request, user_to_display__username) return render_to_string(template, data) def widget_display_js(request, user_to_display__username): # FIXME: In the future, use: html_doc = widget_display_string(request, user_to_display__username) # to generate html_doc encoded_for_js = simplejson.dumps(html_doc) # Note: using application/javascript as suggested by # http://www.ietf.org/rfc/rfc4329.txt return render_response(request, 'base/append_ourselves.js', {'in_string': encoded_for_js}, mimetype='application/javascript')