Re: [Django] #9919: Raw SQL documentation doesn't mention transaction management

2009-06-12 Thread Django
#9919: Raw SQL documentation doesn't mention transaction management
+---
  Reporter:  Leo| Owner:  nobody
Status:  reopened   | Milestone:  1.1   
 Component:  Documentation  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Accepted   | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  1  |  
+---
Changes (by russellm):

  * status:  closed => reopened
  * needs_better_patch:  0 => 1
  * stage:  Unreviewed => Accepted
  * resolution:  duplicate =>
  * milestone:  => 1.1

Comment:

 In the absence of a resolution for #9964, we should add  a note on the
 need to manually dirty transactions if you use raw-sql.

 The current patch doesn't do that, though.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9964: Transaction middleware closes the transaction only when it's marked as dirty

2009-06-12 Thread Django
#9964: Transaction middleware closes the transaction only when it's marked as
dirty
---+
  Reporter:  ishirav   | Owner:  
mtredinnick 
Status:  assigned  | Milestone:  1.2
 
 Component:  Database layer (models, ORM)  |   Version:  1.0-beta-1 
 
Resolution:|  Keywords:  
transactions
 Stage:  Accepted  | Has_patch:  1  
 
Needs_docs:  1 |   Needs_tests:  0  
 
Needs_better_patch:  0 |  
---+
Comment (by russellm):

 Replying to [comment:16 shai]:
 > Hi,
 > > having a user-space setting to determine transaction behavior is a
 non-starter.
 > Could you please elaborate on this a little? I find it confusing, as the
 setting activating the transaction middleware (as all middlewares) is in
 the same space as the setting proposed in the patch.

 The current patch proposes to preserve the current behavior, as well as
 adding a new behavior that implements a new behavior. However, this isn't
 an area of API where the end user should be required to make a choice at
 all - it should Just Work (tm). The only users that will care about the
 different behavior are those optimizing for uber-speed, and for those
 users we have extensive manual controls over transactions.

 > > From a design perspective, there are some subtle tradeoffs that need
 to be considered here, including weighing the cost/benefit of "always
 commit",
 > > and ensuring that manual transaction control will continue to work for
 those that need every last nanosecond of performance.
 > This I also find confusing, as almost everything that is non-trivial
 here is intended to keep the current behavior available for people who
 need it (and in fact, keep it through the upgrade for existing projects).
 Perhaps I misunderstand, but it seems like you are trying to decide on the
 always-close-transaction issue, when the patch jumps through hoops in
 order to defer this very decision -- to users for now, and to the future
 in general.

 Deciding to push the decision to the user isn't a decision at all. More
 control knobs doesn't necessarily imply better software. Part of the job
 of a framework is to eliminate some decisions to make sure that things
 always work as expected. We want to make a decision, and make sure it is
 the right one. Since this is a bit of an edge case, and there is a
 reasonable workaround, we're willing to defer that decision until we know
 we will get it right.

 > > On the flipside - the existing behavior works, as long as you
 understand what "works" means.
 >
 > In this case, would you consider documentation patches (as proposed in
 #9919)?

 Agreed, we probably should add some docs for this. The patch on #9919
 doesn't really do the job at the moment. To my mind, it makes a lot of
 unnecessary changes, and only gives a marginal improvement on the one area
 that the ticket should be addressing. I'll reopen the ticket, but a new
 patch will be required.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9370: UnicodeDecodeError when serving binary static files through GZipMiddleWare

2009-06-12 Thread Django
#9370: UnicodeDecodeError when serving binary static files through 
GZipMiddleWare
-+--
  Reporter:  kikko   | Owner:  kkubasik
Status:  closed  | Milestone:  1.1 
 Component:  Core framework  |   Version:  1.0 
Resolution:  worksforme  |  Keywords:  
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Changes (by russellm):

  * status:  reopened => closed
  * resolution:  => worksforme

Comment:

 Can't reproduce with provided instructions.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r11003 - django/branches/soc2009/http-wsgi-improvements/django/db/backends

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:30:47 -0500 (Fri, 12 Jun 2009)
New Revision: 11003

Modified:
   django/branches/soc2009/http-wsgi-improvements/django/db/backends/creation.py
Log:
Fixed #9253 -- Modified the method used to generate constraint names so that it 
is consistent regardless of machine word size.

NOTE: This change is backwards incompatible for some users.

If you are using a 32-bit platform, you will observe no differences as a
result of this change. However, users on 64-bit platforms may experience
some problems using the `reset` management command.

Prior to this change, 64-bit platforms would generate a 64-bit, 16 character
digest in the constraint name; for example:

ALTER TABLE `myapp_sometable` ADD CONSTRAINT 
`object_id_refs_id_5e8f10c132091d1e` FOREIGN KEY ...

Following this change, all platforms, regardless of word size, will
generate a 32-bit, 8 character digest in the constraint name; for example:

ALTER TABLE `myapp_sometable` ADD CONSTRAINT `object_id_refs_id_32091d1e` 
FOREIGN KEY ...

As a result of this change, you will not be able to use the `reset`
management command on any table created with 64-bit constraints. This
is because the the new generated name will not match the historically
generated name; as a result, the SQL constructed by the `reset` command
will be invalid.

If you need to reset an application that was created with 64-bit
constraints, you will need to manually drop the old constraint prior
to invoking `reset`.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/backends/creation.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/db/backends/creation.py   
2009-06-13 03:30:36 UTC (rev 11002)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/db/backends/creation.py   
2009-06-13 03:30:47 UTC (rev 11003)
@@ -25,6 +25,10 @@
 def __init__(self, connection):
 self.connection = connection
 
+def _digest(self, *args):
+"Generate a 32 bit digest of a set of arguments that can be used to 
shorten identifying names"
+return '%x' % (abs(hash(args)) % (1<<32))
+
 def sql_create_model(self, model, style, known_models=set()):
 """
 Returns the SQL required to create a single model, as a tuple of:
@@ -128,7 +132,7 @@
 col = opts.get_field(f.rel.field_name).column
 # For MySQL, r_name must be unique in the first 64 characters.
 # So we are careful with character usage here.
-r_name = '%s_refs_%s_%x' % (r_col, col, abs(hash((r_table, 
table
+r_name = '%s_refs_%s_%s' % (r_col, col, self._digest(r_table, 
table))
 final_output.append(style.SQL_KEYWORD('ALTER TABLE') + ' %s 
ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)%s;' % \
 (qn(r_table), qn(truncate_name(r_name, 
self.connection.ops.max_name_length())),
 qn(r_col), qn(table), qn(col),
@@ -187,8 +191,7 @@
 output.append('\n'.join(table_output))
 
 for r_table, r_col, table, col in deferred:
-r_name = '%s_refs_%s_%x' % (r_col, col,
-abs(hash((r_table, table
+r_name = '%s_refs_%s_%s' % (r_col, col, self._digest(r_table, 
table))
 output.append(style.SQL_KEYWORD('ALTER TABLE') + ' %s ADD 
CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)%s;' %
 (qn(r_table),
 qn(truncate_name(r_name, 
self.connection.ops.max_name_length())),
@@ -289,7 +292,7 @@
 col = f.column
 r_table = model._meta.db_table
 r_col = model._meta.get_field(f.rel.field_name).column
-r_name = '%s_refs_%s_%x' % (col, r_col, abs(hash((table, 
r_table
+r_name = '%s_refs_%s_%s' % (col, r_col, self._digest(table, 
r_table))
 output.append('%s %s %s %s;' % \
 (style.SQL_KEYWORD('ALTER TABLE'),
 style.SQL_TABLE(qn(table)),


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r11001 - in django/branches/soc2009/http-wsgi-improvements: django/db/models tests/modeltests/proxy_models

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:30:22 -0500 (Fri, 12 Jun 2009)
New Revision: 11001

Modified:
   django/branches/soc2009/http-wsgi-improvements/django/db/models/base.py
   
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/proxy_models/models.py
Log:
Fixed #10672 -- Altered save_base to ensure that proxy models send a post_save 
signal.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/base.py
===
--- django/branches/soc2009/http-wsgi-improvements/django/db/models/base.py 
2009-06-13 03:30:05 UTC (rev 11000)
+++ django/branches/soc2009/http-wsgi-improvements/django/db/models/base.py 
2009-06-13 03:30:22 UTC (rev 11001)
@@ -411,29 +411,35 @@
 
 save.alters_data = True
 
-def save_base(self, raw=False, cls=None, force_insert=False,
-force_update=False):
+def save_base(self, raw=False, cls=None, origin=None,
+force_insert=False, force_update=False):
 """
 Does the heavy-lifting involved in saving. Subclasses shouldn't need to
 override this method. It's separate from save() in order to hide the
 need for overrides of save() to pass around internal-only parameters
-('raw' and 'cls').
+('raw', 'cls', and 'origin').
 """
 assert not (force_insert and force_update)
-if not cls:
+if cls is None:
 cls = self.__class__
-meta = self._meta
-signal = True
-signals.pre_save.send(sender=self.__class__, instance=self, 
raw=raw)
+meta = cls._meta
+if not meta.proxy:
+origin = cls
 else:
 meta = cls._meta
-signal = False
 
+if origin:
+signals.pre_save.send(sender=origin, instance=self, raw=raw)
+
 # If we are in a raw save, save the object exactly as presented.
 # That means that we don't try to be smart about saving attributes
 # that might have come from the parent class - we just save the
 # attributes we have been given to the class we have been given.
 if not raw:
+if meta.proxy:
+org = cls
+else:
+org = None
 for parent, field in meta.parents.items():
 # At this point, parent's primary key field may be unknown
 # (for example, from administration form which doesn't fill
@@ -441,7 +447,8 @@
 if field and getattr(self, parent._meta.pk.attname) is None 
and getattr(self, field.attname) is not None:
 setattr(self, parent._meta.pk.attname, getattr(self, 
field.attname))
 
-self.save_base(cls=parent)
+self.save_base(cls=parent, origin=org)
+
 if field:
 setattr(self, field.attname, 
self._get_pk_val(parent._meta))
 if meta.proxy:
@@ -492,8 +499,8 @@
 setattr(self, meta.pk.attname, result)
 transaction.commit_unless_managed()
 
-if signal:
-signals.post_save.send(sender=self.__class__, instance=self,
+if origin:
+signals.post_save.send(sender=origin, instance=self,
 created=(not record_exists), raw=raw)
 
 save_base.alters_data = True

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/proxy_models/models.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/proxy_models/models.py
  2009-06-13 03:30:05 UTC (rev 11000)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/proxy_models/models.py
  2009-06-13 03:30:22 UTC (rev 11001)
@@ -259,6 +259,33 @@
 >>> OtherPerson._default_manager.all()
 [, ]
 
+# Test save signals for proxy models
+>>> from django.db.models import signals
+>>> def make_handler(model, event):
+... def _handler(*args, **kwargs):
+... print u"%s %s save" % (model, event)
+... return _handler
+>>> h1 = make_handler('MyPerson', 'pre')
+>>> h2 = make_handler('MyPerson', 'post')
+>>> h3 = make_handler('Person', 'pre')
+>>> h4 = make_handler('Person', 'post')
+>>> signals.pre_save.connect(h1, sender=MyPerson)
+>>> signals.post_save.connect(h2, sender=MyPerson)
+>>> signals.pre_save.connect(h3, sender=Person)
+>>> signals.post_save.connect(h4, sender=Person)
+>>> dino = MyPerson.objects.create(name=u"dino")
+MyPerson pre save
+MyPerson post save
+
+# Test save signals for proxy proxy models
+>>> h5 = make_handler('MyPersonProxy', 'pre')
+>>> h6 = make_handler('MyPersonProxy', 'post')
+>>> signals.pre_save.connect(h5, sender=MyPersonProxy)
+>>> signals.post_save.connect(h6, sender=MyPersonProxy)
+>>> dino = MyPersonProxy.objects.create(name=u"pebbles")
+MyPersonProxy pre save
+MyPersonProxy post save
+
 # A proxy has the same content type as the model it is 

[Changeset] r11000 - in django/branches/soc2009/http-wsgi-improvements: django/db/models/fields tests/modeltests/custom_pk

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:30:05 -0500 (Fri, 12 Jun 2009)
New Revision: 11000

Added:
   
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/custom_pk/fields.py
Modified:
   
django/branches/soc2009/http-wsgi-improvements/django/db/models/fields/related.py
   
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/custom_pk/models.py
Log:
Fixed #10785 -- Corrected a case for foreign key lookup where the related 
object is a custom primary key. Thanks to Alex Gaynor for the patch.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/fields/related.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/db/models/fields/related.py
   2009-06-13 03:29:52 UTC (rev 10999)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/db/models/fields/related.py
   2009-06-13 03:30:05 UTC (rev 11000)
@@ -132,12 +132,13 @@
 v, field = getattr(v, v._meta.pk.name), v._meta.pk
 except AttributeError:
 pass
-if field:
-if lookup_type in ('range', 'in'):
-v = [v]
-v = field.get_db_prep_lookup(lookup_type, v)
-if isinstance(v, list):
-v = v[0]
+if not field:
+field = self.rel.get_related_field()
+if lookup_type in ('range', 'in'):
+v = [v]
+v = field.get_db_prep_lookup(lookup_type, v)
+if isinstance(v, list):
+v = v[0]
 return v
 
 if hasattr(value, 'as_sql') or hasattr(value, '_as_sql'):
@@ -958,4 +959,3 @@
 # A ManyToManyField is not represented by a single column,
 # so return None.
 return None
-

Added: 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/custom_pk/fields.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/custom_pk/fields.py
 (rev 0)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/custom_pk/fields.py
 2009-06-13 03:30:05 UTC (rev 11000)
@@ -0,0 +1,54 @@
+import random
+import string
+
+from django.db import models
+
+class MyWrapper(object):
+def __init__(self, value):
+self.value = value
+
+def __repr__(self):
+return "<%s: %s>" % (self.__class__.__name__, self.value)
+
+def __unicode__(self):
+return self.value
+
+def __eq__(self, other):
+if isinstance(other, self.__class__):
+return self.value == other.value
+return self.value == other
+
+class MyAutoField(models.CharField):
+__metaclass__ = models.SubfieldBase
+
+def __init__(self, *args, **kwargs):
+kwargs['max_length'] = 10
+super(MyAutoField, self).__init__(*args, **kwargs)
+
+def pre_save(self, instance, add):
+value = getattr(instance, self.attname, None)
+if not value:
+value = MyWrapper(''.join(random.sample(string.lowercase, 10)))
+setattr(instance, self.attname, value)
+return value
+
+def to_python(self, value):
+if not value:
+return
+if not isinstance(value, MyWrapper):
+value = MyWrapper(value)
+return value
+
+def get_db_prep_save(self, value):
+if not value:
+return
+if isinstance(value, MyWrapper):
+return unicode(value)
+return value
+
+def get_db_prep_value(self, value):
+if not value:
+return
+if isinstance(value, MyWrapper):
+return unicode(value)
+return value

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/custom_pk/models.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/custom_pk/models.py
 2009-06-13 03:29:52 UTC (rev 10999)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/custom_pk/models.py
 2009-06-13 03:30:05 UTC (rev 11000)
@@ -9,6 +9,8 @@
 from django.conf import settings
 from django.db import models, transaction, IntegrityError
 
+from fields import MyAutoField
+
 class Employee(models.Model):
 employee_code = models.IntegerField(primary_key=True, db_column = 'code')
 first_name = models.CharField(max_length=20)
@@ -28,6 +30,16 @@
 def __unicode__(self):
 return self.name
 
+class Bar(models.Model):
+id = MyAutoField(primary_key=True, db_index=True)
+
+def __unicode__(self):
+return repr(self.pk)
+
+
+class Foo(models.Model):
+bar = models.ForeignKey(Bar)
+
 __test__ = {'API_TESTS':"""
 >>> dan = Employee(employee_code=123, first_name='Dan', last_name='Jones')
 >>> dan.save()
@@ -121,6 +133,21 @@
 ...print "Fail with %s" % type(e)
 Pass
 
+# Regression for #10785 -- Custom fields can 

[Changeset] r10999 - django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:29:52 -0500 (Fri, 12 Jun 2009)
New Revision: 10999

Modified:
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries/models.py
Log:
Fixed #11274 -- Corrected doctests to not cause test failures due to missing 
newlines. Thanks Honza Kral.

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries/models.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries/models.py
  2009-06-13 03:29:43 UTC (rev 10998)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries/models.py
  2009-06-13 03:29:52 UTC (rev 10999)
@@ -1151,6 +1151,7 @@
 >>> qs = Author.objects.filter(pk__in=subq)
 >>> list(qs)
 [, ]
+
 # The subquery result cache should not be populated
 >>> subq._result_cache is None
 True
@@ -1159,6 +1160,7 @@
 >>> qs = Author.objects.exclude(pk__in=subq)
 >>> list(qs)
 [, ]
+
 # The subquery result cache should not be populated
 >>> subq._result_cache is None
 True
@@ -1166,6 +1168,7 @@
 >>> subq = Author.objects.filter(num__lt=3000)
 >>> list(Author.objects.filter(Q(pk__in=subq) & Q(name='a1')))
 []
+
 # The subquery result cache should not be populated
 >>> subq._result_cache is None
 True


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10998 - django/branches/soc2009/http-wsgi-improvements/django/contrib/admin/templates/admin

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:29:43 -0500 (Fri, 12 Jun 2009)
New Revision: 10998

Modified:
   
django/branches/soc2009/http-wsgi-improvements/django/contrib/admin/templates/admin/pagination.html
Log:
Fixed #11271 -- Added a translation marker for the list_editable save button. 
Thanks to dc for the report.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/contrib/admin/templates/admin/pagination.html
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/contrib/admin/templates/admin/pagination.html
 2009-06-13 03:29:32 UTC (rev 10997)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/contrib/admin/templates/admin/pagination.html
 2009-06-13 03:29:43 UTC (rev 10998)
@@ -8,5 +8,5 @@
 {% endif %}
 {{ cl.result_count }} {% ifequal cl.result_count 1 %}{{ cl.opts.verbose_name 
}}{% else %}{{ cl.opts.verbose_name_plural }}{% endifequal %}
 {% if show_all_url %}{% trans 'Show all' %}{% endif %}
-{% if cl.formset and cl.result_count %}{% endif %}
+{% if cl.formset and cl.result_count %}{% endif %}
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10997 - in django/branches/soc2009/http-wsgi-improvements: django/db/models django/db/models/sql tests/regressiontests/queries

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:29:32 -0500 (Fri, 12 Jun 2009)
New Revision: 10997

Modified:
   django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
   django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries/models.py
Log:
Fixed #11082 -- Ensured that subqueries used in an exclude(X__in=) clause 
aren't pre-evaluated. Thanks to Henry Andrews for the report, and clement for 
the fix.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
===
--- django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
2009-06-13 03:29:17 UTC (rev 10996)
+++ django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
2009-06-13 03:29:32 UTC (rev 10997)
@@ -7,6 +7,8 @@
 except NameError:
 from sets import Set as set # Python 2.3 fallback
 
+from copy import deepcopy
+
 from django.db import connection, transaction, IntegrityError
 from django.db.models.aggregates import Aggregate
 from django.db.models.fields import DateField
@@ -40,6 +42,17 @@
 # PYTHON MAGIC METHODS #
 
 
+def __deepcopy__(self, memo):
+"""
+Deep copy of a QuerySet doesn't populate the cache
+"""
+obj_dict = deepcopy(self.__dict__, memo)
+obj_dict['_iter'] = None
+
+obj = self.__class__()
+obj.__dict__.update(obj_dict)
+return obj
+
 def __getstate__(self):
 """
 Allows the QuerySet to be pickled.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
2009-06-13 03:29:17 UTC (rev 10996)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
2009-06-13 03:29:32 UTC (rev 10997)
@@ -1625,10 +1625,14 @@
 entry.negate()
 self.where.add(entry, AND)
 break
-elif not (lookup_type == 'in' and not value) and field.null:
+elif not (lookup_type == 'in'
+and not hasattr(value, 'as_sql')
+and not hasattr(value, '_as_sql')
+and not value) and field.null:
 # Leaky abstraction artifact: We have to specifically
 # exclude the "foo__in=[]" case from this handling, because
 # it's short-circuited in the Where class.
+# We also need to handle the case where a subquery is 
provided
 entry = self.where_class()
 entry.add((Constraint(alias, col, None), 'isnull', True), 
AND)
 entry.negate()

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries/models.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries/models.py
  2009-06-13 03:29:17 UTC (rev 10996)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/queries/models.py
  2009-06-13 03:29:32 UTC (rev 10997)
@@ -1143,6 +1143,33 @@
 >>> r.save()
 >>> Ranking.objects.all()
 [, , ]
+
+# Regression test for #10742:
+# Queries used in an __in clause don't execute subqueries
+
+>>> subq = Author.objects.filter(num__lt=3000)
+>>> qs = Author.objects.filter(pk__in=subq)
+>>> list(qs)
+[, ]
+# The subquery result cache should not be populated
+>>> subq._result_cache is None
+True
+
+>>> subq = Author.objects.filter(num__lt=3000)
+>>> qs = Author.objects.exclude(pk__in=subq)
+>>> list(qs)
+[, ]
+# The subquery result cache should not be populated
+>>> subq._result_cache is None
+True
+
+>>> subq = Author.objects.filter(num__lt=3000)
+>>> list(Author.objects.filter(Q(pk__in=subq) & Q(name='a1')))
+[]
+# The subquery result cache should not be populated
+>>> subq._result_cache is None
+True
+
 """}
 
 # In Python 2.3 and the Python 2.6 beta releases, exceptions raised in __len__


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10996 - django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/defer_regress

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:29:17 -0500 (Fri, 12 Jun 2009)
New Revision: 10996

