@handle_response_format
@treeio_login_required
def stream_edit(request, stream_id, response_format='html'):
 user = request.user.profile
 stream = get_object_or_404(MessageStream, pk=stream_id)
 if (not request.user.profile.has_permission(stream, mode='w')):
  return user_denied(request, message="You don't have access to this Stream", response_format=response_format)
 if request.POST:
  if ('cancel' not in request.POST):
   form = MessageStreamForm(user, request.POST, instance=stream)
   if form.is_valid():
    stream = form.save()
    return HttpResponseRedirect(reverse('messaging_stream_view', args=[stream.id]))
  else:
   return HttpResponseRedirect(reverse('messaging_stream_view', args=[stream.id]))
 else:
  form = MessageStreamForm(user, instance=stream)
 context = _get_default_context(request)
 context.update({'form': form, 'stream': stream})
 return render_to_response('messaging/stream_edit', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def stream_edit ( request , stream_id , response_format = 'html' ) : user = request . user . profile stream = get_object_or_404 ( MessageStream , pk = stream_id ) if ( not request . user . profile . has_permission ( stream , mode = 'w' ) ) : return user_denied ( request , message = "You don't have access to this Stream" , response_format = response_format ) if request . POST : if ( 'cancel' not in request . POST ) : form = MessageStreamForm ( user , request . POST , instance = stream ) if form . is_valid ( ) : stream = form . save ( ) return HttpResponseRedirect ( reverse ( 'messaging_stream_view' , args = [ stream . id ] ) ) else : return HttpResponseRedirect ( reverse ( 'messaging_stream_view' , args = [ stream . id ] ) ) else : form = MessageStreamForm ( user , instance = stream ) context = _get_default_context ( request ) context . update ( { 'form' : form , 'stream' : stream } ) return render_to_response ( 'messaging/stream_edit' , context , context_instance = RequestContext ( request ) , response_format = response_format )
stream edit page .