problems with workaround for negative votes

12 views
Skip to first unread message

sheila miguez

unread,
Apr 22, 2014, 2:14:00 PM4/22/14
to pinax-s...@googlegroups.com
While I am working on resolving the negative votes problem, I thought perhaps removing some of the munged votes from the db would help the users who are blocked from viewing their dashboards.

So, I added and admin for Review.

https://github.com/scipy-conference/symposion/blob/reviewadmin/symposion/reviews/admin.py

I gave our PC chair a list of the votes, voters, and comments for the problem votes then deleted them via the admin.

This workaround idea did not work, the users who had made the problematic votes still are unable to view their dashboards. Here's a stacktrace.

It ends in

SiteTreeError: Sitetree needs "django.core.context_processors.request" to be in TEMPLATE_CONTEXT_PROCESSORS in your settings file. If it is, check that your view pushes request data into the template.

If it is immediately obvious to someone what we need to do to get around that please reply. I have no idea how what I did caused this problem.


sheila miguez

unread,
Apr 22, 2014, 10:12:05 PM4/22/14
to pinax-s...@googlegroups.com
It turns out what was happening was a key error due to the dictionary that looks up css styles getting a '?1' or '?0' due to the encoding problem.

I've got this workaround in use for the moment

--- a/symposion/reviews/models.py                                                                                 
+++ b/symposion/reviews/models.py                                                                                 
@@ -36,6 +36,14 @@ class Votes(object):                                                                           
         (MINUS_ZERO, u"−0 — Weak proposal, but I will not argue strongly against acceptance."),
         (MINUS_ONE, u"−1 — Serious issues and I will argue to reject this proposal."),
     ]
+                                                                                                                 
+    CSS_LOOKUP = {                                                                                               
+        PLUS_ONE: "plus-one",                                                                                    
+        PLUS_ZERO: "plus-zero",                                                                                  
+        MINUS_ZERO: "minus-zero",                                                                                
+        MINUS_ONE: "minus-one",                                                                                  
+    }                                                                                                            
+                                                                                                                 
 VOTES = Votes()



     def css_class(self):
-        return {                                                                                                 
-            self.VOTES.PLUS_ONE: "plus-one",                                                                     
-            self.VOTES.PLUS_ZERO: "plus-zero",                                                                   
-            self.VOTES.MINUS_ZERO: "minus-zero",                                                                 
-            self.VOTES.MINUS_ONE: "minus-one",                                                                   
-        }[self.vote]                                                                                             
-                                                                                                                 
+        # default to "minus-zero" style in the event our database has incorrectly encoded the vote               
+        return self.VOTES.CSS_LOOKUP.get(self.vote, "minus-zero")                                                
+                                                                                                                 
 and so on

Reply all
Reply to author
Forward
0 new messages