OdifYltsaeb / django-multilingual

Automatically exported from code.google.com/p/django-multilingual
MIT License
0 stars 0 forks source link

vakueError: too many values to unpack - django trunk rev. 9700 and more #85

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use multilingual trunk rev. 153
2. with django trunk rev. 9708
3. save (SQL add) an object with admin interface

What is the expected output? What do you see instead?

Exception Type:  ValueError
Exception Value: too many values to unpack

Please provide any additional information below, diff correction:
--- multilingual/query.py.orig  2009-01-06 22:21:31.000000000 +0100
+++ multilingual/query.py   2009-01-06 22:20:39.000000000 +0100
@@ -14,7 +14,7 @@
 from django.db.models.sql.query import Query
 from django.db.models.sql.datastructures import Count, EmptyResultSet,
Empty, MultiJoin
 from django.db.models.sql.constants import *
-from django.db.models.sql.where import WhereNode, EverythingNode, AND, OR
+from django.db.models.sql.where import WhereNode, Constraint,
EverythingNode, AND, OR

 from multilingual.languages import (get_translation_table_alias,
get_language_id_list,
                                     get_default_language,
get_translated_field_alias,
@@ -140,7 +140,7 @@
                     trans_table_alias = get_translation_table_alias(
                         model._meta.db_table, language_id)
                     new_table = (master_table_name + "__" + trans_table_alias)
-                    self.where.add((new_table, field.column, field,
lookup_type, value), connector)
+                    self.where.add((Constraint(alias, col, field),
lookup_type, value), connector)
                     return

         final = len(join_list)
@@ -206,7 +206,8 @@
             self.promote_alias_chain(join_it, join_promote)
             self.promote_alias_chain(table_it, table_promote)

-        self.where.add((alias, col, field, lookup_type, value), connector)
+        self.where.add((Constraint(alias, col, field), lookup_type, value), 
+            connector) 

         if negate:
             self.promote_alias_chain(join_list)
@@ -216,7 +217,7 @@
                         if self.alias_map[alias][JOIN_TYPE] == self.LOUTER:
                             j_col = self.alias_map[alias][RHS_JOIN_COL]
                             entry = self.where_class()
-                            entry.add((alias, j_col, None, 'isnull',
True), AND)
+                            entry.add((Constraint(alias, col, None),
'isnull', True), AND)
                             entry.negate()
                             self.where.add(entry, AND)
                             break
@@ -225,7 +226,7 @@
                     # exclude the "foo__in=[]" case from this handling,
because
                     # it's short-circuited in the Where class.
                     entry = self.where_class()
-                    entry.add((alias, col, None, 'isnull', True), AND)
+                    entry.add((Constraint(alias, col, None), 'isnull',
True), AND)
                     entry.negate()
                     self.where.add(entry, AND)

Find in attachment patch for multilingual/query.py, require for using
django svn trunk rev. 9700 and more.

Original issue reported on code.google.com by m.meylan@gmail.com on 6 Jan 2009 at 9:34

Attachments:

GoogleCodeExporter commented 8 years ago
houpss, in attachment the correct one:

--- multilingual/query.py.orig  2009-01-06 22:21:31.000000000 +0100
+++ multilingual/query.py   2009-01-06 22:58:14.000000000 +0100
@@ -14,7 +14,7 @@
 from django.db.models.sql.query import Query
 from django.db.models.sql.datastructures import Count, EmptyResultSet, Empty, MultiJoin
 from django.db.models.sql.constants import *
-from django.db.models.sql.where import WhereNode, EverythingNode, AND, OR
+from django.db.models.sql.where import WhereNode, Constraint, EverythingNode, 
AND, OR

 from multilingual.languages import (get_translation_table_alias, get_language_id_list,
                                     get_default_language, get_translated_field_alias,
@@ -140,7 +140,7 @@
                     trans_table_alias = get_translation_table_alias(
                         model._meta.db_table, language_id)
                     new_table = (master_table_name + "__" + trans_table_alias)
-                    self.where.add((new_table, field.column, field, 
lookup_type,
value), connector)
+                    self.where.add((Constraint(new_table, field.column, field),
lookup_type, value), connector)
                     return

         final = len(join_list)
@@ -206,7 +206,8 @@
             self.promote_alias_chain(join_it, join_promote)
             self.promote_alias_chain(table_it, table_promote)

-        self.where.add((alias, col, field, lookup_type, value), connector)
+        self.where.add((Constraint(alias, col, field), lookup_type, value),
+            connector)

         if negate:
             self.promote_alias_chain(join_list)
@@ -216,7 +217,7 @@
                         if self.alias_map[alias][JOIN_TYPE] == self.LOUTER:
                             j_col = self.alias_map[alias][RHS_JOIN_COL]
                             entry = self.where_class()
-                            entry.add((alias, j_col, None, 'isnull', True), 
AND)
+                            entry.add((Constraint(alias, j_col, None), 
'isnull',
True), AND)
                             entry.negate()
                             self.where.add(entry, AND)
                             break
@@ -225,7 +226,7 @@
                     # exclude the "foo__in=[]" case from this handling, because
                     # it's short-circuited in the Where class.
                     entry = self.where_class()
-                    entry.add((alias, col, None, 'isnull', True), AND)
+                    entry.add((Constraint(alias, col, None), 'isnull', True), 
AND)
                     entry.negate()
                     self.where.add(entry, AND)

Original comment by m.meylan@gmail.com on 6 Jan 2009 at 10:01

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you very much for the patch, this fixes also a (same) problem with 
manage.py
loaddata.

Günter

Original comment by guenter....@wanagu.at on 9 Jan 2009 at 10:54

GoogleCodeExporter commented 8 years ago
Fixed in rev. 155, thanks!

Original comment by marcin.k...@gmail.com on 18 Feb 2009 at 4:23