Add zephyr_backend RPC call.

(imported from commit e815580e201772e81e94b820174e2410e3069960)
This commit is contained in:
Tim Abbott 2012-09-06 15:52:03 -04:00
parent 115334c82a
commit d9f348a348
2 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,7 @@ urlpatterns = patterns('',
url(r'^update$', 'zephyr.views.update', name='update'),
url(r'^get_updates_longpoll$', 'zephyr.views.get_updates_longpoll', name='get_updates_longpoll'),
url(r'^zephyr/', 'zephyr.views.zephyr', name='zephyr'),
url(r'^forge_zephyr/', 'zephyr.views.zephyr_backend', name='zephyr_backend'),
url(r'^accounts/home/', 'zephyr.views.accounts_home', name='accounts_home'),
url(r'^accounts/login/', 'django.contrib.auth.views.login', {'template_name': 'zephyr/login.html'}),
url(r'^accounts/logout/', 'django.contrib.auth.views.logout', {'template_name': 'zephyr/index.html'}),

View File

@ -143,9 +143,12 @@ def get_updates_longpoll(request, handler):
# We need to replace this abstraction with the message list
user_profile.add_callback(handler.async_callback(on_receive), last_received)
def zephyr(request):
return zephyr_backend(request, request.user)
@login_required
@require_post
def zephyr(request):
def zephyr_backend(request, sender):
user_profile = UserProfile.objects.get(user=request.user)
zephyr_type = request.POST["type"]
if zephyr_type == 'class':
@ -195,7 +198,7 @@ def zephyr(request):
raise
new_zephyr = Zephyr()
new_zephyr.sender = UserProfile.objects.get(user=request.user)
new_zephyr.sender = UserProfile.objects.get(user=sender)
new_zephyr.content = request.POST['new_zephyr']
new_zephyr.recipient = recipient
if zephyr_type == "class":