encoding problem with negative votes?

22 views
Skip to first unread message

Sheila Miguez

unread,
Apr 14, 2014, 11:31:23 AM4/14/14
to pinax-s...@googlegroups.com
Hi,

Has anyone run in to a problem where negative votes cause failures? SciPy has a different review flow for abstracts, but for tutorials we'd like to use the review app. We are getting 500s for negative reviews

https://github.com/scipy-conference/SciPy-2014/issues/78

we see

File "/home/scipy/venvs/99ddd7a7d38fb1b6bd5b14dda291143329a3a87e/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue DatabaseError: (1690, "BIGINT UNSIGNED value is out of range in '(((3 * `scipy2014`.`reviews_proposalresult`.`plus_one`) + `s cipy2014`.`reviews_proposalresult`.`plus_zero`) - (`scipy2014`.`reviews_proposalresult`.`minus_zero` + (3 * `scipy2014`.`revi ews_proposalresult`.`minus_one`)))'")

and jlaura has a nice hypothesis,

Is this an issue with utf8 support in the backend on those columns? Can the values be remapped to some other int value
to avoid this error? I would guess that the provided unicode is a mapping to a negative sign
('\xE2\x88\x921') which is causing the issue...maybe?

But, it is actually the case that votes are varchar(2) and not int. And it is the case that our text fields are encoded as latin1 instead of utf8 (unfortunately).


Taavi Burns

unread,
Apr 15, 2014, 3:37:09 AM4/15/14
to pinax-s...@googlegroups.com, David Wolever
I remember PyCon Canada having a problem like this…

I think this was our local fix:

* commit 36e5005ee1a0c664404d85b01c2c4a72cef70a4c

| Author: David Wolever <da...@wolever.net>

| Date:   Sun Jun 23 13:28:09 2013 -0400

| 

|     Damnit, MySQL...

| 

| diff --git a/symposion/reviews/models.py b/symposion/reviews/models.py

| index 64d6db8..50744d5 100644

| --- a/symposion/reviews/models.py

| +++ b/symposion/reviews/models.py

| @@ -17,7 +17,7 @@ from symposion.schedule.models import Presentation

|  class ProposalScoreExpression(object):

|      

|      def as_sql(self, qn, connection=None):

| -        sql = "((3 * plus_one + plus_zero) - (minus_zero + 3 * minus_one))"

| +        sql = "((3.0 * plus_one + plus_zero) - (minus_zero + 3.0 * minus_one))"

|          return sql, []

|      

|      def prepare_database_save(self, unused):

|  


I'm not entirely sure how this fixes Unicode issues…but I do remember that it was a WEIRD bug. ;)



--
You received this message because you are subscribed to the Google Groups "pinax-symposion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pinax-symposi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carl Karsten

unread,
Apr 15, 2014, 8:54:05 AM4/15/14
to pinax-s...@googlegroups.com, David Wolever


        sql = "((3 * plus_one + plus_zero) - (minus_zero + 3 * minus_one))"
--
Carl K

Anthony Scopatz

unread,
Apr 21, 2014, 7:55:42 PM4/21/14
to pinax-s...@googlegroups.com, David Wolever, ca...@personnelware.com
Hello All, 

My suspicion is that this might be a difference between which flavor of SQL is being used, or possibly what OS the site is run on.  Maybe we could report these two bits of information and try to figure out what is going wrong.  I'd be interested to know for SciPy next year.

Be Well
Anthony

sheila miguez

unread,
Apr 22, 2014, 2:01:38 PM4/22/14
to pinax-s...@googlegroups.com

Good points!

Linux scipy-staging 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux
mysql  Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.2

prod
Linux scipy-prod 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
mysql  Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.2

my laptop
Linux yagi 3.11.0-19-generic #33-Ubuntu SMP Tue Mar 11 18:48:34 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
mysql  Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.2


I've been destroying and recreating things in staging to mimic the state of prod whilst changing encoding to see how it affects things crossed with that one line change from Taavi and Dave. I'll report back here. eventually.

I wish we used postgresql and/or thought to check encoding when provisioning mysql.

--
You received this message because you are subscribed to a topic in the Google Groups "pinax-symposion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pinax-symposion/OJxw2vkzzX0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pinax-symposi...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages