Commits

Matías Herranz committed dc3b4f5 Draft

Another fix to views.py

  • Participants
  • Parent commits 82db1c3

Comments (0)

Files changed (1)

File postman/views.py

         try:
             post_ids = [int(n) for n in post_recipients.split('|') if n != u'']
             users = User.objects.filter(id__in=post_ids)
-            request.POST['recipients'] = ','.join([user.username for user in users])
-            #request.POST['recipients'] = ','.join([str(user.id) for user in users])
         except:
-            pass
+            # handle the case when something like u'|u|s|e|r|1|0|' comes in
+            # request.POST['recipients']
+            aux = post_recipients.replace('|', '')
+            users = [User.objects.get(username=aux),]
+
+        request.POST['recipients'] = ','.join([user.username for user in users])
         request.POST._mutable = False
 
     user = request.user