Modified:
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/defer_regress/models.py
Log:
Fixed #10733 -- Added a regression test for queries with multiple references to 
multiple foreign keys in only() clauses. Thanks to mrts for the report.

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/defer_regress/models.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/defer_regress/models.py
2009-06-13 03:29:07 UTC (rev 10995)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/defer_regress/models.py
2009-06-13 03:29:17 UTC (rev 10996)
@@ -84,7 +84,8 @@
 (regression for #10710).
 
 >>> c1 = Child.objects.create(name="c1", value=42)
->>> obj = Leaf.objects.create(name="l1", child=c1)
+>>> c2 = Child.objects.create(name="c2", value=37)
+>>> obj = Leaf.objects.create(name="l1", child=c1, second_child=c2)
 
 >>> obj = Leaf.objects.only("name", "child").select_related()[0]
 >>> obj.child.name
@@ -101,5 +102,24 @@
 >>> c1 is c2 is c3
 True
 
+# Regression for #10733 - only() can be used on a model with two foreign keys.
+>>> results = Leaf.objects.all().only('name', 'child', 
'second_child').select_related()
+>>> results[0].child.name
+u'c1'
+>>> results[0].second_child.name
+u'c2'
+
+>>> results = Leaf.objects.all().only('name', 'child', 'second_child', 
'child__name', 'second_child__name').select_related()
+>>> results[0].child.name
+u'c1'
+>>> results[0].second_child.name
+u'c2'
+
+# Finally, we need to flush the app cache for the defer module.
+# Using only/defer creates some artifical entries in the app cache
+# that messes up later tests. Purge all entries, just to be sure.
+>>> from django.db.models.loading import cache
+>>> cache.app_models['defer_regress'] = {}
+
 """
 }


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10995 - in django/branches/soc2009/http-wsgi-improvements: django/db/models django/db/models/sql tests/modeltests/defer

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:29:07 -0500 (Fri, 12 Jun 2009)
New Revision: 10995

Modified:
   django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
   django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
   
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/defer/models.py
Log:
Fixed #10572 -- Corrected the operation of the defer() and only() clauses when 
used on inherited models.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
===
--- django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
2009-06-13 03:28:54 UTC (rev 10994)
+++ django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
2009-06-13 03:29:07 UTC (rev 10995)
@@ -190,7 +190,25 @@
 index_start = len(extra_select)
 aggregate_start = index_start + len(self.model._meta.fields)
 
-load_fields = only_load.get(self.model)
+load_fields = []
+# If only/defer clauses have been specified,
+# build the list of fields that are to be loaded.
+if only_load:
+for field, model in self.model._meta.get_fields_with_model():
+if model is None:
+model = self.model
+if field == self.model._meta.pk:
+# Record the index of the primary key when it is found
+pk_idx = len(load_fields)
+try:
+if field.name in only_load[model]:
+# Add a field that has been explicitly included
+load_fields.append(field.name)
+except KeyError:
+# Model wasn't explicitly listed in the only_load table
+# Therefore, we need to load all fields from this model
+load_fields.append(field.name)
+
 skip = None
 if load_fields and not fill_cache:
 # Some fields have been deferred, so we have to initialise

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
2009-06-13 03:28:54 UTC (rev 10994)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
2009-06-13 03:29:07 UTC (rev 10995)
@@ -635,10 +635,10 @@
 # models.
 workset = {}
 for model, values in seen.iteritems():
-for field, f_model in model._meta.get_fields_with_model():
+for field in model._meta.local_fields:
 if field in values:
 continue
-add_to_dict(workset, f_model or model, field)
+add_to_dict(workset, model, field)
 for model, values in must_include.iteritems():
 # If we haven't included a model in workset, we don't add the
 # corresponding must_include fields for that model, since an
@@ -657,6 +657,12 @@
 # included any fields, we have to make sure it's mentioned
 # so that only the "must include" fields are pulled in.
 seen[model] = values
+# Now ensure that every model in the inheritance chain is mentioned
+# in the parent list. Again, it must be mentioned to ensure that
+# only "must include" fields are pulled in.
+for model in orig_opts.get_parent_list():
+if model not in seen:
+seen[model] = set()
 for model, values in seen.iteritems():
 callback(target, model, values)
 

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/defer/models.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/defer/models.py 
2009-06-13 03:28:54 UTC (rev 10994)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/defer/models.py 
2009-06-13 03:29:07 UTC (rev 10995)
@@ -17,6 +17,12 @@
 def __unicode__(self):
 return self.name
 
+class Child(Primary):
+pass
+
+class BigChild(Primary):
+other = models.CharField(max_length=50)
+
 def count_delayed_fields(obj, debug=False):
 """
 Returns the number of delayed attributes on the given model instance.
@@ -33,7 +39,7 @@
 
 __test__ = {"API_TEST": """
 To all outward appearances, instances with deferred fields look the same as
-normal instances when we examine attribut values. Therefore we test for the
+normal instances when we examine attribute values. Therefore we test for the
 number of deferred fields on returned instances (by poking at the internals),
 as a way to observe what is going on.
 
@@ -98,5 +104,89 @@
 >>> 

[Changeset] r10994 - in django/branches/soc2009/http-wsgi-improvements: django/db/models tests/regressiontests tests/regressiontests/delete_regress

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:28:54 -0500 (Fri, 12 Jun 2009)
New Revision: 10994

Added:
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/__init__.py
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/models.py
Modified:
   django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
   
django/branches/soc2009/http-wsgi-improvements/django/db/models/query_utils.py
Log:
Fixed #9479 -- Corrected an edge case in bulk queryset deletion that could 
cause an infinite loop when using MySQL InnoDB.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
===
--- django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
2009-06-13 03:28:41 UTC (rev 10993)
+++ django/branches/soc2009/http-wsgi-improvements/django/db/models/query.py
2009-06-13 03:28:54 UTC (rev 10994)
@@ -355,10 +355,11 @@
 
 # Delete objects in chunks to prevent the list of related objects from
 # becoming too long.
+seen_objs = None
 while 1:
 # Collect all the objects to be deleted in this chunk, and all the
 # objects that are related to the objects that are to be deleted.
-seen_objs = CollectedObjects()
+seen_objs = CollectedObjects(seen_objs)
 for object in del_query[:CHUNK_SIZE]:
 object._collect_sub_objects(seen_objs)
 

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/query_utils.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/db/models/query_utils.py  
2009-06-13 03:28:41 UTC (rev 10993)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/db/models/query_utils.py  
2009-06-13 03:28:54 UTC (rev 10994)
@@ -32,11 +32,21 @@
 
 This is used for the database object deletion routines so that we can
 calculate the 'leaf' objects which should be deleted first.
+
+previously_seen is an optional argument. It must be a CollectedObjects
+instance itself; any previously_seen collected object will be blocked from
+being added to this instance.
 """
 
-def __init__(self):
+def __init__(self, previously_seen=None):
 self.data = {}
 self.children = {}
+if previously_seen:
+self.blocked = previously_seen.blocked
+for cls, seen in previously_seen.data.items():
+self.blocked.setdefault(cls, SortedDict()).update(seen)
+else:
+self.blocked = {}
 
 def add(self, model, pk, obj, parent_model, nullable=False):
 """
@@ -53,6 +63,9 @@
 Returns True if the item already existed in the structure and
 False otherwise.
 """
+if pk in self.blocked.get(model, {}):
+return True
+
 d = self.data.setdefault(model, SortedDict())
 retval = pk in d
 d[pk] = obj

Added: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/__init__.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/__init__.py
 (rev 0)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/__init__.py
 2009-06-13 03:28:54 UTC (rev 10994)
@@ -0,0 +1 @@
+

Added: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/models.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/models.py
   (rev 0)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/delete_regress/models.py
   2009-06-13 03:28:54 UTC (rev 10994)
@@ -0,0 +1,61 @@
+from django.conf import settings
+from django.db import models, backend, connection, transaction
+from django.db.models import sql, query
+from django.test import TransactionTestCase
+
+class Book(models.Model):
+pagecount = models.IntegerField()
+
+# Can't run this test under SQLite, because you can't
+# get two connections to an in-memory database.
+if settings.DATABASE_ENGINE != 'sqlite3':
+class DeleteLockingTest(TransactionTestCase):
+def setUp(self):
+# Create a second connection to the database
+self.conn2 = backend.DatabaseWrapper({
+'DATABASE_HOST': settings.DATABASE_HOST,
+'DATABASE_NAME': settings.DATABASE_NAME,
+'DATABASE_OPTIONS': settings.DATABASE_OPTIONS,
+'DATABASE_PASSWORD': settings.DATABASE_PASSWORD,
+'DATABASE_PORT': settings.DATABASE_PORT,
+

[Changeset] r10993 - in django/branches/soc2009/http-wsgi-improvements/django/contrib/gis: db/models/sql tests/relatedapp

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:28:41 -0500 (Fri, 12 Jun 2009)
New Revision: 10993

Modified:
   
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/db/models/sql/where.py
   
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/tests/relatedapp/models.py
   
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/tests/relatedapp/tests.py
Log:
Fixed #11087 -- Fixed the `Count` annotation when used with `GeoManager`.  
Thanks to dgouldin for ticket and initial patch.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/db/models/sql/where.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/db/models/sql/where.py
2009-06-13 03:28:25 UTC (rev 10992)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/db/models/sql/where.py
2009-06-13 03:28:41 UTC (rev 10993)
@@ -35,7 +35,7 @@
 return super(WhereNode, self).add(data, connector)
 
 obj, lookup_type, value = data
-alias, col, field = obj.alias, obj.col, obj.field
+col, field = obj.col, obj.field
 
 if not hasattr(field, "geom_type"):
 # Not a geographic field, so call `WhereNode.add`.
@@ -76,7 +76,7 @@
 # the `get_geo_where_clause` to construct the appropriate
 # spatial SQL when `make_atom` is called.
 annotation = GeoAnnotation(field, value, where)
-return super(WhereNode, self).add(((alias, col, field.db_type()), 
lookup_type, annotation, params), connector)
+return super(WhereNode, self).add(((obj.alias, col, 
field.db_type()), lookup_type, annotation, params), connector)
 
 def make_atom(self, child, qn):
 obj, lookup_type, value_annot, params = child

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/tests/relatedapp/models.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/tests/relatedapp/models.py
2009-06-13 03:28:25 UTC (rev 10992)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/tests/relatedapp/models.py
2009-06-13 03:28:41 UTC (rev 10993)
@@ -32,3 +32,13 @@
 border2 = models.PolygonField(srid=2276)
 objects = models.GeoManager()
 def __unicode__(self): return self.name
+
+# These use the GeoManager but do not have any geographic fields.
+class Author(models.Model):
+name = models.CharField(max_length=100)
+objects = models.GeoManager()
+
+class Book(models.Model):
+title = models.CharField(max_length=100)
+author = models.ForeignKey(Author, related_name='books')
+objects = models.GeoManager()

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/tests/relatedapp/tests.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/tests/relatedapp/tests.py
 2009-06-13 03:28:25 UTC (rev 10992)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/tests/relatedapp/tests.py
 2009-06-13 03:28:41 UTC (rev 10993)
@@ -1,10 +1,10 @@
 import os, unittest
 from django.contrib.gis.geos import *
 from django.contrib.gis.db.backend import SpatialBackend
-from django.contrib.gis.db.models import F, Extent, Union
+from django.contrib.gis.db.models import Count, Extent, F, Union
 from django.contrib.gis.tests.utils import no_mysql, no_oracle, no_spatialite
 from django.conf import settings
-from models import City, Location, DirectoryEntry, Parcel
+from models import City, Location, DirectoryEntry, Parcel, Book, Author
 
 cities = (('Aurora', 'TX', -97.516111, 33.058333),
   ('Roswell', 'NM', -104.528056, 33.387222),
@@ -196,8 +196,8 @@
 # ID values do not match their City ID values.
 loc1 = Location.objects.create(point='POINT (-95.363151 29.763374)')
 loc2 = Location.objects.create(point='POINT (-96.801611 32.782057)')
-dallas = City.objects.create(name='Dallas', location=loc2)
-houston = City.objects.create(name='Houston', location=loc1)
+dallas = City.objects.create(name='Dallas', state='TX', location=loc2)
+houston = City.objects.create(name='Houston', state='TX', 
location=loc1)
 
 # The expected ID values -- notice the last two location IDs
 # are out of order.  We want to make sure that the related
@@ -231,6 +231,32 @@
 q = pickle.loads(q_str)
 self.assertEqual(GeoQuery, q.__class__)
 
+def test12_count(self):
+"Testing `Count` aggregate use with the `GeoManager`. See #11087."
+# Creating a new City, 'Fort Worth', that uses the same location
+# as Dallas.
+dallas = City.objects.get(name='Dallas')
+ftworth = City.objects.create(name='Fort Worth', state='TX', 
location=dallas.location)
+
+# Count 

[Changeset] r10992 - django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:28:25 -0500 (Fri, 12 Jun 2009)
New Revision: 10992

Modified:
   
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google/gmap.py
   
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google/overlays.py
Log:
Fixed #11200 -- Now use a `set` data structure for `GoogleMap` icons so that 
they aren't repeated in rendered JavaScript.  Thanks to ludifan for ticket and 
initial patch.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google/gmap.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google/gmap.py
   2009-06-13 03:28:14 UTC (rev 10991)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google/gmap.py
   2009-06-13 03:28:25 UTC (rev 10992)
@@ -143,7 +143,7 @@
 @property
 def icons(self):
 "Returns a sequence of GIcon objects in this map."
-return [marker.icon for marker in self.markers if marker.icon]
+return set([marker.icon for marker in self.markers if marker.icon])
 
 class GoogleMapSet(GoogleMap):
 
@@ -221,6 +221,6 @@
 @property
 def icons(self):
 "Returns a sequence of all icons in each map of the set."
-icons = []
-for map in self.maps: icons.extend(map.icons)
+icons = set()
+for map in self.maps: icons |= map.icons
 return icons

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google/overlays.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google/overlays.py
   2009-06-13 03:28:14 UTC (rev 10991)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/maps/google/overlays.py
   2009-06-13 03:28:25 UTC (rev 10992)
@@ -231,6 +231,14 @@
 self.iconanchor = iconanchor
 self.infowindowanchor = infowindowanchor
 
+def __cmp__(self, other):
+return cmp(self.varname, other.varname)
+
+def __hash__(self):
+# XOR with hash of GIcon type so that hash('varname') won't 
+# equal hash(GIcon('varname')).
+return hash(self.__class__) ^ hash(self.varname)
+
 class GMarker(GOverlayBase):
 """
 A Python wrapper for the Google GMarker object.  For more information


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10991 - in django/branches/soc2009/http-wsgi-improvements: django/forms tests/regressiontests/admin_scripts tests/regressiontests/file_storage

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:28:14 -0500 (Fri, 12 Jun 2009)
New Revision: 10991

Modified:
   django/branches/soc2009/http-wsgi-improvements/django/forms/models.py
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/admin_scripts/tests.py
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/file_storage/tests.py
Log:
Fixed a few Python 2.3 incompatibilities that were causing test failures.

Modified: django/branches/soc2009/http-wsgi-improvements/django/forms/models.py
===
--- django/branches/soc2009/http-wsgi-improvements/django/forms/models.py   
2009-06-13 03:28:00 UTC (rev 10990)
+++ django/branches/soc2009/http-wsgi-improvements/django/forms/models.py   
2009-06-13 03:28:14 UTC (rev 10991)
@@ -584,7 +584,7 @@
 else:
 return ugettext("Please correct the duplicate data for %(field)s, "
 "which must be unique.") % {
-"field": get_text_list(unique_check, _("and")),
+"field": get_text_list(unique_check, unicode(_("and"))),
 }
 
 def get_date_error_message(self, date_check):

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/admin_scripts/tests.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/admin_scripts/tests.py
 2009-06-13 03:28:00 UTC (rev 10990)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/admin_scripts/tests.py
 2009-06-13 03:28:14 UTC (rev 10991)
@@ -536,7 +536,7 @@
 args = ['startapp','settings_test']
 out, err = self.run_django_admin(args,'settings')
 self.assertNoOutput(err)
-self.assertTrue(os.path.exists(os.path.join(test_dir, 
'settings_test')))
+self.assert_(os.path.exists(os.path.join(test_dir, 'settings_test')))
 shutil.rmtree(os.path.join(test_dir, 'settings_test'))
 
 def test_builtin_command(self):

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/file_storage/tests.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/file_storage/tests.py
  2009-06-13 03:28:00 UTC (rev 10990)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/file_storage/tests.py
  2009-06-13 03:28:14 UTC (rev 10991)
@@ -161,9 +161,9 @@
 self.storage.save('dotted.path/test', ContentFile("1"))
 self.storage.save('dotted.path/test', ContentFile("2"))
 
-self.assertFalse(os.path.exists(os.path.join(self.storage_dir, 
'dotted_.path')))
-self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/test')))
-self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/test_')))
+self.failIf(os.path.exists(os.path.join(self.storage_dir, 
'dotted_.path')))
+self.assert_(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/test')))
+self.assert_(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/test_')))
 
 def test_first_character_dot(self):
 """
@@ -173,13 +173,13 @@
 self.storage.save('dotted.path/.test', ContentFile("1"))
 self.storage.save('dotted.path/.test', ContentFile("2"))
 
-self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/.test')))
+self.assert_(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/.test')))
 # Before 2.6, a leading dot was treated as an extension, and so
 # underscore gets added to beginning instead of end.
 if sys.version_info < (2, 6):
-self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/_.test')))
+self.assert_(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/_.test')))
 else:
-self.assertTrue(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/.test_')))
+self.assert_(os.path.exists(os.path.join(self.storage_dir, 
'dotted.path/.test_')))
 
 if Image is not None:
 class DimensionClosingBug(TestCase):


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10990 - in django/branches/soc2009/http-wsgi-improvements/django: contrib/gis/utils db/models/sql

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:28:00 -0500 (Fri, 12 Jun 2009)
New Revision: 10990

Modified:
   
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/utils/ogrinspect.py
   django/branches/soc2009/http-wsgi-improvements/django/db/models/sql/query.py
Log:
Fixed #11216 and #11218 -- Corrected a few typos, thanks buriy.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/utils/ogrinspect.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/utils/ogrinspect.py
   2009-06-13 03:27:48 UTC (rev 10989)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/contrib/gis/utils/ogrinspect.py
   2009-06-13 03:28:00 UTC (rev 10990)
@@ -12,12 +12,12 @@
 
 def mapping(data_source, geom_name='geom', layer_key=0, multi_geom=False):
 """
-Given a DataSource, generates a dictionary that may be used 
+Given a DataSource, generates a dictionary that may be used
 for invoking the LayerMapping utility.
 
 Keyword Arguments:
  `geom_name` => The name of the geometry field to use for the model.
- 
+
  `layer_key` => The key for specifying which layer in the DataSource to 
use;
defaults to 0 (the first layer).  May be an integer index or a string
identifier for the layer.
@@ -31,7 +31,7 @@
 pass
 else:
 raise TypeError('Data source parameter must be a string or a 
DataSource object.')
-
+
 # Creating the dictionary.
 _mapping = {}
 
@@ -52,32 +52,32 @@
 model name this function will generate a GeoDjango model.
 
 Usage:
-
+
 >>> from django.contrib.gis.utils import ogrinspect
 >>> ogrinspect('/path/to/shapefile.shp','NewModel')
-
+
 ...will print model definition to stout
-
+
 or put this in a python script and use to redirect the output to a new
 model like:
-
+
 $ python generate_model.py > myapp/models.py
-
-# generate_model.py 
+
+# generate_model.py
 from django.contrib.gis.utils import ogrinspect
 shp_file = 'data/mapping_hacks/world_borders.shp'
 model_name = 'WorldBorders'
 
 print ogrinspect(shp_file, model_name, multi_geom=True, srid=4326,
  geom_name='shapes', blank=True)
- 
+
 Required Arguments
  `datasource` => string or DataSource object to file pointer
- 
+
  `model name` => string of name of new model class to create
-  
+
 Optional Keyword Arguments
- `geom_name` => For specifying the model name for the Geometry Field. 
+ `geom_name` => For specifying the model name for the Geometry Field.
Otherwise will default to `geom`
 
  `layer_key` => The key for specifying which layer in the DataSource to 
use;
@@ -86,24 +86,24 @@
 
  `srid` => The SRID to use for the Geometry Field.  If it can be 
determined,
the SRID of the datasource is used.
-  
+
  `multi_geom` => Boolean (default: False) - specify as multigeometry.
- 
+
  `name_field` => String - specifies a field name to return for the
`__unicode__` function (which will be generated if specified).
- 
- `imports` => Boolean (default: True) - set to False to omit the 
-   `from django.contrib.gis.db import models` code from the 
+
+ `imports` => Boolean (default: True) - set to False to omit the
+   `from django.contrib.gis.db import models` code from the
autogenerated models thus avoiding duplicated imports when building
more than one model by batching ogrinspect()
- 
+
  `decimal` => Boolean or sequence (default: False).  When set to True
all generated model fields corresponding to the `OFTReal` type will
be `DecimalField` instead of `FloatField`.  A sequence of specific
field names to generate as `DecimalField` may also be used.
 
  `blank` => Boolean or sequence (default: False).  When set to True all
-   generated model fields will have `blank=True`.  If the user wants to 
+   generated model fields will have `blank=True`.  If the user wants to
give specific fields to have blank, then a list/tuple of OGR field
names may be used.
 
@@ -111,13 +111,13 @@
model fields will have `null=True`.  If the user wants to specify
give specific fields to have null, then a list/tuple of OGR field
names may be used.
- 
+
 Note: This routine calls the _ogrinspect() helper to do the heavy lifting.
 """
 return '\n'.join(s for s in _ogrinspect(*args, **kwargs))
 
 def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, 
srid=None,
-multi_geom=False, name_field=None, imports=True, 
+multi_geom=False, name_field=None, imports=True,
 decimal=False, blank=False, null=False):
 """
 Helper routine for `ogrinspect` that generates GeoDjango models 
corresponding
@@ -140,7 

[Changeset] r10989 - django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:27:48 -0500 (Fri, 12 Jun 2009)
New Revision: 10989

Modified:
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/imagefield.py
Log:
Added test for pickling of a model with an `ImageField`, refs #11103.

Modified: 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/imagefield.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/imagefield.py
 2009-06-13 03:27:38 UTC (rev 10988)
+++ 
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/imagefield.py
 2009-06-13 03:27:48 UTC (rev 10989)
@@ -150,7 +150,24 @@
 _ = p.mugshot.size
 self.assertEqual(p.mugshot.closed, True)
 
+def test_pickle(self):
+"""
+Tests that ImageField can be pickled, unpickled, and that the
+image of the unpickled version is the same as the original.
+"""
+import pickle
 
+p = Person(name="Joe")
+p.mugshot.save("mug", self.file1)
+dump = pickle.dumps(p)
+
+p2 = Person(name="Bob")
+p2.mugshot = self.file1
+
+loaded_p = pickle.loads(dump)
+self.assertEqual(p.mugshot, loaded_p.mugshot)
+
+
 class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase):
 """
 Tests behavior of an ImageField and its dimensions fields.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10988 - django/branches/soc2009/http-wsgi-improvements/django/conf/locale/es_AR/LC_MESSAGES

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:27:38 -0500 (Fri, 12 Jun 2009)
New Revision: 10988

Modified:
   
django/branches/soc2009/http-wsgi-improvements/django/conf/locale/es_AR/LC_MESSAGES/django.mo
   
django/branches/soc2009/http-wsgi-improvements/django/conf/locale/es_AR/LC_MESSAGES/django.po
Log:
Updated Argentinian spanish translation, 100% complete as of r10858.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/conf/locale/es_AR/LC_MESSAGES/django.mo
===
(Binary files differ)

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/conf/locale/es_AR/LC_MESSAGES/django.po
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/conf/locale/es_AR/LC_MESSAGES/django.po
   2009-06-13 03:27:25 UTC (rev 10987)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/conf/locale/es_AR/LC_MESSAGES/django.po
   2009-06-13 03:27:38 UTC (rev 10988)
@@ -6,8 +6,8 @@
 msgstr ""
 "Project-Id-Version: Django\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-11-13 18:20-0200\n"
-"PO-Revision-Date: 2008-11-13 18:27-0200\n"
+"POT-Creation-Date: 2009-05-28 12:30-0300\n"
+"PO-Revision-Date: 2009-05-05 20:35-0300\n"
 "Last-Translator: Ramiro Morales \n"
 "Language-Team: Django-I18N \n"
 "MIME-Version: 1.0\n"
@@ -100,121 +100,139 @@
 msgstr "hebreo"
 
 #: conf/global_settings.py:65
+msgid "Hindi"
+msgstr "Hindi"
+
+#: conf/global_settings.py:66
 msgid "Croatian"
 msgstr "croata"
 
-#: conf/global_settings.py:66
+#: conf/global_settings.py:67
 msgid "Icelandic"
 msgstr "islandés"
 
-#: conf/global_settings.py:67
+#: conf/global_settings.py:68
 msgid "Italian"
 msgstr "italiano"
 
-#: conf/global_settings.py:68
+#: conf/global_settings.py:69
 msgid "Japanese"
 msgstr "japonés"
 
-#: conf/global_settings.py:69
+#: conf/global_settings.py:70
 msgid "Georgian"
 msgstr "georgiano"
 
-#: conf/global_settings.py:70
+#: conf/global_settings.py:71
 msgid "Korean"
 msgstr "koreano"
 
-#: conf/global_settings.py:71
+#: conf/global_settings.py:72
 msgid "Khmer"
 msgstr "jémer"
 
-#: conf/global_settings.py:72
+#: conf/global_settings.py:73
 msgid "Kannada"
 msgstr "canarés"
 
-#: conf/global_settings.py:73
+#: conf/global_settings.py:74
 msgid "Latvian"
 msgstr "letón"
 
-#: conf/global_settings.py:74
+#: conf/global_settings.py:75
 msgid "Lithuanian"
 msgstr "lituano"
 
-#: conf/global_settings.py:75
+#: conf/global_settings.py:76
 msgid "Macedonian"
 msgstr "macedonio"
 
-#: conf/global_settings.py:76
+#: conf/global_settings.py:77
 msgid "Dutch"
 msgstr "holandés"
 
-#: conf/global_settings.py:77
+#: conf/global_settings.py:78
 msgid "Norwegian"
 msgstr "noruego"
 
-#: conf/global_settings.py:78
+#: conf/global_settings.py:79
 msgid "Polish"
 msgstr "polaco"
 
-#: conf/global_settings.py:79
+#: conf/global_settings.py:80
 msgid "Portuguese"
 msgstr "portugués"
 
-#: conf/global_settings.py:80
+#: conf/global_settings.py:81
 msgid "Brazilian Portuguese"
 msgstr "portugués de Brasil"
 
-#: conf/global_settings.py:81
+#: conf/global_settings.py:82
 msgid "Romanian"
 msgstr "rumano"
 
-#: conf/global_settings.py:82
+#: conf/global_settings.py:83
 msgid "Russian"
 msgstr "ruso"
 
-#: conf/global_settings.py:83
+#: conf/global_settings.py:84
 msgid "Slovak"
 msgstr "eslovaco"
 
-#: conf/global_settings.py:84
+#: conf/global_settings.py:85
 msgid "Slovenian"
 msgstr "esloveno"
 
-#: conf/global_settings.py:85
+#: conf/global_settings.py:86
 msgid "Serbian"
 msgstr "serbio"
 
-#: conf/global_settings.py:86
+#: conf/global_settings.py:87
 msgid "Swedish"
 msgstr "sueco"
 
-#: conf/global_settings.py:87
+#: conf/global_settings.py:88
 msgid "Tamil"
 msgstr "tamil"
 
-#: conf/global_settings.py:88
+#: conf/global_settings.py:89
 msgid "Telugu"
 msgstr "telugu"
 
-#: conf/global_settings.py:89
+#: conf/global_settings.py:90
 msgid "Thai"
 msgstr "tailandés"
 
-#: conf/global_settings.py:90
+#: conf/global_settings.py:91
 msgid "Turkish"
 msgstr "turco"
 
-#: conf/global_settings.py:91
+#: conf/global_settings.py:92
 msgid "Ukrainian"
 msgstr "ucraniano"
 
-#: conf/global_settings.py:92
+#: conf/global_settings.py:93
 msgid "Simplified Chinese"
 msgstr "chino simplificado"
 
-#: conf/global_settings.py:93
+#: conf/global_settings.py:94
 msgid "Traditional Chinese"
 msgstr "chino tradicional"
 
+#: contrib/admin/actions.py:60
+#, python-format
+msgid "Successfully deleted %(count)d %(items)s."
+msgstr "Se eliminaron con éxito %(count)d %(items)s."
+
+#: contrib/admin/actions.py:67 contrib/admin/options.py:1025
+msgid "Are you sure?"
+msgstr "¿Está seguro?"
+
+#: contrib/admin/actions.py:85
+#, python-format
+msgid "Delete selected %(verbose_name_plural)s"
+msgstr "Eliminar %(verbose_name_plural)s seleccionados/as"
+
 #: contrib/admin/filterspecs.py:44
 #, python-format
 msgid ""
@@ -224,43 +242,47 @@
 "Por %s:\n"
 "\n"
 
-#: 

[Changeset] r10987 - in django/branches/soc2009/http-wsgi-improvements: django/db/models/fields tests/modeltests/model_forms tests/regressiontests/file_storage tests/regressiontests/model_fields

2009-06-12 Thread noreply

Author: ccahoon
Date: 2009-06-12 22:27:25 -0500 (Fri, 12 Jun 2009)
New Revision: 10987

Added:
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/4x8.png
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/8x4.png
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/imagefield.py
Modified:
   
django/branches/soc2009/http-wsgi-improvements/django/db/models/fields/files.py
   
django/branches/soc2009/http-wsgi-improvements/tests/modeltests/model_forms/models.py
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/file_storage/models.py
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/models.py
   
django/branches/soc2009/http-wsgi-improvements/tests/regressiontests/model_fields/tests.py
Log:
Changes to `ImageFileDescriptor` and `ImageField` to fix a few cases of setting 
image dimension fields.
 * Moved dimension field update logic out of `ImageFileDescriptor.__set__` and 
into its own method on `ImageField`.
 * New `ImageField.update_dimension_fields` method is attached to model 
instance's `post_init` signal so that:
   * Dimension fields are set when defined before the ImageField.
   * Dimension fields are set when the field is assigned in the model 
constructor (fixes #11196), but only if the dimension fields don't already have 
values, so we avoid updating the dimensions every time an object is loaded from 
the database (fixes #11084).
 * Clear dimension fields when the ImageField is set to None, which also causes 
dimension fields to be cleared when `ImageFieldFile.delete()` is used.
 * Added many more tests for ImageField that test edge cases we weren't testing 
before, and moved the ImageField tests out of `file_storage` and into their own 
module within `model_fields`.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/db/models/fields/files.py
===
--- 
django/branches/soc2009/http-wsgi-improvements/django/db/models/fields/files.py 
2009-06-12 17:19:19 UTC (rev 10986)
+++ 
django/branches/soc2009/http-wsgi-improvements/django/db/models/fields/files.py 
2009-06-13 03:27:25 UTC (rev 10987)
@@ -142,13 +142,13 @@
 """
 The descriptor for the file attribute on the model instance. Returns a
 FieldFile when accessed so you can do stuff like::
-
+
 >>> instance.file.size
-
+
 Assigns a file object on assignment so you can do::
-
+
 >>> instance.file = File(...)
-
+
 """
 def __init__(self, field):
 self.field = field
@@ -156,9 +156,9 @@
 def __get__(self, instance=None, owner=None):
 if instance is None:
 raise AttributeError(
-"The '%s' attribute can only be accessed from %s instances." 
+"The '%s' attribute can only be accessed from %s instances."
 % (self.field.name, owner.__name__))
-
+
 # This is slightly complicated, so worth an explanation.
 # instance.file`needs to ultimately return some instance of `File`,
 # probably a subclass. Additionally, this returned object needs to have
@@ -168,8 +168,8 @@
 # peek below you can see that we're not. So depending on the current
 # value of the field we have to dynamically construct some sort of
 # "thing" to return.
-
-# The instance dict contains whatever was originally assigned 
+
+# The instance dict contains whatever was originally assigned
 # in __set__.
 file = instance.__dict__[self.field.name]
 
@@ -186,14 +186,14 @@
 
 # Other types of files may be assigned as well, but they need to have
 # the FieldFile interface added to the. Thus, we wrap any other type of
-# File inside a FieldFile (well, the field's attr_class, which is 
+# File inside a FieldFile (well, the field's attr_class, which is
 # usually FieldFile).
 elif isinstance(file, File) and not isinstance(file, FieldFile):
 file_copy = self.field.attr_class(instance, self.field, file.name)
 file_copy.file = file
 file_copy._committed = False
 instance.__dict__[self.field.name] = file_copy
-
+
 # Finally, because of the (some would say boneheaded) way pickle works,
 # the underlying FieldFile might not actually itself have an associated
 # file. So we need to reset the details of the FieldFile in those 
cases.
@@ -201,7 +201,7 @@
 file.instance = instance
 file.field = self.field
 file.storage = self.field.storage
-
+
 # That was fun, wasn't it?
 return instance.__dict__[self.field.name]
 
@@ -212,7 +212,7 @@
 # The class to wrap instance attributes in. Accessing the file object off
 # the instance will always 

Re: [Django] #11313: list_editable fields don't support 'save' in multiuser environment

2009-06-12 Thread Django
#11313: list_editable fields don't support 'save' in multiuser environment
---+
  Reporter:  margieroginski| Owner:  nobody
Status:  closed| Milestone:
 Component:  django.contrib.admin  |   Version:  1.1-beta-1
Resolution:  duplicate |  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by Alex):

  * status:  new => closed
  * resolution:  => duplicate

Comment:

 Marked as dupe because of above.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11313: list_editable fields don't support 'save' in multiuser environment

2009-06-12 Thread Django
#11313: list_editable fields don't support 'save' in multiuser environment
---+
  Reporter:  margieroginski| Owner:  nobody
Status:  new   | Milestone:
 Component:  django.contrib.admin  |   Version:  1.1-beta-1
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by margieroginski):

 Yes, I think you are right that this is a dup of 10922.  I looked at the
 patch and based on a quick review it looks like it will solve this
 problem.  So feel free to close this.

 Margie

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11313: list_editable fields don't support 'save' in multiuser environment

2009-06-12 Thread Django
#11313: list_editable fields don't support 'save' in multiuser environment
---+
  Reporter:  margieroginski| Owner:  nobody
Status:  new   | Milestone:
 Component:  django.contrib.admin  |   Version:  1.1-beta-1
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by ramiro):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 This seems to be a duplicate of (#10784 and) #10922.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #11313: list_editable fields don't support 'save' in multiuser environment

2009-06-12 Thread Django
#11313: list_editable fields don't support 'save' in multiuser environment
--+-
 Reporter:  margieroginski|   Owner:  nobody
   Status:  new   |   Milestone:
Component:  django.contrib.admin  | Version:  1.1-beta-1
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 I don't think that the list_editable fields concept in the admin, as
 implmemented in 1.1, works.  Imagine this:

  1. User 1 brings up a changelist for an object and orders it by a
 'deadline' field, most recent first, resulting in object 'foo' being shown
 as the most recent object
  2. User 2 edits object 'foo' and changes its deadline field so that it is
 no longer the most recent object
  3. User 1 still has the changelist form on his screen, and modifies the
 'name' field of object foo.  Then he hits 'save'.

 When the 'save' request from user 1 is processed, a queryset for the
 objects is created that is ordered by deadline.  However, the ordering of
 the queryset in the POST request is different than the ordering of the
 queryset in the GET request made by user 1, due to the edit made by user
 2.  In the example I describe above, object foo is no longer the object
 that has the most recent deadline when the code processes user 1's POST
 request.  Instead, object 'bar' is.   In effect, it's as if the code
 thinks the user wants to change the name of object 'bar' instead of object
 'foo'.  However, the id sent with the post data is for object 'foo'.
 Eventually we get into _perform_unique_checks() and this sort of
 identifies that there is a problem.  There is the following code:

 {{{

 # Exclude the current object from the query if we are editing
 an
 # instance (as opposed to creating a new one)
 if self.instance.pk is not None:
 qs = qs.exclude(pk=self.instance.pk)

 }}}

 In a non-multiuser case I think this would exclude the instance being
 edited, but in this case it doesn't.  The result is that we drop into the
 next lines of code which generate an error, but the error looks like this:
 "Task with this None already exists."  It contains the word "None" because
 the id field does not have a laberl attribute (ie self.fields['id'].label
 is None). I see this error when I print the form but it actually doesn't
 even show up in the admin ui.  I just see the message "Please correct the
 errors below", but no errors are shown below.

 In general it seems like a different tact needs to be taken for the POST
 request related to modification of editable fields.  It seems to me that
 the code needs to identify the object being modified based on the id, and
 modify that object, rather than creating a queryset based on the filters
 and ordering and simply indexing in by form number.


 Margie

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #373: Add support for multiple-column primary keys

2009-06-12 Thread Django
#373: Add support for multiple-column primary keys
---+
  Reporter:  jacob | Owner:  dcramer 
Status:  assigned  | Milestone:  
 Component:  Database layer (models, ORM)  |   Version:  
Resolution:|  Keywords:  database
 Stage:  Accepted  | Has_patch:  0   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by fongandrew):

 Replying to [comment:32 dcrosta]:
 Second that. This appears to add primary-key support only. It would be
 nice to have non-unique composite-key indexing. It would be nice for
 things like the generic relations in the contenttypes app for instance.

 Suggested syntax:
 {{{
 class MyModel(models.Model):
 field_a = models.IntegerField()
 field_b = models.IntegerField()

 class Meta:
 index_together = (('field_a', 'field_b'),)
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10986 - django/branches/releases/1.0.X/django/contrib/gis/gdal

2009-06-12 Thread noreply

Author: jbronn
Date: 2009-06-12 12:19:19 -0500 (Fri, 12 Jun 2009)
New Revision: 10986

Modified:
   django/branches/releases/1.0.X/django/contrib/gis/gdal/libgdal.py
Log:
[1.0.X] Fixed support for GDAL 1.6 on Windows.  Thanks to jtia for spotting 
this.

Backport of r10985 from trunk.


Modified: django/branches/releases/1.0.X/django/contrib/gis/gdal/libgdal.py
===
--- django/branches/releases/1.0.X/django/contrib/gis/gdal/libgdal.py   
2009-06-12 17:16:49 UTC (rev 10985)
+++ django/branches/releases/1.0.X/django/contrib/gis/gdal/libgdal.py   
2009-06-12 17:19:19 UTC (rev 10986)
@@ -14,7 +14,7 @@
 lib_names = None
 elif os.name == 'nt':
 # Windows NT shared library
-lib_names = ['gdal15']
+lib_names = ['gdal16', 'gdal15']
 elif os.name == 'posix':
 # *NIX library names.
 lib_names = ['gdal', 'GDAL', 'gdal1.6.0', 'gdal1.5.0', 'gdal1.4.0']


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10985 - django/trunk/django/contrib/gis/gdal

2009-06-12 Thread noreply

Author: jbronn
Date: 2009-06-12 12:16:49 -0500 (Fri, 12 Jun 2009)
New Revision: 10985

Modified:
   django/trunk/django/contrib/gis/gdal/libgdal.py
Log:
Fixed support for GDAL 1.6 on Windows.  Thanks to jtia for spotting this.


Modified: django/trunk/django/contrib/gis/gdal/libgdal.py
===
--- django/trunk/django/contrib/gis/gdal/libgdal.py 2009-06-12 14:09:36 UTC 
(rev 10984)
+++ django/trunk/django/contrib/gis/gdal/libgdal.py 2009-06-12 17:16:49 UTC 
(rev 10985)
@@ -14,7 +14,7 @@
 lib_names = None
 elif os.name == 'nt':
 # Windows NT shared library
-lib_names = ['gdal15']
+lib_names = ['gdal16', 'gdal15']
 elif os.name == 'posix':
 # *NIX library names.
 lib_names = ['gdal', 'GDAL', 'gdal1.6.0', 'gdal1.5.0', 'gdal1.4.0']


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r10984 - in django/branches/releases/1.0.X: . django/core tests/regressiontests/mail

2009-06-12 Thread noreply

Author: lukeplant
Date: 2009-06-12 09:09:36 -0500 (Fri, 12 Jun 2009)
New Revision: 10984

Modified:
   django/branches/releases/1.0.X/
   django/branches/releases/1.0.X/django/core/mail.py
   django/branches/releases/1.0.X/tests/regressiontests/mail/tests.py
Log:
[1.0.X] Fixed #9367 - EmailMultiAlternatives does not properly handle 
attachments.

Thanks to Loek Engels for the bulk of the patch.

Backport of r10983 from trunk



Property changes on: django/branches/releases/1.0.X
___
Name: svnmerge-integrated
   - 
/django/trunk:1-9097,9099-9102,9104-9109,9111,9113-9144,9146-9151,9153-9156,9158-9159,9161-9187,9189-9247,9249-9262,9264-9277,9279-9298,9301-9302,9305-9331,9333-9343,9345,9347,9350-9352,9355-9396,9399-9462,9466-9469,9471-9488,9491-9526,9529,9533-9536,9539-9550,9556-9557,9559-9560,9562-9568,9570-9591,9595-9619,9621-9624,9626-9636,9638-9642,9644-9645,9647-9689,9691-9699,9703-9706,9709-9713,9716-9723,9725-9726,9730-9738,9740-9741,9750-9751,9757-9758,9761-9762,9767-9768,9770-9780,9782-9784,9789-9790,9793-9798,9801-9802,9806-9807,9809-9813,9821-9837,9842-9843,9847-9859,9861,9863-9875,9877-9881,9883-9887,9899-9903,9906-9909,9912,9914,9916-9917,9919-9920,9922-9927,9929,9931-9937,9939,9942-9943,9945-9950,9953-9954,9956-9962,9966-9977,9979-9984,9986-9988,9990-10001,10003-10004,10007,10009-10010,10013-10017,10019-10020,10022-10025,10031,10036-10041,10049-10052,10054-10061,10066-10069,10071-10076,10078-10079,10085-10087,10104,10106,10125-10127,10136,10138-10140,10143,10145-10147,10149-10160,10163-10167,10170,10173,10175-10176,10180,10185,10189,10192-10196,10198-10221,10223-10228,10230-10234,10236-10247,10250-10257,10259-10270,10273-10274,10276-10280,10282-10314,10316,10319-10322,10324-10325,10328-10329,10333-10344,10348-10351,10353-10356,10358-10363,10365-10368,10371-10380,10386-10407,10411,10413-10427,10429-10437,10440-10442,10444-10445,10447-10450,10452-10453,10457-10464,10466-10467,10469-10480,10482-10485,10489-10492,10495-10497,10499-10505,10508-10509,10511-10514,10517-10520,10524-10525,10528,10530-10537,10539-10548,10550-10557,10561,10563-10564,10567-10571,10573-10574,10576-10578,10580-10589,10591-10592,10595-10596,10599-10601,10603-10620,10624-10626,10631,10639-10641,10643,10646,10652-10655,10659-10660,10666-10669,10675,10682-10690,10693,10697-10704,10707,10713-10714,10723,10725,10727,10729,10732,10743-10750,10752-10760,10768,10770,10772,10774,10777,10782,10787,10789,10791,10795,10797,10799,10801,10805,10808,10810,10812,10814,10816,10819,10822,10828,10831,10833,10835,10837,10841,10843,10845,10847,10849,10913-10914,10952,10970-10973
   + 
/django/trunk:1-9097,9099-9102,9104-9109,9111,9113-9144,9146-9151,9153-9156,9158-9159,9161-9187,9189-9247,9249-9262,9264-9277,9279-9298,9301-9302,9305-9331,9333-9343,9345,9347,9350-9352,9355-9396,9399-9462,9466-9469,9471-9488,9491-9526,9529,9533-9536,9539-9550,9556-9557,9559-9560,9562-9568,9570-9591,9595-9619,9621-9624,9626-9636,9638-9642,9644-9645,9647-9689,9691-9699,9703-9706,9709-9713,9716-9723,9725-9726,9730-9738,9740-9741,9750-9751,9757-9758,9761-9762,9767-9768,9770-9780,9782-9784,9789-9790,9793-9798,9801-9802,9806-9807,9809-9813,9821-9837,9842-9843,9847-9859,9861,9863-9875,9877-9881,9883-9887,9899-9903,9906-9909,9912,9914,9916-9917,9919-9920,9922-9927,9929,9931-9937,9939,9942-9943,9945-9950,9953-9954,9956-9962,9966-9977,9979-9984,9986-9988,9990-10001,10003-10004,10007,10009-10010,10013-10017,10019-10020,10022-10025,10031,10036-10041,10049-10052,10054-10061,10066-10069,10071-10076,10078-10079,10085-10087,10104,10106,10125-10127,10136,10138-10140,10143,10145-10147,10149-10160,10163-10167,10170,10173,10175-10176,10180,10185,10189,10192-10196,10198-10221,10223-10228,10230-10234,10236-10247,10250-10257,10259-10270,10273-10274,10276-10280,10282-10314,10316,10319-10322,10324-10325,10328-10329,10333-10344,10348-10351,10353-10356,10358-10363,10365-10368,10371-10380,10386-10407,10411,10413-10427,10429-10437,10440-10442,10444-10445,10447-10450,10452-10453,10457-10464,10466-10467,10469-10480,10482-10485,10489-10492,10495-10497,10499-10505,10508-10509,10511-10514,10517-10520,10524-10525,10528,10530-10537,10539-10548,10550-10557,10561,10563-10564,10567-10571,10573-10574,10576-10578,10580-10589,10591-10592,10595-10596,10599-10601,10603-10620,10624-10626,10631,10639-10641,10643,10646,10652-10655,10659-10660,10666-10669,10675,10682-10690,10693,10697-10704,10707,10713-10714,10723,10725,10727,10729,10732,10743-10750,10752-10760,10768,10770,10772,10774,10777,10782,10787,10789,10791,10795,10797,10799,10801,10805,10808,10810,10812,10814,10816,10819,10822,10828,10831,10833,10835,10837,10841,10843,10845,10847,10849,10913-10914,10952,10970-10973,10983

Modified: django/branches/releases/1.0.X/django/core/mail.py
===
--- django/branches/releases/1.0.X/django/core/mail.py  2009-06-12 13:56:40 UTC 
(rev 10983)
+++ 

[Changeset] r10983 - in django/trunk: django/core tests/regressiontests/mail

2009-06-12 Thread noreply

Author: lukeplant
Date: 2009-06-12 08:56:40 -0500 (Fri, 12 Jun 2009)
New Revision: 10983

Modified:
   django/trunk/django/core/mail.py
   django/trunk/tests/regressiontests/mail/tests.py
Log:
Fixed #9367 - EmailMultiAlternatives does not properly handle attachments.

Thanks to Loek Engels for the bulk of the patch.


Modified: django/trunk/django/core/mail.py
===
--- django/trunk/django/core/mail.py2009-06-11 19:06:12 UTC (rev 10982)
+++ django/trunk/django/core/mail.py2009-06-12 13:56:40 UTC (rev 10983)
@@ -195,7 +195,7 @@
 A container for email information.
 """
 content_subtype = 'plain'
-multipart_subtype = 'mixed'
+mixed_subtype = 'mixed'
 encoding = None # None => use settings default
 
 def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
@@ -234,16 +234,7 @@
 encoding = self.encoding or settings.DEFAULT_CHARSET
 msg = SafeMIMEText(smart_str(self.body, settings.DEFAULT_CHARSET),
self.content_subtype, encoding)
-if self.attachments:
-body_msg = msg
-msg = SafeMIMEMultipart(_subtype=self.multipart_subtype)
-if self.body:
-msg.attach(body_msg)
-for attachment in self.attachments:
-if isinstance(attachment, MIMEBase):
-msg.attach(attachment)
-else:
-msg.attach(self._create_attachment(*attachment))
+msg = self._create_message(msg)
 msg['Subject'] = self.subject
 msg['From'] = self.extra_headers.pop('From', self.from_email)
 msg['To'] = ', '.join(self.to)
@@ -277,8 +268,7 @@
 def attach(self, filename=None, content=None, mimetype=None):
 """
 Attaches a file with the given filename and content. The filename can
-be omitted (useful for multipart/alternative messages) and the mimetype
-is guessed, if not provided.
+be omitted and the mimetype is guessed, if not provided.
 
 If the first parameter is a MIMEBase subclass it is inserted directly
 into the resulting message attachments.
@@ -296,15 +286,26 @@
 content = open(path, 'rb').read()
 self.attach(filename, content, mimetype)
 
-def _create_attachment(self, filename, content, mimetype=None):
+def _create_message(self, msg):
+return self._create_attachments(msg)
+
+def _create_attachments(self, msg):
+if self.attachments:
+body_msg = msg
+msg = SafeMIMEMultipart(_subtype=self.mixed_subtype)
+if self.body:
+msg.attach(body_msg)
+for attachment in self.attachments:
+if isinstance(attachment, MIMEBase):
+msg.attach(attachment)
+else:
+msg.attach(self._create_attachment(*attachment))
+return msg
+
+def _create_mime_attachment(self, content, mimetype):
 """
-Converts the filename, content, mimetype triple into a MIME attachment
-object.
+Converts the content, mimetype pair into a MIME attachment object.
 """
-if mimetype is None:
-mimetype, _ = mimetypes.guess_type(filename)
-if mimetype is None:
-mimetype = DEFAULT_ATTACHMENT_MIME_TYPE
 basetype, subtype = mimetype.split('/', 1)
 if basetype == 'text':
 attachment = SafeMIMEText(smart_str(content,
@@ -314,6 +315,18 @@
 attachment = MIMEBase(basetype, subtype)
 attachment.set_payload(content)
 Encoders.encode_base64(attachment)
+return attachment
+
+def _create_attachment(self, filename, content, mimetype=None):
+"""
+Converts the filename, content, mimetype triple into a MIME attachment
+object.
+"""
+if mimetype is None:
+mimetype, _ = mimetypes.guess_type(filename)
+if mimetype is None:
+mimetype = DEFAULT_ATTACHMENT_MIME_TYPE
+attachment = self._create_mime_attachment(content, mimetype)
 if filename:
 attachment.add_header('Content-Disposition', 'attachment',
   filename=filename)
@@ -325,12 +338,40 @@
 messages. For example, including text and HTML versions of the text is
 made easier.
 """
-multipart_subtype = 'alternative'
+alternative_subtype = 'alternative'
 
-def attach_alternative(self, content, mimetype=None):
+def __init__(self, subject='', body='', from_email=None, to=None, bcc=None,
+connection=None, attachments=None, headers=None, 
alternatives=None):
+"""
+Initialize a single email message (which can be sent to multiple
+recipients).
+
+All strings used to create the message can be unicode strings (or UTF-8
+bytestrings). The 

Re: [Django] #11303: changed_data wrong work with BooleanField

2009-06-12 Thread Django
#11303: changed_data wrong work with BooleanField
-+--
  Reporter:  oduvan  | Owner:  nobody
Status:  new | Milestone:  1.1   
 Component:  Forms   |   Version:  1.1-beta-1
Resolution:  |  Keywords:
 Stage:  Unreviewed  | Has_patch:  1 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by oduvan):

  * needs_better_patch:  => 0
  * needs_docs:  => 0
  * version:  SVN => 1.1-beta-1
  * needs_tests:  => 0
  * milestone:  1.0.3 => 1.1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9367: EmailMultiAlternatives does not properly handle attachments

2009-06-12 Thread Django
#9367: EmailMultiAlternatives does not properly handle attachments
---+
  Reporter:  loekje| Owner:  lukeplant
Status:  new   | Milestone:   
 Component:  django.core.mail  |   Version:  1.0  
Resolution:|  Keywords:   
 Stage:  Accepted  | Has_patch:  1
Needs_docs:  0 |   Needs_tests:  0
Needs_better_patch:  0 |  
---+
Changes (by lukeplant):

  * owner:  => lukeplant

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9370: UnicodeDecodeError when serving binary static files through GZipMiddleWare

2009-06-12 Thread Django
#9370: UnicodeDecodeError when serving binary static files through 
GZipMiddleWare
-+--
  Reporter:  kikko   | Owner:  kkubasik
Status:  reopened| Milestone:  1.1 
 Component:  Core framework  |   Version:  1.0 
Resolution:  |  Keywords:  
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Comment (by niksite):

 Sorry, formatting has been lost in my last message. This is repost with
 some additions.

 I have this reproduced with latest TRUNK:

 {{{
 [16:25 /home/niksite/webapps/django/datamining]$ ./manage.py runserver
 Validating models...
 0 errors found

 Django version 1.1 beta 1 SVN-10982, using settings 'datamining.settings'
 Development server is running at http://127.0.0.1:8000/
 Quit the server with CONTROL-C.
 Traceback (most recent call last):
   File "/home/niksite/lib/site-python/django/core/servers/basehttp.py",
 line 278, in run
 self.result = application(self.environ, self.start_response)
   File "/home/niksite/lib/site-python/django/core/servers/basehttp.py",
 line 636, in __call__
 return self.application(environ, start_response)
   File "/home/niksite/lib/site-python/django/core/handlers/wsgi.py", line
 245, in __call__
 response = middleware_method(request, response)
   File "/home/niksite/lib/site-python/django/middleware/gzip.py", line 16,
 in process_response
 if response.status_code != 200 or len(response.content) < 200:
   File "/home/niksite/lib/site-python/django/http/__init__.py", line 365,
 in _get_content
 return smart_str(''.join(self._container), self._charset)
   File "/home/niksite/lib/site-python/django/utils/encoding.py", line 119,
 in smart_str
 return s.decode('utf-8', errors).encode(encoding, errors)
   File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
 return codecs.utf_8_decode(input, errors, True)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0:
 unexpected code byte
 [12/Jun/2009 16:26:27] "GET /media/images/white.png HTTP/1.0" 500 1162
 }}}

 By the way, the following error is produced if gzip-middleware is
 disabled:
 {{{
 Traceback (most recent call last):
   File "/home/niksite/lib/site-python/django/core/servers/basehttp.py",
 line 278, in run
 self.result = application(self.environ, self.start_response)
   File "/home/niksite/lib/site-python/django/core/servers/basehttp.py",
 line 636, in __call__
 return self.application(environ, start_response)
   File "/home/niksite/lib/site-python/django/core/handlers/wsgi.py", line
 245, in __call__
 response = middleware_method(request, response)
   File "/home/niksite/lib/site-python/django/middleware/cache.py", line
 91, in process_response
 patch_response_headers(response, timeout)
   File "/home/niksite/lib/site-python/django/utils/cache.py", line 108, in
 patch_response_headers
 response['ETag'] = '"%s"' %
 md5_constructor(response.content).hexdigest()
   File "/home/niksite/lib/site-python/django/http/__init__.py", line 365,
 in _get_content
 return smart_str(''.join(self._container), self._charset)
   File "/home/niksite/lib/site-python/django/utils/encoding.py", line 119,
 in smart_str
 return s.decode('utf-8', errors).encode(encoding, errors)
   File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
 return codecs.utf_8_decode(input, errors, True)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0:
 unexpected code byte
 [12/Jun/2009 16:28:37] "GET /media/images/white.png HTTP/1.0" 500 1319
 }}}

 With cache-middleware disabled I see no errors:
 {{{
 [12/Jun/2009 16:29:31] "GET /media/images/white.png HTTP/1.0" 200 4233
 }}}

 I have the following settings:
 {{{
 MIDDLEWARE_CLASSES = (
 'django.middleware.cache.UpdateCacheMiddleware',
 #'django.middleware.http.ConditionalGetMiddleware',
 'django.middleware.gzip.GZipMiddleware',
 # 'debug_toolbar.middleware.DebugToolbarMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
 'django.middleware.cache.FetchFromCacheMiddleware',
 )
 CACHE_MIDDLEWARE_SECONDS = 0
 CACHE_BACKEND = "dummy://"
 MEDIA_URL = "http://127.0.0.1:8000/media/;
 }}}

 And the following lines in urls.py:
 {{{
 urlpatterns += patterns('',
 (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root':
 settings.MEDIA_ROOT}),
 }}}

-- 

Re: [Django] #9370: UnicodeDecodeError when serving binary static files through GZipMiddleWare

2009-06-12 Thread Django
#9370: UnicodeDecodeError when serving binary static files through 
GZipMiddleWare
-+--
  Reporter:  kikko   | Owner:  kkubasik
Status:  reopened| Milestone:  1.1 
 Component:  Core framework  |   Version:  1.0 
Resolution:  |  Keywords:  
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Changes (by niksite):

  * status:  closed => reopened
  * resolution:  invalid =>

Comment:

 I have this reproduced with latest TRUNK:

 [16:25 /home/niksite/webapps/django/datamining]$ ./manage.py runserver
 Validating models...
 0 errors found

 Django version 1.1 beta 1 SVN-10982, using settings 'datamining.settings'
 Development server is running at http://127.0.0.1:8000/
 Quit the server with CONTROL-C.
 Traceback (most recent call last):
   File "/home/niksite/lib/site-python/django/core/servers/basehttp.py",
 line 278, in run
 self.result = application(self.environ, self.start_response)
   File "/home/niksite/lib/site-python/django/core/servers/basehttp.py",
 line 636, in __call__
 return self.application(environ, start_response)
   File "/home/niksite/lib/site-python/django/core/handlers/wsgi.py", line
 245, in __call__
 response = middleware_method(request, response)
   File "/home/niksite/lib/site-python/django/middleware/gzip.py", line 16,
 in process_response
 if response.status_code != 200 or len(response.content) < 200:
   File "/home/niksite/lib/site-python/django/http/__init__.py", line 365,
 in _get_content
 return smart_str(''.join(self._container), self._charset)
   File "/home/niksite/lib/site-python/django/utils/encoding.py", line 119,
 in smart_str
 return s.decode('utf-8', errors).encode(encoding, errors)
   File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
 return codecs.utf_8_decode(input, errors, True)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0:
 unexpected code byte
 [12/Jun/2009 16:26:27] "GET /media/images/white.png HTTP/1.0" 500 1162


 By the way, the following error is produced if gzip-middleware is
 disabled:

 Traceback (most recent call last):
   File "/home/niksite/lib/site-python/django/core/servers/basehttp.py",
 line 278, in run
 self.result = application(self.environ, self.start_response)
   File "/home/niksite/lib/site-python/django/core/servers/basehttp.py",
 line 636, in __call__
 return self.application(environ, start_response)
   File "/home/niksite/lib/site-python/django/core/handlers/wsgi.py", line
 245, in __call__
 response = middleware_method(request, response)
   File "/home/niksite/lib/site-python/django/middleware/cache.py", line
 91, in process_response
 patch_response_headers(response, timeout)
   File "/home/niksite/lib/site-python/django/utils/cache.py", line 108, in
 patch_response_headers
 response['ETag'] = '"%s"' %
 md5_constructor(response.content).hexdigest()
   File "/home/niksite/lib/site-python/django/http/__init__.py", line 365,
 in _get_content
 return smart_str(''.join(self._container), self._charset)
   File "/home/niksite/lib/site-python/django/utils/encoding.py", line 119,
 in smart_str
 return s.decode('utf-8', errors).encode(encoding, errors)
   File "/usr/lib/python2.5/encodings/utf_8.py", line 16, in decode
 return codecs.utf_8_decode(input, errors, True)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0:
 unexpected code byte
 [12/Jun/2009 16:28:37] "GET /media/images/white.png HTTP/1.0" 500 1319

 With cache-middleware disabled I see no errors:
 [12/Jun/2009 16:29:31] "GET /media/images/white.png HTTP/1.0" 200 4233

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #11312: Typo in documentation

2009-06-12 Thread Django
#11312: Typo in documentation
---+
 Reporter:  anonymous  |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Documentation  | Version:  SVN   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 DEFAULT_FILE_STORAGE in "Available settings" documentation misses quote
 marks.
 See patch.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #11311: Deleting model instance with a string id and m2m relation fails

2009-06-12 Thread Django
#11311: Deleting model instance with a string id and m2m relation fails
--+-
 Reporter:  ronny |   Owner:  nobody
   Status:  new   |   Milestone:  1.1   
Component:  Database layer (models, ORM)  | Version:  SVN   
 Keywords:  delete string pk m2m  |   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 Say a model has a CharField as its primary key and the model also has a
 many to many relation to some other "normal" model, deleting an instance
 of the model with string primary key like "abc" fails with an exception,
 but not with a string id that can be converted into an int, e.g. "1".
 Seems like the code assumes that primary keys are always int()?

 Using django from svn trunk r10982.

 The following is a very small test case (models.py) that demonstrate the
 issue.

 {{{
 from django.db import models

 class Line(models.Model):
 name = models.CharField(max_length=100)

 class Worksheet(models.Model):
 id = models.CharField(primary_key=True, max_length=100)
 lines = models.ManyToManyField(Line, blank=True, null=True)
 }}}

 After running syncdb (happens with sqlite3 and postgresql-8.3 btw), then
 the following is the output from `manage.py shell`:

 {{{
 In [1]: from x.y.models import *

 In [2]: w = Worksheet(id='abc')

 In [3]: w.save()

 In [4]: w
 Out[4]: 

 In [5]: w.delete()
 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (20, 0))

 ---
 ValueErrorTraceback (most recent call
 last)

 /private/tmp/x/ in ()

 /Library/Python/2.5/site-packages/django/db/models/base.pyc in
 delete(self)
 567
 568 # Actually delete the objects.
 --> 569 delete_objects(seen_objs)
 570
 571 delete.alters_data = True

 /Library/Python/2.5/site-packages/django/db/models/query.pyc in
 delete_objects(seen_objs)
1035 pk_list = [pk for pk,instance in items]
1036 del_query = sql.DeleteQuery(cls, connection)
 -> 1037 del_query.delete_batch_related(pk_list)
1038
1039 update_query = sql.UpdateQuery(cls, connection)

 /Library/Python/2.5/site-packages/django/db/models/sql/subqueries.pyc in
 delete_batch_related(self, pk_list)
  68 where.add((Constraint(None, f.m2m_column_name(),
 f), 'in',
  69 pk_list[offset : offset +
 GET_ITERATOR_CHUNK_SIZE]),
 ---> 70 AND)
  71 if w1:
  72 where.add(w1, AND)

 /Library/Python/2.5/site-packages/django/db/models/sql/where.pyc in
 add(self, data, connector)
  54 if hasattr(obj, "process"):
  55 try:
 ---> 56 obj, params = obj.process(lookup_type, value)
  57 except (EmptyShortCircuit, EmptyResultSet):
  58 # There are situations where we want to short-
 circuit any

 /Library/Python/2.5/site-packages/django/db/models/sql/where.pyc in
 process(self, lookup_type, value)
 267 try:
 268 if self.field:
 --> 269 params =
 self.field.get_db_prep_lookup(lookup_type, value)
 270 db_type = self.field.db_type()
 271 else:

 /Library/Python/2.5/site-packages/django/db/models/fields/related.py in
 get_db_prep_lookup(self, lookup_type, value)
 160 return [pk_trace(value)]
 161 if lookup_type in ('range', 'in'):
 --> 162 return [pk_trace(v) for v in value]
 163 elif lookup_type == 'isnull':
 164 return []

 /Library/Python/2.5/site-packages/django/db/models/fields/related.py in
 pk_trace(value)
 137 if lookup_type in ('range', 'in'):
 138 v = [v]
 --> 139 v = field.get_db_prep_lookup(lookup_type, v)
 140 if isinstance(v, list):
 141 v = v[0]

 /Library/Python/2.5/site-packages/django/db/models/fields/__init__.pyc in
 get_db_prep_lookup(self, lookup_type, value)
 210 return [self.get_db_prep_value(value)]
 211 elif lookup_type in ('range', 'in'):
 --> 212 return [self.get_db_prep_value(v) for v in value]
 213 elif lookup_type in ('contains', 'icontains'):
 214 return ["%%%s%%" %
 connection.ops.prep_for_like_query(value)]

 /Library/Python/2.5/site-packages/django/db/models/fields/__init__.pyc in
 get_db_prep_value(self, value)
 359 if value is None:
 360 return None
 --> 361 return int(value)
 362
 363 def 

Re: [Django] #11310: Unable to serialize ManyToMany fields with "trough"

2009-06-12 Thread Django
#11310: Unable to serialize ManyToMany fields with "trough"
---+
  Reporter:  Pavel Schön   | Owner:  nobody
Status:  new   | Milestone:
 Component:  Serialization |   Version:  1.0   
Resolution:|  Keywords:  ManyToMany
 Stage:  Unreviewed| Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by Pavel Schön ):

  * needs_better_patch:  => 0
  * component:  Uncategorized => Serialization
  * needs_tests:  => 0
  * keywords:  => ManyToMany
  * needs_docs:  => 0
  * has_patch:  0 => 1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #11310: Unable to serialize ManyToMany fields with "trough"

2009-06-12 Thread Django
#11310: Unable to serialize ManyToMany fields with "trough"
--+-
 Reporter:  Pavel Schön   |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Uncategorized | Version:  1.0   
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 Problem is, that ManyToMany field with intermediate table is ignored in
 PythonSerializer. This patch should fix it.

 {{{
 
http://code.djangoproject.com/svn/django/trunk/django/core/serializers/python.py
 59,61c59,60
 < if field.creates_table:
 < self._current[field.name] =
 [smart_unicode(related._get_pk_val(), strings_only=True)
  self._current[field.name] =
 [smart_unicode(related._get_pk_val(), strings_only=True)
 > for related in getattr(obj, field.name).iterator()]
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9367: EmailMultiAlternatives does not properly handle attachments

2009-06-12 Thread Django
#9367: EmailMultiAlternatives does not properly handle attachments
---+
  Reporter:  loekje| Owner: 
Status:  new   | Milestone: 
 Component:  django.core.mail  |   Version:  1.0
Resolution:|  Keywords: 
 Stage:  Accepted  | Has_patch:  1  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by wdoekes):

 * cc: walter+dja...@wjd.nu (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #5390: Add signals to ManyRelatedManager

2009-06-12 Thread Django
#5390: Add signals to ManyRelatedManager
--+-
  Reporter:  Ludovico Magnocavallo   | Owner:  
rvdrijst   
Status:  assigned | Milestone:  
   
 Component:  Database layer (models, ORM) |   Version:  SVN 
   
Resolution:   |  Keywords:  
manytomanyfield feature signals
 Stage:  Design decision needed   | Has_patch:  1   
   
Needs_docs:  0|   Needs_tests:  0   
   
Needs_better_patch:  0|  
--+-
Changes (by lvscar):

 * cc: lvs...@gmail.com (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11309: template

2009-06-12 Thread Django
#11309: template
--+-
  Reporter:  ankit| Owner:  nobody  
Status:  closed   | Milestone:  
 Component:  Template system  |   Version:  1.1-beta-1  
Resolution:  invalid  |  Keywords:  inline -template
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by russellm):

  * status:  new => closed
  * resolution:  => invalid

Comment:

 The answer to this hasn't changed since you posted #11307. The ticket
 system isn't for answering "How Do I" user questions. Please ask on
 django-users. Please *Do Not* open yet another ticket with your question.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11309: template

2009-06-12 Thread Django
#11309: template
--+-
  Reporter:  ankit| Owner:  nobody  
Status:  new  | Milestone:  
 Component:  Template system  |   Version:  1.1-beta-1  
Resolution:   |  Keywords:  inline -template
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by ankit):

  * owner:  ankit => nobody
  * status:  assigned => new

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11309: template

2009-06-12 Thread Django
#11309: template
--+-
  Reporter:  ankit| Owner:  ankit   
Status:  assigned | Milestone:  
 Component:  Template system  |   Version:  1.1-beta-1  
Resolution:   |  Keywords:  inline -template
 Stage:  Unreviewed   | Has_patch:  0   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by ankit):

  * owner:  nobody => ankit
  * needs_better_patch:  => 0
  * status:  new => assigned
  * needs_tests:  => 0
  * needs_docs:  => 0

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #11309: template

2009-06-12 Thread Django
#11309: template
--+-
 Reporter:  ankit |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Template system   | Version:  1.1-beta-1
 Keywords:  inline -template  |   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 ''inline template ''

 I want to use  tag in the template where i found the field named
 as 'Id'.

  {% for fieldset in inline_admin_form %}
   {% for line in fieldset %}
 {% for field in line %}
   
   {{ field.field.errors.as_ul }}
 
 {{ field.field }}
 
   
 {% endfor %}
   {% endfor %}
 {% endfor %}



 in if condition i want a href tag to be placed.

 I have tried several option but are not working

 1)click here 


 2)click here 

 3)click here


 {{field.field.label}} is giving 'Id'
 when i write {{field.field}} it is giving the correct value but when i
 write it inside http://code.djangoproject.com/ticket/11309>
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #11308: Django ignores an application if it's trying to import a module that doesn't exist

2009-06-12 Thread Django
#11308: Django ignores an application if it's trying to import a module that
doesn't exist
---+
 Reporter:  rynoinstereo   |   Owner:  nobody
   Status:  new|   Milestone:  1.1   
Component:  Testing framework  | Version:  1.0   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Hello,

 First off, I'm a brand new Django user so apologies if I don't make myself
 clear.

 Just had a weird thing happen where I could not for the life of me, figure
 out why Django was saying all my Models were valid, yet when running
 manage.py validate and then syncdb, it would not create the tables for my
 newly created application.

 The problem turned out to be that I was trying to include a model from one
 of my other applications ina the project but I had the name of the model
 wrong.

 For some reason, this caused Django to completely ignore the model file
 for my newly created application, instead of reporting this as an error?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---