Re: [Django] #14447: Auth and Sitemap test failures from manage.py test

2010-10-11 Thread Django
#14447: Auth and Sitemap test failures from manage.py test
+---
  Reporter:  gabrielhurley  | Owner:  gabrielhurley
Status:  assigned   | Milestone:  1.3  
 Component:  Contrib apps   |   Version:  1.2  
Resolution: |  Keywords:   
 Stage:  Accepted   | Has_patch:  1
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Changes (by gabrielhurley):

  * status:  new => assigned
  * needs_better_patch:  => 0
  * stage:  Unreviewed => Accepted
  * 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-upda...@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] #14447: Auth and Sitemap test failures from manage.py test

2010-10-11 Thread Django
#14447: Auth and Sitemap test failures from manage.py test
---+
 Reporter:  gabrielhurley  |   Owner:  gabrielhurley
   Status:  new|   Milestone:  1.3  
Component:  Contrib apps   | Version:  1.2  
 Keywords: |   Stage:  Unreviewed   
Has_patch:  1  |  
---+
 The `contrib.auth` and `contrib.sitemap` tests pass perfectly when run
 from Django's test suite, but they can potentially raise multiple failures
 depending on a project's settings.

 Issues:

  1. `contrib.auth`'s `testLoginRequired` fails when LOGIN_URL is set to
 something other than "/login/". (post [13723])
  2. `contrib.sitemaps` had several dependencies on `contrib.flatpages`
 (post [13734])
  3. `contrib.sitemaps`'s `test_generic_sitemap` fails when a fixture loads
 in extra `User` objects. (post [13676])

 The attached patches fix all of the above, and still pass the full test
 suite. One patch for trunk, one patch for 1.2.X.

 Please note that issue 3 actually exists in the current 1.2.3 release. The
 rest have been introduced since then.

-- 
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-upda...@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] #3400: Support for lookup separator with list_filter admin option

2010-10-11 Thread Django
#3400: Support for lookup separator with list_filter admin option
---+
  Reporter:  n...@intv.com.au  | Owner:  DrMeers
 
Status:  assigned  | Milestone:  1.3
 
 Component:  django.contrib.admin  |   Version:  newforms-admin 
 
Resolution:|  Keywords:  edc nfa-someday 
list_filter FilterSpec nfa-changelist ep2008
 Stage:  Accepted  | Has_patch:  1  
 
Needs_docs:  0 |   Needs_tests:  0  
 
Needs_better_patch:  0 |  
---+
Comment (by m4rt0g1):

 can anyone mail me about which file that needed to be change and full
 example for doing this code?

-- 
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-upda...@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] #14438: Deserializer raises ValidationError if natural key is given as string

2010-10-11 Thread Django
#14438: Deserializer raises ValidationError if natural key is given as string
+---
  Reporter:  zimnyx | Owner:  nobody
Status:  closed | Milestone:
 Component:  Serialization  |   Version:  SVN   
Resolution:  worksforme |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by ramiro):

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

Comment:

 I've tested  this locally and the YAML generated is correct (see fixtures6
 and fixures8 in Django's `tests/modeltests/fixtures` test case, Visa has a
 FK to Person that has a one-field natural key).

 {{{
 - fields:
 permissions:
 - [add_user, auth, user]
 - [change_user, auth, user]
 - [delete_user, auth, user]
 person: [Django Reinhardt]
   model: fixtures.visa
   pk: 1
 - fields:
 permissions:
 - [add_user, auth, user]
 person: [Stephane Grappelli]
   model: fixtures.visa
   pk: 2
 - fields:
 permissions: []
 person: [Prince]
   model: fixtures.visa
   pk: 3
 }}}

 I suspect the problem is the `natural_key` method of the model your FK
 points to isn't returning a tuple. This is documented:
 http://docs.djangoproject.com/en/1.2/topics/serialization/#serialization-
 of-natural-keys

-- 
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-upda...@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] #5415: Every SQL query should send a signal

2010-10-11 Thread Django
#5415: Every SQL query should send a signal
---+
  Reporter:  adrian| Owner:  gav

Status:  closed| Milestone: 

 Component:  Database layer (models, ORM)  |   Version:  SVN

Resolution:  wontfix   |  Keywords:  
feature_request
 Stage:  Accepted  | Has_patch:  1  

Needs_docs:  1 |   Needs_tests:  0  

Needs_better_patch:  0 |  
---+
Changes (by Alex):

  * status:  assigned => closed
  * resolution:  => wontfix

Comment:

 Wontfixing on the grounds that between ``connection.queries`` and the new
 logging stuff there's nothing that a signal really adds.

-- 
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-upda...@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] #661: New function: batch save of objects would make for more efficient processing

2010-10-11 Thread Django
#661: New function: batch save of objects would make for more efficient
processing
-+--
  Reporter:  Lllama  | Owner:  adrian
Status:  closed  | Milestone:
 Component:  Core framework  |   Version:
Resolution:  wontfix |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  1   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by PaulM):

  * status:  reopened => closed
  * needs_docs:  0 => 1
  * resolution:  => wontfix

Comment:

 While I agree that this might be useful functionality, re-opening a ticket
 which was closed by a core dev as "wontfix" (even when that was 4 years
 ago) isn't the way to get your request considered. Instead, you should
 start a thread about it on the [http://groups.google.com/group/django-
 developers django-dev] mailing list.

 Please review the documentation about how we use Trac:

 http://docs.djangoproject.com/en/dev/internals/contributing/#triage-by-
 the-general-community

 I'm re-closing this ticket.

-- 
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-upda...@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] r14183 - in django/trunk: django/db/backends django/test docs/topics tests/modeltests/select_related tests/modeltests/validation tests/regressiontests/defer_regress tests/regressiontests/f

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 22:33:19 -0500 (Mon, 11 Oct 2010)
New Revision: 14183

Added:
   django/trunk/tests/regressiontests/test_utils/python_25.py
Modified:
   django/trunk/django/db/backends/__init__.py
   django/trunk/django/test/testcases.py
   django/trunk/docs/topics/testing.txt
   django/trunk/tests/modeltests/select_related/tests.py
   django/trunk/tests/modeltests/validation/test_unique.py
   django/trunk/tests/modeltests/validation/tests.py
   django/trunk/tests/regressiontests/defer_regress/tests.py
   django/trunk/tests/regressiontests/forms/models.py
   django/trunk/tests/regressiontests/model_forms_regress/tests.py
   django/trunk/tests/regressiontests/select_related_onetoone/tests.py
   django/trunk/tests/regressiontests/test_utils/models.py
   django/trunk/tests/regressiontests/test_utils/tests.py
Log:
Fixed #5416 -- Added TestCase.assertNumQueries, which tests that a given 
function executes the correct number of queries.

Modified: django/trunk/django/db/backends/__init__.py
===
--- django/trunk/django/db/backends/__init__.py 2010-10-12 02:09:35 UTC (rev 
14182)
+++ django/trunk/django/db/backends/__init__.py 2010-10-12 03:33:19 UTC (rev 
14183)
@@ -21,6 +21,7 @@
 self.settings_dict = settings_dict
 self.alias = alias
 self.vendor = 'unknown'
+self.use_debug_cursor = None
 
 def __eq__(self, other):
 return self.settings_dict == other.settings_dict
@@ -74,7 +75,8 @@
 def cursor(self):
 from django.conf import settings
 cursor = self._cursor()
-if settings.DEBUG:
+if (self.use_debug_cursor or
+(self.use_debug_cursor is None and settings.DEBUG)):
 return self.make_debug_cursor(cursor)
 return cursor
 

Modified: django/trunk/django/test/testcases.py
===
--- django/trunk/django/test/testcases.py   2010-10-12 02:09:35 UTC (rev 
14182)
+++ django/trunk/django/test/testcases.py   2010-10-12 03:33:19 UTC (rev 
14183)
@@ -1,4 +1,5 @@
 import re
+import sys
 from urlparse import urlsplit, urlunsplit
 from xml.dom.minidom import parseString, Node
 
@@ -205,6 +206,33 @@
 for conn in connections:
 transaction.rollback_unless_managed(using=conn)
 
+class _AssertNumQueriesContext(object):
+def __init__(self, test_case, num, connection):
+self.test_case = test_case
+self.num = num
+self.connection = connection
+
+def __enter__(self):
+self.old_debug_cursor = self.connection.use_debug_cursor
+self.connection.use_debug_cursor = True
+self.starting_queries = len(self.connection.queries)
+return self
+
+def __exit__(self, exc_type, exc_value, traceback):
+if exc_type is not None:
+return
+
+self.connection.use_debug_cursor = self.old_debug_cursor
+final_queries = len(self.connection.queries)
+executed = final_queries - self.starting_queries
+
+self.test_case.assertEqual(
+executed, self.num, "%d queries executed, %d expected" % (
+executed, self.num
+)
+)
+
+
 class TransactionTestCase(unittest.TestCase):
 # The class we'll use for the test client self.client.
 # Can be overridden in derived classes.
@@ -469,6 +497,22 @@
 def assertQuerysetEqual(self, qs, values, transform=repr):
 return self.assertEqual(map(transform, qs), values)
 
+def assertNumQueries(self, num, func=None, *args, **kwargs):
+using = kwargs.pop("using", DEFAULT_DB_ALIAS)
+connection = connections[using]
+
+context = _AssertNumQueriesContext(self, num, connection)
+if func is None:
+return context
+
+# Basically emulate the `with` statement here.
+
+context.__enter__()
+try:
+func(*args, **kwargs)
+finally:
+context.__exit__(*sys.exc_info())
+
 def connections_support_transactions():
 """
 Returns True if all connections support transactions.  This is messy

Modified: django/trunk/docs/topics/testing.txt
===
--- django/trunk/docs/topics/testing.txt2010-10-12 02:09:35 UTC (rev 
14182)
+++ django/trunk/docs/topics/testing.txt2010-10-12 03:33:19 UTC (rev 
14183)
@@ -1372,6 +1372,32 @@
 implicit ordering, you will need to apply a ``order_by()`` clause to your
 queryset to ensure that the test will pass reliably.
 
+.. method:: TestCase.assertNumQueries(num, func, *args, **kwargs):
+
+.. versionadded:: 1.3
+
+Asserts that when ``func`` is called with ``*args`` and ``**kwargs`` that
+``num`` database queries are executed.
+
+If a ``"using"`` key is present in ``kwargs`` it is used as the database
+alias for which to check the number of queries.  If you wish to call a
+

Re: [Django] #8054: Move method properties for admin list customisation to ModelAdmin

2010-10-11 Thread Django
#8054: Move method properties for admin list customisation to ModelAdmin
+---
  Reporter:  Daniel Pope   | Owner:  
brosner
Status:  assigned   | Milestone:
 
 Component:  django.contrib.admin   |   Version:  
SVN
Resolution: |  Keywords:
 
 Stage:  Accepted   | Has_patch:  1 
 
Needs_docs:  1  |   Needs_tests:  1 
 
Needs_better_patch:  1  |  
+---
Changes (by alekam):

 * cc: kame...@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-upda...@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] #14105: django.contrib.auth tests failing with cache middleware

2010-10-11 Thread Django
#14105: django.contrib.auth tests failing with cache middleware
---+
  Reporter:  baumer1122| Owner:  PaulM
Status:  assigned  | Milestone:   
 Component:  Contrib apps  |   Version:  1.2  
Resolution:|  Keywords:   
 Stage:  Accepted  | Has_patch:  0
Needs_docs:  0 |   Needs_tests:  0
Needs_better_patch:  0 |  
---+
Comment (by PaulM):

 I opened #14446 with a patch to fix the single failure, since it seems to
 be a separate issue from the major reason this ticket is open.

-- 
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-upda...@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] #14446: auth.views.password_reset_confirm should never be cached

2010-10-11 Thread Django
#14446: auth.views.password_reset_confirm should never be cached
+---
 Reporter:  PaulM   |   Owner:  PaulM 
   Status:  new |   Milestone:  1.3   
Component:  Authentication  | Version:  1.2   
 Keywords:  |   Stage:  Unreviewed
Has_patch:  1   |  
+---
 I'm splitting this issue off from #14105, as it is separate from the meat
 of that ticket.

 `Django.contrib.auth.views.password_reset_confirm` needs the `never_cache`
 decorator.

 To reproduce:
 {{{
 1. Start a new project. Add  django.contrib.admin  and setup a sqlite
 database. Test result: OK.

 2. Add the required cache settings and the update/fetch middleware. Tests
 result: FAILED (failures=1, errors=27)
 }}}

 This issue is that single failure.

-- 
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-upda...@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] #14426: Factor "mysite" out of all code example import statements

2010-10-11 Thread Django
#14426: Factor "mysite" out of all code example import statements
+---
  Reporter:  gabrielhurley  | Owner:  gabrielhurley
Status:  new| Milestone:  1.3  
 Component:  Documentation  |   Version:  1.2  
Resolution: |  Keywords:   
 Stage:  Accepted   | Has_patch:  0
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Changes (by PaulM):

  * needs_better_patch:  => 0
  * stage:  Unreviewed => Accepted
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 Seems like a good idea to me.

-- 
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-upda...@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] #14227: Modify contributing docs to mention the 'easy-pickings' keyword in triage

2010-10-11 Thread Django
#14227: Modify contributing docs to mention the 'easy-pickings' keyword in 
triage
+---
  Reporter:  russellm   | Owner:  cmheisel 
Status:  closed | Milestone:   
 Component:  Documentation  |   Version:  1.2  
Resolution:  fixed  |  Keywords:  easy-pickings
 Stage:  Ready for checkin  | Has_patch:  1
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Comment (by cmheisel):

 thanks @gabrielhurley!

-- 
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-upda...@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] r14182 - django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 21:09:35 -0500 (Mon, 11 Oct 2010)
New Revision: 14182

Added:
   
django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related/tests.py
Modified:
   
django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related/models.py
Log:
[1.2.X] Converted model_inheritance_select_related tests from doctests to 
unittests.  We have always been at war with doctests.  Backport of [14181].

Modified: 
django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related/models.py
===
--- 
django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related/models.py
 2010-10-12 02:09:13 UTC (rev 14181)
+++ 
django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related/models.py
 2010-10-12 02:09:35 UTC (rev 14182)
@@ -27,21 +27,3 @@
 
 def __unicode__(self):
 return self.name
-
-__test__ = {'API_TESTS':"""
-Regression test for #7246
-
->>> r1 = Restaurant.objects.create(name="Nobu", serves_sushi=True, 
serves_steak=False)
->>> r2 = Restaurant.objects.create(name="Craft", serves_sushi=False, 
serves_steak=True)
->>> p1 = Person.objects.create(name="John", favorite_restaurant=r1)
->>> p2 = Person.objects.create(name="Jane", favorite_restaurant=r2)
-
->>> Person.objects.order_by('name').select_related()
-[, ]
-
->>> jane = 
Person.objects.order_by('name').select_related('favorite_restaurant')[0]
->>> jane.favorite_restaurant.name
-u'Craft'
-
-"""}
-

Added: 
django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related/tests.py
===
--- 
django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related/tests.py
  (rev 0)
+++ 
django/branches/releases/1.2.X/tests/regressiontests/model_inheritance_select_related/tests.py
  2010-10-12 02:09:35 UTC (rev 14182)
@@ -0,0 +1,29 @@
+from operator import attrgetter
+
+from django.test import TestCase
+
+from models import Restaurant, Person
+
+
+class ModelInheritanceSelectRelatedTests(TestCase):
+def test_inherited_select_related(self):
+# Regression test for #7246
+r1 = Restaurant.objects.create(
+name="Nobu", serves_sushi=True, serves_steak=False
+)
+r2 = Restaurant.objects.create(
+name="Craft", serves_sushi=False, serves_steak=True
+)
+p1 = Person.objects.create(name="John", favorite_restaurant=r1)
+p2 = Person.objects.create(name="Jane", favorite_restaurant=r2)
+
+self.assertQuerysetEqual(
+Person.objects.order_by("name").select_related(), [
+"Jane",
+"John",
+],
+attrgetter("name")
+)
+
+jane = 
Person.objects.order_by("name").select_related("favorite_restaurant")[0]
+self.assertEqual(jane.favorite_restaurant.name, "Craft")

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14181 - django/trunk/tests/regressiontests/model_inheritance_select_related

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 21:09:13 -0500 (Mon, 11 Oct 2010)
New Revision: 14181

Added:
   django/trunk/tests/regressiontests/model_inheritance_select_related/tests.py
Modified:
   django/trunk/tests/regressiontests/model_inheritance_select_related/models.py
Log:
Converted model_inheritance_select_related tests from doctests to unittests.  
We have always been at war with doctests.

Modified: 
django/trunk/tests/regressiontests/model_inheritance_select_related/models.py
===
--- 
django/trunk/tests/regressiontests/model_inheritance_select_related/models.py   
2010-10-12 01:59:46 UTC (rev 14180)
+++ 
django/trunk/tests/regressiontests/model_inheritance_select_related/models.py   
2010-10-12 02:09:13 UTC (rev 14181)
@@ -27,21 +27,3 @@
 
 def __unicode__(self):
 return self.name
-
-__test__ = {'API_TESTS':"""
-Regression test for #7246
-
->>> r1 = Restaurant.objects.create(name="Nobu", serves_sushi=True, 
serves_steak=False)
->>> r2 = Restaurant.objects.create(name="Craft", serves_sushi=False, 
serves_steak=True)
->>> p1 = Person.objects.create(name="John", favorite_restaurant=r1)
->>> p2 = Person.objects.create(name="Jane", favorite_restaurant=r2)
-
->>> Person.objects.order_by('name').select_related()
-[, ]
-
->>> jane = 
Person.objects.order_by('name').select_related('favorite_restaurant')[0]
->>> jane.favorite_restaurant.name
-u'Craft'
-
-"""}
-

Added: 
django/trunk/tests/regressiontests/model_inheritance_select_related/tests.py
===
--- 
django/trunk/tests/regressiontests/model_inheritance_select_related/tests.py
(rev 0)
+++ 
django/trunk/tests/regressiontests/model_inheritance_select_related/tests.py
2010-10-12 02:09:13 UTC (rev 14181)
@@ -0,0 +1,29 @@
+from operator import attrgetter
+
+from django.test import TestCase
+
+from models import Restaurant, Person
+
+
+class ModelInheritanceSelectRelatedTests(TestCase):
+def test_inherited_select_related(self):
+# Regression test for #7246
+r1 = Restaurant.objects.create(
+name="Nobu", serves_sushi=True, serves_steak=False
+)
+r2 = Restaurant.objects.create(
+name="Craft", serves_sushi=False, serves_steak=True
+)
+p1 = Person.objects.create(name="John", favorite_restaurant=r1)
+p2 = Person.objects.create(name="Jane", favorite_restaurant=r2)
+
+self.assertQuerysetEqual(
+Person.objects.order_by("name").select_related(), [
+"Jane",
+"John",
+],
+attrgetter("name")
+)
+
+jane = 
Person.objects.order_by("name").select_related("favorite_restaurant")[0]
+self.assertEqual(jane.favorite_restaurant.name, "Craft")

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14180 - django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 20:59:46 -0500 (Mon, 11 Oct 2010)
New Revision: 14180

Added:
   
django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress/tests.py
Modified:
   
django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress/models.py
Log:
[1.2.X] Converted initial_sql_regress tests from doctests (sort of...) to 
unittests.  We have always been at war with doctests.  Backport of [14179].

Modified: 
django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress/models.py
===
--- 
django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress/models.py
  2010-10-12 01:59:28 UTC (rev 14179)
+++ 
django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress/models.py
  2010-10-12 01:59:46 UTC (rev 14180)
@@ -7,7 +7,5 @@
 class Simple(models.Model):
 name = models.CharField(max_length = 50)
 
-__test__ = {'API_TESTS':""}
-
 # NOTE: The format of the included SQL file for this test suite is important.
 # It must end with a trailing newline in order to test the fix for #2161.

Added: 
django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress/tests.py
===
--- 
django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress/tests.py
   (rev 0)
+++ 
django/branches/releases/1.2.X/tests/regressiontests/initial_sql_regress/tests.py
   2010-10-12 01:59:46 UTC (rev 14180)
@@ -0,0 +1,8 @@
+from django.test import TestCase
+
+from models import Simple
+
+
+class InitialSQLTests(TestCase):
+def test_initial_sql(self):
+self.assertEqual(Simple.objects.count(), 7)

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14179 - django/trunk/tests/regressiontests/initial_sql_regress

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 20:59:28 -0500 (Mon, 11 Oct 2010)
New Revision: 14179

Added:
   django/trunk/tests/regressiontests/initial_sql_regress/tests.py
Modified:
   django/trunk/tests/regressiontests/initial_sql_regress/models.py
Log:
Converted initial_sql_regress tests from doctests (sort of...) to unittests.  
We have always been at war with doctests.

Modified: django/trunk/tests/regressiontests/initial_sql_regress/models.py
===
--- django/trunk/tests/regressiontests/initial_sql_regress/models.py
2010-10-12 01:54:48 UTC (rev 14178)
+++ django/trunk/tests/regressiontests/initial_sql_regress/models.py
2010-10-12 01:59:28 UTC (rev 14179)
@@ -7,7 +7,5 @@
 class Simple(models.Model):
 name = models.CharField(max_length = 50)
 
-__test__ = {'API_TESTS':""}
-
 # NOTE: The format of the included SQL file for this test suite is important.
 # It must end with a trailing newline in order to test the fix for #2161.

Added: django/trunk/tests/regressiontests/initial_sql_regress/tests.py
===
--- django/trunk/tests/regressiontests/initial_sql_regress/tests.py 
(rev 0)
+++ django/trunk/tests/regressiontests/initial_sql_regress/tests.py 
2010-10-12 01:59:28 UTC (rev 14179)
@@ -0,0 +1,8 @@
+from django.test import TestCase
+
+from models import Simple
+
+
+class InitialSQLTests(TestCase):
+def test_initial_sql(self):
+self.assertEqual(Simple.objects.count(), 7)

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14178 - django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 20:54:48 -0500 (Mon, 11 Oct 2010)
New Revision: 14178

Added:
   
django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress/tests.py
Modified:
   
django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress/models.py
Log:
[1.2.X] Converted get_or_create_regress tests from doctests to unittests.  We 
have always been at war with doctests.  Backport of [14177].

Modified: 
django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress/models.py
===
--- 
django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress/models.py
2010-10-12 01:54:19 UTC (rev 14177)
+++ 
django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress/models.py
2010-10-12 01:54:48 UTC (rev 14178)
@@ -1,5 +1,6 @@
 from django.db import models
 
+
 class Publisher(models.Model):
 name = models.CharField(max_length=100)
 
@@ -10,82 +11,3 @@
 name = models.CharField(max_length=100)
 authors = models.ManyToManyField(Author, related_name='books')
 publisher = models.ForeignKey(Publisher, related_name='books')
-
-
-__test__ = {'one':"""
-#
-# RelatedManager
-#
-
-# First create a Publisher.
->>> p = Publisher.objects.create(name='Acme Publishing')
-
-# Create a book through the publisher.
->>> book, created = p.books.get_or_create(name='The Book of Ed & Fred')
->>> created
-True
-
-# The publisher should have one book.
->>> p.books.count()
-1
-
-# Try get_or_create again, this time nothing should be created.
->>> book, created = p.books.get_or_create(name='The Book of Ed & Fred')
->>> created
-False
-
-# And the publisher should still have one book.
->>> p.books.count()
-1
-
-#
-# ManyRelatedManager
-#
-
-# Add an author to the book.
->>> ed, created = book.authors.get_or_create(name='Ed')
->>> created
-True
-
-# Book should have one author.
->>> book.authors.count()
-1
-
-# Try get_or_create again, this time nothing should be created.
->>> ed, created = book.authors.get_or_create(name='Ed')
->>> created
-False
-
-# And the book should still have one author.
->>> book.authors.count()
-1
-
-# Add a second author to the book.
->>> fred, created = book.authors.get_or_create(name='Fred')
->>> created
-True
-
-# The book should have two authors now.
->>> book.authors.count()
-2
-
-# Create an Author not tied to any books.
->>> Author.objects.create(name='Ted')
-
-
-# There should be three Authors in total. The book object should have two.
->>> Author.objects.count()
-3
->>> book.authors.count()
-2
-
-# Try creating a book through an author.
->>> ed.books.get_or_create(name="Ed's Recipies", publisher=p)
-(, True)
-
-# Now Ed has two Books, Fred just one.
->>> ed.books.count()
-2
->>> fred.books.count()
-1
-"""}

Added: 
django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress/tests.py
===
--- 
django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress/tests.py
 (rev 0)
+++ 
django/branches/releases/1.2.X/tests/regressiontests/get_or_create_regress/tests.py
 2010-10-12 01:54:48 UTC (rev 14178)
@@ -0,0 +1,53 @@
+from django.test import TestCase
+
+from models import Author, Publisher
+
+
+class GetOrCreateTests(TestCase):
+def test_related(self):
+p = Publisher.objects.create(name="Acme Publishing")
+# Create a book through the publisher.
+book, created = p.books.get_or_create(name="The Book of Ed & Fred")
+self.assertTrue(created)
+# The publisher should have one book.
+self.assertEqual(p.books.count(), 1)
+
+# Try get_or_create again, this time nothing should be created.
+book, created = p.books.get_or_create(name="The Book of Ed & Fred")
+self.assertFalse(created)
+# And the publisher should still have one book.
+self.assertEqual(p.books.count(), 1)
+
+# Add an author to the book.
+ed, created = book.authors.get_or_create(name="Ed")
+self.assertTrue(created)
+# Book should have one author.
+self.assertEqual(book.authors.count(), 1)
+
+# Try get_or_create again, this time nothing should be created.
+ed, created = book.authors.get_or_create(name="Ed")
+self.assertFalse(created)
+# And the book should still have one author.
+self.assertEqual(book.authors.count(), 1)
+
+# Add a second author to the book.
+fred, created = book.authors.get_or_create(name="Fred")
+self.assertTrue(created)
+
+# The book should have two authors now.
+self.assertEqual(book.authors.count(), 2)
+
+# Create an Author not tied to any books.
+Author.objects.create(name="Ted")
+
+# There should be three Authors in total. The book object should have 
two.
+self.assertEqual(Author.objects.count(), 3)
+

[Changeset] r14177 - django/trunk/tests/regressiontests/get_or_create_regress

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 20:54:19 -0500 (Mon, 11 Oct 2010)
New Revision: 14177

Added:
   django/trunk/tests/regressiontests/get_or_create_regress/tests.py
Modified:
   django/trunk/tests/regressiontests/get_or_create_regress/models.py
Log:
Converted get_or_create_regress tests from doctests to unittests.  We have 
always been at war with doctests.

Modified: django/trunk/tests/regressiontests/get_or_create_regress/models.py
===
--- django/trunk/tests/regressiontests/get_or_create_regress/models.py  
2010-10-12 01:48:21 UTC (rev 14176)
+++ django/trunk/tests/regressiontests/get_or_create_regress/models.py  
2010-10-12 01:54:19 UTC (rev 14177)
@@ -1,5 +1,6 @@
 from django.db import models
 
+
 class Publisher(models.Model):
 name = models.CharField(max_length=100)
 
@@ -10,82 +11,3 @@
 name = models.CharField(max_length=100)
 authors = models.ManyToManyField(Author, related_name='books')
 publisher = models.ForeignKey(Publisher, related_name='books')
-
-
-__test__ = {'one':"""
-#
-# RelatedManager
-#
-
-# First create a Publisher.
->>> p = Publisher.objects.create(name='Acme Publishing')
-
-# Create a book through the publisher.
->>> book, created = p.books.get_or_create(name='The Book of Ed & Fred')
->>> created
-True
-
-# The publisher should have one book.
->>> p.books.count()
-1
-
-# Try get_or_create again, this time nothing should be created.
->>> book, created = p.books.get_or_create(name='The Book of Ed & Fred')
->>> created
-False
-
-# And the publisher should still have one book.
->>> p.books.count()
-1
-
-#
-# ManyRelatedManager
-#
-
-# Add an author to the book.
->>> ed, created = book.authors.get_or_create(name='Ed')
->>> created
-True
-
-# Book should have one author.
->>> book.authors.count()
-1
-
-# Try get_or_create again, this time nothing should be created.
->>> ed, created = book.authors.get_or_create(name='Ed')
->>> created
-False
-
-# And the book should still have one author.
->>> book.authors.count()
-1
-
-# Add a second author to the book.
->>> fred, created = book.authors.get_or_create(name='Fred')
->>> created
-True
-
-# The book should have two authors now.
->>> book.authors.count()
-2
-
-# Create an Author not tied to any books.
->>> Author.objects.create(name='Ted')
-
-
-# There should be three Authors in total. The book object should have two.
->>> Author.objects.count()
-3
->>> book.authors.count()
-2
-
-# Try creating a book through an author.
->>> ed.books.get_or_create(name="Ed's Recipies", publisher=p)
-(, True)
-
-# Now Ed has two Books, Fred just one.
->>> ed.books.count()
-2
->>> fred.books.count()
-1
-"""}

Added: django/trunk/tests/regressiontests/get_or_create_regress/tests.py
===
--- django/trunk/tests/regressiontests/get_or_create_regress/tests.py   
(rev 0)
+++ django/trunk/tests/regressiontests/get_or_create_regress/tests.py   
2010-10-12 01:54:19 UTC (rev 14177)
@@ -0,0 +1,53 @@
+from django.test import TestCase
+
+from models import Author, Publisher
+
+
+class GetOrCreateTests(TestCase):
+def test_related(self):
+p = Publisher.objects.create(name="Acme Publishing")
+# Create a book through the publisher.
+book, created = p.books.get_or_create(name="The Book of Ed & Fred")
+self.assertTrue(created)
+# The publisher should have one book.
+self.assertEqual(p.books.count(), 1)
+
+# Try get_or_create again, this time nothing should be created.
+book, created = p.books.get_or_create(name="The Book of Ed & Fred")
+self.assertFalse(created)
+# And the publisher should still have one book.
+self.assertEqual(p.books.count(), 1)
+
+# Add an author to the book.
+ed, created = book.authors.get_or_create(name="Ed")
+self.assertTrue(created)
+# Book should have one author.
+self.assertEqual(book.authors.count(), 1)
+
+# Try get_or_create again, this time nothing should be created.
+ed, created = book.authors.get_or_create(name="Ed")
+self.assertFalse(created)
+# And the book should still have one author.
+self.assertEqual(book.authors.count(), 1)
+
+# Add a second author to the book.
+fred, created = book.authors.get_or_create(name="Fred")
+self.assertTrue(created)
+
+# The book should have two authors now.
+self.assertEqual(book.authors.count(), 2)
+
+# Create an Author not tied to any books.
+Author.objects.create(name="Ted")
+
+# There should be three Authors in total. The book object should have 
two.
+self.assertEqual(Author.objects.count(), 3)
+self.assertEqual(book.authors.count(), 2)
+
+# Try creating a book through an author.
+_, created = ed.books.get_or_create(name="Ed's Recipes", publisher=p)
+self.assertTrue(created)
+

[Changeset] r14176 - in django/trunk: . docs/internals

2010-10-11 Thread noreply
Author: Honza_Kral
Date: 2010-10-11 20:48:21 -0500 (Mon, 11 Oct 2010)
New Revision: 14176

Modified:
   django/trunk/AUTHORS
   django/trunk/docs/internals/committers.txt
Log:
Added myself to committers


Modified: django/trunk/AUTHORS
===
--- django/trunk/AUTHORS2010-10-12 01:03:53 UTC (rev 14175)
+++ django/trunk/AUTHORS2010-10-12 01:48:21 UTC (rev 14176)
@@ -23,6 +23,7 @@
 * Carl Meyer
 * Ramiro Morales
 * Chris Beaven
+* Honza Král
 
 More information on the main contributors to Django can be found in
 docs/internals/committers.txt.
@@ -273,7 +274,6 @@
 Gasper Koren
 Martin Kosír 
 Arthur Koziel 
-Honza Král 
 Meir Kriheli 
 Bruce Kroeze 
 krzysiek.paw...@silvermedia.pl

Modified: django/trunk/docs/internals/committers.txt
===
--- django/trunk/docs/internals/committers.txt  2010-10-12 01:03:53 UTC (rev 
14175)
+++ django/trunk/docs/internals/committers.txt  2010-10-12 01:48:21 UTC (rev 
14176)
@@ -268,6 +268,19 @@
 .. _Chris Beaven: http://smileychris.com/
 .. _Lincoln Loop: http://lincolnloop.com/
 
+Honza Král
+Honza first discovered Django in 2006 and started using it right away,
+first for school and personal projects and later in his full time job. He
+contributed various patches and fixes mostly to the newforms library,
+newforms admin and, through participation in the Google Summer of Code
+project, assisted in creating the :ref:`model validation
+` functionality.
+
+He is currently working for `Whiskey Media`_ in San Francisco developing
+awesome sites running on pure Django.
+
+.. _Whiskey Media: http://www.whiskeymedia.com/
+
 Specialists
 ---
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] #14348: Paginator does not handle django.db.models.sql.datastructures.EmptyResultSet

2010-10-11 Thread Django
#14348: Paginator does not handle
django.db.models.sql.datastructures.EmptyResultSet
---+
  Reporter:  teh   | Owner:  nobody
Status:  new   | Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.2   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  1 
Needs_better_patch:  1 |  
---+
Changes (by Alex):

  * component:  Core framework => Database layer (models, ORM)

Comment:

 EmptyResultSet should never escape the ORM internals, if it is *thats* the
 bug.  And that's what we need a test/patch for.

-- 
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-upda...@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] #14348: Paginator does not handle django.db.models.sql.datastructures.EmptyResultSet

2010-10-11 Thread Django
#14348: Paginator does not handle
django.db.models.sql.datastructures.EmptyResultSet
-+--
  Reporter:  teh | Owner:  nobody
Status:  new | Milestone:
 Component:  Core framework  |   Version:  1.2   
Resolution:  |  Keywords:
 Stage:  Accepted| Has_patch:  1 
Needs_docs:  0   |   Needs_tests:  1 
Needs_better_patch:  1   |  
-+--
Changes (by gabrielhurley):

  * needs_better_patch:  => 1
  * has_patch:  0 => 1
  * stage:  Unreviewed => Accepted
  * needs_tests:  => 1
  * needs_docs:  => 0

Comment:

 I'm curious how you got !EmptyResultSet into Paginator to begin with... I
 thought !EmptyResultSet was pretty much only used in the Django internals.

 That aside, I wonder if adding a `__len__` method on !EmptyResultSet might
 be a better option than catching another exception. Treat the problem, not
 the symptom, right?

 Also, you'll need a unit test for the patch, which would be a good way to
 demonstrate how EmptyResultSet gets into Paginator...

-- 
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-upda...@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] #14098: Add "--skip" option to inspectdb.

2010-10-11 Thread Django
#14098: Add "--skip" option to inspectdb.
+---
  Reporter:  adamv  | Owner:  nobody
Status:  new| Milestone:
 Component:  django-admin.py inspectdb  |   Version:  1.2   
Resolution: |  Keywords:
 Stage:  Accepted   | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by gabrielhurley):

  * stage:  Unreviewed => Accepted

-- 
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-upda...@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] #14445: Use HMAC and constant-time comparison functions where needed in Django

2010-10-11 Thread Django
#14445: Use HMAC and constant-time comparison functions where needed in Django
+---
  Reporter:  lukeplant  | Owner:  nobody
Status:  new| Milestone:  1.3   
 Component:  Uncategorized  |   Version:  1.2   
Resolution: |  Keywords:
 Stage:  Accepted   | Has_patch:  1 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by gabrielhurley):

  * has_patch:  0 => 1
  * stage:  Unreviewed => Accepted
  * milestone:  => 1.3

-- 
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-upda...@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] #14342: Part 2 of the Tutorial -- path format for TEMPLATE_DIR

2010-10-11 Thread Django
#14342: Part 2 of the Tutorial -- path format for TEMPLATE_DIR
+---
  Reporter:  nwokedi| Owner:  nobody
Status:  closed | Milestone:
 Component:  Documentation  |   Version:  1.2   
Resolution:  worksforme |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by gabrielhurley):

  * status:  new => closed
  * needs_better_patch:  => 0
  * component:  Uncategorized => Documentation
  * needs_tests:  => 0
  * needs_docs:  => 0
  * resolution:  => worksforme

Comment:

 Django should find the template provided the following:

  1. The template is named correctly,
  2. The template is in an `admin` directory
  3. The `admin` directory is within a directory named in your
 TEMPLATE_DIRS setting.

 I believe the tutorial has proper instructions for accomplishing that if
 read carefully.

 In your case, the template is being found at
 `mysite/polls/templates/admin` as you mention because the generic
 `django.template.loaders.app_directories.load_template_source` in
 TEMPLATE_LOADERS is finding it.

 My guess is that you simply missed a detail in the tutorial or mistyped
 something in your paths.

 If you still feel this is a problem, please give us more information about
 the directory you tried placing the template in, and what exactly your
 TEMPLATE_DIRS looked like?

-- 
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-upda...@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] #10420: Running gis tests via runtests doesn't work.

2010-10-11 Thread Django
#10420: Running gis tests via runtests doesn't work.
--+-
  Reporter:  mtredinnick  | Owner:  jbronn
Status:  assigned | Milestone:
 Component:  GIS  |   Version:  SVN   
Resolution:   |  Keywords:
 Stage:  Accepted | Has_patch:  0 
Needs_docs:  0|   Needs_tests:  0 
Needs_better_patch:  0|  
--+-
Changes (by jbronn):

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

Comment:

 I'll see what I can do.

-- 
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-upda...@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] r14175 - in django/trunk/django/contrib/admin: . templatetags views

2010-10-11 Thread noreply
Author: SmileyChris
Date: 2010-10-11 20:03:53 -0500 (Mon, 11 Oct 2010)
New Revision: 14175

Modified:
   django/trunk/django/contrib/admin/__init__.py
   django/trunk/django/contrib/admin/actions.py
   django/trunk/django/contrib/admin/helpers.py
   django/trunk/django/contrib/admin/options.py
   django/trunk/django/contrib/admin/templatetags/admin_list.py
   django/trunk/django/contrib/admin/util.py
   django/trunk/django/contrib/admin/validation.py
   django/trunk/django/contrib/admin/views/decorators.py
   django/trunk/django/contrib/admin/views/main.py
Log:
Fixed #14425 -- Unused imports in contrib.admin. Thanks robhudson.

Modified: django/trunk/django/contrib/admin/__init__.py
===
--- django/trunk/django/contrib/admin/__init__.py   2010-10-12 01:02:57 UTC 
(rev 14174)
+++ django/trunk/django/contrib/admin/__init__.py   2010-10-12 01:03:53 UTC 
(rev 14175)
@@ -1,4 +1,3 @@
-from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME
 from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL
 from django.contrib.admin.options import StackedInline, TabularInline
 from django.contrib.admin.sites import AdminSite, site

Modified: django/trunk/django/contrib/admin/actions.py
===
--- django/trunk/django/contrib/admin/actions.py2010-10-12 01:02:57 UTC 
(rev 14174)
+++ django/trunk/django/contrib/admin/actions.py2010-10-12 01:03:53 UTC 
(rev 14175)
@@ -8,9 +8,6 @@
 from django.contrib.admin.util import get_deleted_objects, model_ngettext
 from django.shortcuts import render_to_response
 from django.utils.encoding import force_unicode
-from django.utils.html import escape
-from django.utils.safestring import mark_safe
-from django.utils.text import capfirst
 from django.utils.translation import ugettext_lazy, ugettext as _
 
 def delete_selected(modeladmin, request, queryset):

Modified: django/trunk/django/contrib/admin/helpers.py
===
--- django/trunk/django/contrib/admin/helpers.py2010-10-12 01:02:57 UTC 
(rev 14174)
+++ django/trunk/django/contrib/admin/helpers.py2010-10-12 01:03:53 UTC 
(rev 14175)
@@ -4,7 +4,6 @@
 from django.contrib.admin.util import display_for_field, label_for_field
 from django.contrib.contenttypes.models import ContentType
 from django.core.exceptions import ObjectDoesNotExist
-from django.db.models.fields import FieldDoesNotExist
 from django.db.models.fields.related import ManyToManyRel
 from django.forms.util import flatatt
 from django.template.defaultfilters import capfirst

Modified: django/trunk/django/contrib/admin/options.py
===
--- django/trunk/django/contrib/admin/options.py2010-10-12 01:02:57 UTC 
(rev 14174)
+++ django/trunk/django/contrib/admin/options.py2010-10-12 01:03:53 UTC 
(rev 14175)
@@ -5,7 +5,7 @@
 from django.contrib.contenttypes.models import ContentType
 from django.contrib.admin import widgets
 from django.contrib.admin import helpers
-from django.contrib.admin.util import unquote, flatten_fieldsets, 
get_deleted_objects, model_ngettext, model_format_dict
+from django.contrib.admin.util import unquote, flatten_fieldsets, 
get_deleted_objects, model_format_dict
 from django.contrib import messages
 from django.views.decorators.csrf import csrf_protect
 from django.core.exceptions import PermissionDenied, ValidationError
@@ -21,7 +21,7 @@
 from django.utils.functional import curry
 from django.utils.text import capfirst, get_text_list
 from django.utils.translation import ugettext as _
-from django.utils.translation import ungettext, ugettext_lazy
+from django.utils.translation import ungettext
 from django.utils.encoding import force_unicode
 
 HORIZONTAL, VERTICAL = 1, 2

Modified: django/trunk/django/contrib/admin/templatetags/admin_list.py
===
--- django/trunk/django/contrib/admin/templatetags/admin_list.py
2010-10-12 01:02:57 UTC (rev 14174)
+++ django/trunk/django/contrib/admin/templatetags/admin_list.py
2010-10-12 01:03:53 UTC (rev 14175)
@@ -6,7 +6,6 @@
 from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, 
PAGE_VAR, SEARCH_VAR
 from django.core.exceptions import ObjectDoesNotExist
 from django.db import models
-from django.forms.forms import pretty_name
 from django.utils import formats
 from django.utils.html import escape, conditional_escape
 from django.utils.safestring import mark_safe

Modified: django/trunk/django/contrib/admin/util.py
===
--- django/trunk/django/contrib/admin/util.py   2010-10-12 01:02:57 UTC (rev 
14174)
+++ django/trunk/django/contrib/admin/util.py   2010-10-12 01:03:53 UTC (rev 
14175)
@@ -1,4 +1,3 @@
-from django.core.exceptions import 

[Changeset] r14174 - django/branches/releases/1.2.X/tests/modeltests/many_to_one_null

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 20:02:57 -0500 (Mon, 11 Oct 2010)
New Revision: 14174

Modified:
   django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/tests.py
Log:
[1.2.X] Tweak to many_to_one_null doctest to avoid primary key assumptions 
(causing breakage on PostgreSQL).

Backport of r14168 from trunk.

Modified: 
django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/tests.py
===
--- django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/tests.py   
2010-10-12 01:02:37 UTC (rev 14173)
+++ django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/tests.py   
2010-10-12 01:02:57 UTC (rev 14174)
@@ -40,7 +40,7 @@
 def test_created_without_related(self):
 self.assertEqual(self.a3.reporter, None)
 # Need to reget a3 to refresh the cache
-a3 = Article.objects.get(pk=3)
+a3 = Article.objects.get(pk=self.a3.pk)
 self.assertRaises(AttributeError, getattr, a3.reporter, 'id')
 # Accessing an article's 'reporter' attribute returns None
 # if the reporter is set to None.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14173 - django/branches/releases/1.2.X/tests/modeltests/one_to_one

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 20:02:37 -0500 (Mon, 11 Oct 2010)
New Revision: 14173

Added:
   django/branches/releases/1.2.X/tests/modeltests/one_to_one/tests.py
Modified:
   django/branches/releases/1.2.X/tests/modeltests/one_to_one/models.py
Log:
[1.2.X] Migrated one_to_one doctests. Thanks to George Sakkis for the patch. 
(We have always been at war with doctests)

Backport of r14167 from trunk.

Modified: django/branches/releases/1.2.X/tests/modeltests/one_to_one/models.py
===
--- django/branches/releases/1.2.X/tests/modeltests/one_to_one/models.py
2010-10-12 01:02:13 UTC (rev 14172)
+++ django/branches/releases/1.2.X/tests/modeltests/one_to_one/models.py
2010-10-12 01:02:37 UTC (rev 14173)
@@ -45,150 +45,3 @@
 
 def __unicode__(self):
 return u"Multimodel %s" % self.name
-
-__test__ = {'API_TESTS':"""
-# Create a couple of Places.
->>> p1 = Place(name='Demon Dogs', address='944 W. Fullerton')
->>> p1.save()
->>> p2 = Place(name='Ace Hardware', address='1013 N. Ashland')
->>> p2.save()
-
-# Create a Restaurant. Pass the ID of the "parent" object as this object's ID.
->>> r = Restaurant(place=p1, serves_hot_dogs=True, serves_pizza=False)
->>> r.save()
-
-# A Restaurant can access its place.
->>> r.place
-
-
-# A Place can access its restaurant, if available.
->>> p1.restaurant
-
-
-# p2 doesn't have an associated restaurant.
->>> p2.restaurant
-Traceback (most recent call last):
-...
-DoesNotExist: Restaurant matching query does not exist.
-
-# Set the place using assignment notation. Because place is the primary key on
-# Restaurant, the save will create a new restaurant
->>> r.place = p2
->>> r.save()
->>> p2.restaurant
-
->>> r.place
-
->>> p2.id
-2
-
-# Set the place back again, using assignment in the reverse direction.
->>> p1.restaurant = r
->>> p1.restaurant
-
-
->>> r = Restaurant.objects.get(pk=1)
->>> r.place
-
-
-# Restaurant.objects.all() just returns the Restaurants, not the Places.
-# Note that there are two restaurants - Ace Hardware the Restaurant was created
-# in the call to r.place = p2.
->>> Restaurant.objects.all()
-[, ]
-
-# Place.objects.all() returns all Places, regardless of whether they have
-# Restaurants.
->>> Place.objects.order_by('name')
-[, ]
-
->>> Restaurant.objects.get(place__id__exact=1)
-
->>> Restaurant.objects.get(pk=1)
-
->>> Restaurant.objects.get(place__exact=1)
-
->>> Restaurant.objects.get(place__exact=p1)
-
->>> Restaurant.objects.get(place=1)
-
->>> Restaurant.objects.get(place=p1)
-
->>> Restaurant.objects.get(place__pk=1)
-
->>> Restaurant.objects.get(place__name__startswith="Demon")
-
-
->>> Place.objects.get(id__exact=1)
-
->>> Place.objects.get(pk=1)
-
->>> Place.objects.get(restaurant__place__exact=1)
-
->>> Place.objects.get(restaurant__place__exact=p1)
-
->>> Place.objects.get(restaurant__pk=1)
-
->>> Place.objects.get(restaurant=1)
-
->>> Place.objects.get(restaurant=r)
-
->>> Place.objects.get(restaurant__exact=1)
-
->>> Place.objects.get(restaurant__exact=r)
-
-
-# Add a Waiter to the Restaurant.
->>> w = r.waiter_set.create(name='Joe')
->>> w.save()
->>> w
-
-
-# Query the waiters
->>> Waiter.objects.filter(restaurant__place__pk=1)
-[]
->>> Waiter.objects.filter(restaurant__place__exact=1)
-[]
->>> Waiter.objects.filter(restaurant__place__exact=p1)
-[]
->>> Waiter.objects.filter(restaurant__pk=1)
-[]
->>> Waiter.objects.filter(id__exact=1)
-[]
->>> Waiter.objects.filter(pk=1)
-[]
->>> Waiter.objects.filter(restaurant=1)
-[]
->>> Waiter.objects.filter(restaurant=r)
-[]
-
-# Delete the restaurant; the waiter should also be removed
->>> r = Restaurant.objects.get(pk=1)
->>> r.delete()
-
-# One-to-one fields still work if you create your own primary key
->>> o1 = ManualPrimaryKey(primary_key="abc123", name="primary")
->>> o1.save()
->>> o2 = RelatedModel(link=o1, name="secondary")
->>> o2.save()
-
-# You can have multiple one-to-one fields on a model, too.
->>> x1 = MultiModel(link1=p1, link2=o1, name="x1")
->>> x1.save()
->>> o1.multimodel
-
-
-# This will fail because each one-to-one field must be unique (and link2=o1 was
-# used for x1, above).
->>> sid = transaction.savepoint()
->>> try:
-... MultiModel(link1=p2, link2=o1, name="x1").save()
-... except Exception, e:
-... if isinstance(e, IntegrityError):
-... print "Pass"
-... else:
-... print "Fail with %s" % type(e)
-Pass
->>> transaction.savepoint_rollback(sid)
-
-"""}

Added: django/branches/releases/1.2.X/tests/modeltests/one_to_one/tests.py
===
--- django/branches/releases/1.2.X/tests/modeltests/one_to_one/tests.py 
(rev 0)
+++ django/branches/releases/1.2.X/tests/modeltests/one_to_one/tests.py 
2010-10-12 01:02:37 UTC (rev 14173)
@@ -0,0 +1,119 @@
+from django.test import TestCase
+from django.db import transaction, IntegrityError
+from models import Place, Restaurant, 

[Changeset] r14172 - django/branches/releases/1.2.X/tests/modeltests/many_to_one_null

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 20:02:13 -0500 (Mon, 11 Oct 2010)
New Revision: 14172

Added:
   django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/tests.py
Modified:
   django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/models.py
Log:
[1.2.X] Migrated many_to_one_null doctests. Thanks to George Sakkis for the 
patch.

Backport of r14166 from trunk.

Modified: 
django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/models.py
===
--- django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/models.py  
2010-10-12 01:01:49 UTC (rev 14171)
+++ django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/models.py  
2010-10-12 01:02:13 UTC (rev 14172)
@@ -22,108 +22,3 @@
 
 def __unicode__(self):
 return self.headline
-
-__test__ = {'API_TESTS':"""
-# Create a Reporter.
->>> r = Reporter(name='John Smith')
->>> r.save()
-
-# Create an Article.
->>> a = Article(headline="First", reporter=r)
->>> a.save()
-
->>> a.reporter.id
-1
-
->>> a.reporter
-
-
-# Article objects have access to their related Reporter objects.
->>> r = a.reporter
-
-# Create an Article via the Reporter object.
->>> a2 = r.article_set.create(headline="Second")
->>> a2
-
->>> a2.reporter.id
-1
-
-# Reporter objects have access to their related Article objects.
->>> r.article_set.all()
-[, ]
->>> r.article_set.filter(headline__startswith='Fir')
-[]
->>> r.article_set.count()
-2
-
-# Create an Article with no Reporter by passing "reporter=None".
->>> a3 = Article(headline="Third", reporter=None)
->>> a3.save()
->>> a3.id
-3
->>> print a3.reporter
-None
-
-# Need to reget a3 to refresh the cache
->>> a3 = Article.objects.get(pk=3)
->>> print a3.reporter.id
-Traceback (most recent call last):
-...
-AttributeError: 'NoneType' object has no attribute 'id'
-
-# Accessing an article's 'reporter' attribute returns None
-# if the reporter is set to None.
->>> print a3.reporter
-None
-
-# To retrieve the articles with no reporters set, use "reporter__isnull=True".
->>> Article.objects.filter(reporter__isnull=True)
-[]
-
-# We can achieve the same thing by filtering for the case where the reporter is
-# None.
->>> Article.objects.filter(reporter=None)
-[]
-
-# Set the reporter for the Third article
->>> r.article_set.add(a3)
->>> r.article_set.all()
-[, , ]
-
-# Remove an article from the set, and check that it was removed.
->>> r.article_set.remove(a3)
->>> r.article_set.all()
-[, ]
->>> Article.objects.filter(reporter__isnull=True)
-[]
-
-# Create another article and reporter
->>> r2 = Reporter(name='Paul Jones')
->>> r2.save()
->>> a4 = r2.article_set.create(headline='Fourth')
->>> r2.article_set.all()
-[]
-
-# Try to remove a4 from a set it does not belong to
->>> r.article_set.remove(a4)
-Traceback (most recent call last):
-...
-DoesNotExist:  is not related to .
-
->>> r2.article_set.all()
-[]
-
-# Use descriptor assignment to allocate ForeignKey. Null is legal, so
-# existing members of set that are not in the assignment set are set null
->>> r2.article_set = [a2, a3]
->>> r2.article_set.all()
-[, ]
-
-# Clear the rest of the set
->>> r.article_set.clear()
->>> r.article_set.all()
-[]
->>> Article.objects.filter(reporter__isnull=True)
-[, ]
-
-"""}

Added: django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/tests.py
===
--- django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/tests.py   
(rev 0)
+++ django/branches/releases/1.2.X/tests/modeltests/many_to_one_null/tests.py   
2010-10-12 01:02:13 UTC (rev 14172)
@@ -0,0 +1,84 @@
+from django.test import TestCase
+from models import Reporter, Article
+
+class ManyToOneNullTests(TestCase):
+
+def setUp(self):
+# Create a Reporter.
+self.r = Reporter(name='John Smith')
+self.r.save()
+# Create an Article.
+self.a = Article(headline="First", reporter=self.r)
+self.a.save()
+# Create an Article via the Reporter object.
+self.a2 = self.r.article_set.create(headline="Second")
+# Create an Article with no Reporter by passing "reporter=None".
+self.a3 = Article(headline="Third", reporter=None)
+self.a3.save()
+# Create another article and reporter
+self.r2 = Reporter(name='Paul Jones')
+self.r2.save()
+self.a4 = self.r2.article_set.create(headline='Fourth')
+
+def test_get_related(self):
+self.assertEqual(self.a.reporter.id, self.r.id)
+# Article objects have access to their related Reporter objects.
+r = self.a.reporter
+self.assertEqual(r.id, self.r.id)
+
+def test_created_via_related_set(self):
+self.assertEqual(self.a2.reporter.id, self.r.id)
+
+def test_related_set(self):
+# Reporter objects have access to their related Article objects.
+

[Changeset] r14171 - django/branches/releases/1.2.X/tests/modeltests/properties

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 20:01:49 -0500 (Mon, 11 Oct 2010)
New Revision: 14171

Added:
   django/branches/releases/1.2.X/tests/modeltests/properties/tests.py
Modified:
   django/branches/releases/1.2.X/tests/modeltests/properties/models.py
Log:
[1.2.X] Migrated properties doctests. Thanks to George Sakkis for the patch.

Backport of r14165 from trunk.

Modified: django/branches/releases/1.2.X/tests/modeltests/properties/models.py
===
--- django/branches/releases/1.2.X/tests/modeltests/properties/models.py
2010-10-12 01:01:25 UTC (rev 14170)
+++ django/branches/releases/1.2.X/tests/modeltests/properties/models.py
2010-10-12 01:01:49 UTC (rev 14171)
@@ -19,22 +19,3 @@
 full_name = property(_get_full_name)
 
 full_name_2 = property(_get_full_name, _set_full_name)
-
-__test__ = {'API_TESTS':"""
->>> a = Person(first_name='John', last_name='Lennon')
->>> a.save()
->>> a.full_name
-'John Lennon'
-
-# The "full_name" property hasn't provided a "set" method.
->>> a.full_name = 'Paul McCartney'
-Traceback (most recent call last):
-...
-AttributeError: can't set attribute
-
-# But "full_name_2" has, and it can be used to initialise the class.
->>> a2 = Person(full_name_2 = 'Paul McCartney')
->>> a2.save()
->>> a2.first_name
-'Paul'
-"""}

Added: django/branches/releases/1.2.X/tests/modeltests/properties/tests.py
===
--- django/branches/releases/1.2.X/tests/modeltests/properties/tests.py 
(rev 0)
+++ django/branches/releases/1.2.X/tests/modeltests/properties/tests.py 
2010-10-12 01:01:49 UTC (rev 14171)
@@ -0,0 +1,20 @@
+from django.test import TestCase
+from models import Person
+
+class PropertyTests(TestCase):
+
+def setUp(self):
+self.a = Person(first_name='John', last_name='Lennon')
+self.a.save()
+
+def test_getter(self):
+self.assertEqual(self.a.full_name, 'John Lennon')
+
+def test_setter(self):
+# The "full_name" property hasn't provided a "set" method.
+self.assertRaises(AttributeError, setattr, self.a, 'full_name', 'Paul 
McCartney')
+
+# But "full_name_2" has, and it can be used to initialise the class.
+a2 = Person(full_name_2 = 'Paul McCartney')
+a2.save()
+self.assertEqual(a2.first_name, 'Paul')

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14170 - django/branches/releases/1.2.X/tests/modeltests/mutually_referential

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 20:01:25 -0500 (Mon, 11 Oct 2010)
New Revision: 14170

Added:
   django/branches/releases/1.2.X/tests/modeltests/mutually_referential/tests.py
Modified:
   
django/branches/releases/1.2.X/tests/modeltests/mutually_referential/models.py
Log:
[1.2.X] Migrated the mutually_referential doctests. Thanks to George Sakkis for 
the patch.

Backport of r14164 from trunk.

Modified: 
django/branches/releases/1.2.X/tests/modeltests/mutually_referential/models.py
===
--- 
django/branches/releases/1.2.X/tests/modeltests/mutually_referential/models.py  
2010-10-12 01:00:58 UTC (rev 14169)
+++ 
django/branches/releases/1.2.X/tests/modeltests/mutually_referential/models.py  
2010-10-12 01:01:25 UTC (rev 14170)
@@ -8,29 +8,12 @@
 
 class Parent(Model):
 name = CharField(max_length=100)
-
+
 # Use a simple string for forward declarations.
 bestchild = ForeignKey("Child", null=True, related_name="favoured_by")
 
 class Child(Model):
 name = CharField(max_length=100)
-
+
 # You can also explicitally specify the related app.
 parent = ForeignKey("mutually_referential.Parent")
-
-__test__ = {'API_TESTS':"""
-# Create a Parent
->>> q = Parent(name='Elizabeth')
->>> q.save()
-
-# Create some children
->>> c = q.child_set.create(name='Charles')
->>> e = q.child_set.create(name='Edward')
-
-# Set the best child
->>> q.bestchild = c
->>> q.save()
-
->>> q.delete()
-
-"""}
\ No newline at end of file

Added: 
django/branches/releases/1.2.X/tests/modeltests/mutually_referential/tests.py
===
--- 
django/branches/releases/1.2.X/tests/modeltests/mutually_referential/tests.py   
(rev 0)
+++ 
django/branches/releases/1.2.X/tests/modeltests/mutually_referential/tests.py   
2010-10-12 01:01:25 UTC (rev 14170)
@@ -0,0 +1,20 @@
+from django.test import TestCase
+from models import Parent, Child
+
+class MutuallyReferentialTests(TestCase):
+
+def test_mutually_referential(self):
+# Create a Parent
+q = Parent(name='Elizabeth')
+q.save()
+
+# Create some children
+c = q.child_set.create(name='Charles')
+e = q.child_set.create(name='Edward')
+
+# Set the best child
+# No assertion require here; if basic assignment and
+# deletion works, the test passes.
+q.bestchild = c
+q.save()
+q.delete()

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14169 - in django/branches/releases/1.2.X/tests/modeltests: . m2o_recursive

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 20:00:58 -0500 (Mon, 11 Oct 2010)
New Revision: 14169

Added:
   django/branches/releases/1.2.X/tests/modeltests/m2o_recursive/tests.py
Removed:
   django/branches/releases/1.2.X/tests/modeltests/m2o_recursive2/
Modified:
   django/branches/releases/1.2.X/tests/modeltests/m2o_recursive/models.py
Log:
[1.2.X] Migrated m2o_recursive and m2o_recursive2 tests, merging them into a 
single package. Thanks to George Sakkis for the patches.

Backport of r14163 from trunk.

Modified: 
django/branches/releases/1.2.X/tests/modeltests/m2o_recursive/models.py
===
--- django/branches/releases/1.2.X/tests/modeltests/m2o_recursive/models.py 
2010-10-12 00:56:40 UTC (rev 14168)
+++ django/branches/releases/1.2.X/tests/modeltests/m2o_recursive/models.py 
2010-10-12 01:00:58 UTC (rev 14169)
@@ -19,22 +19,10 @@
 def __unicode__(self):
 return self.name
 
-__test__ = {'API_TESTS':"""
-# Create a few Category objects.
->>> r = Category(id=None, name='Root category', parent=None)
->>> r.save()
->>> c = Category(id=None, name='Child category', parent=r)
->>> c.save()
+class Person(models.Model):
+full_name = models.CharField(max_length=20)
+mother = models.ForeignKey('self', null=True, 
related_name='mothers_child_set')
+father = models.ForeignKey('self', null=True, 
related_name='fathers_child_set')
 
->>> r.child_set.all()
-[]
->>> r.child_set.get(name__startswith='Child')
-
->>> print r.parent
-None
-
->>> c.child_set.all()
-[]
->>> c.parent
-
-"""}
+def __unicode__(self):
+return self.full_name

Added: django/branches/releases/1.2.X/tests/modeltests/m2o_recursive/tests.py
===
--- django/branches/releases/1.2.X/tests/modeltests/m2o_recursive/tests.py  
(rev 0)
+++ django/branches/releases/1.2.X/tests/modeltests/m2o_recursive/tests.py  
2010-10-12 01:00:58 UTC (rev 14169)
@@ -0,0 +1,38 @@
+from django.test import TestCase
+from models import Category, Person
+
+class ManyToOneRecursiveTests(TestCase):
+
+def setUp(self):
+self.r = Category(id=None, name='Root category', parent=None)
+self.r.save()
+self.c = Category(id=None, name='Child category', parent=self.r)
+self.c.save()
+
+def test_m2o_recursive(self):
+self.assertQuerysetEqual(self.r.child_set.all(),
+ [''])
+self.assertEqual(self.r.child_set.get(name__startswith='Child').id, 
self.c.id)
+self.assertEqual(self.r.parent, None)
+self.assertQuerysetEqual(self.c.child_set.all(), [])
+self.assertEqual(self.c.parent.id, self.r.id)
+
+class MultipleManyToOneRecursiveTests(TestCase):
+
+def setUp(self):
+self.dad = Person(full_name='John Smith Senior', mother=None, 
father=None)
+self.dad.save()
+self.mom = Person(full_name='Jane Smith', mother=None, father=None)
+self.mom.save()
+self.kid = Person(full_name='John Smith Junior', mother=self.mom, 
father=self.dad)
+self.kid.save()
+
+def test_m2o_recursive2(self):
+self.assertEqual(self.kid.mother.id, self.mom.id)
+self.assertEqual(self.kid.father.id, self.dad.id)
+self.assertQuerysetEqual(self.dad.fathers_child_set.all(),
+ [''])
+self.assertQuerysetEqual(self.mom.mothers_child_set.all(),
+ [''])
+self.assertQuerysetEqual(self.kid.mothers_child_set.all(), [])
+self.assertQuerysetEqual(self.kid.fathers_child_set.all(), [])

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14168 - django/trunk/tests/modeltests/many_to_one_null

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 19:56:40 -0500 (Mon, 11 Oct 2010)
New Revision: 14168

Modified:
   django/trunk/tests/modeltests/many_to_one_null/tests.py
Log:
Tweak to many_to_one_null doctest to avoid primary key assumptions (causing 
breakage on PostgreSQL).

Modified: django/trunk/tests/modeltests/many_to_one_null/tests.py
===
--- django/trunk/tests/modeltests/many_to_one_null/tests.py 2010-10-12 
00:56:19 UTC (rev 14167)
+++ django/trunk/tests/modeltests/many_to_one_null/tests.py 2010-10-12 
00:56:40 UTC (rev 14168)
@@ -40,7 +40,7 @@
 def test_created_without_related(self):
 self.assertEqual(self.a3.reporter, None)
 # Need to reget a3 to refresh the cache
-a3 = Article.objects.get(pk=3)
+a3 = Article.objects.get(pk=self.a3.pk)
 self.assertRaises(AttributeError, getattr, a3.reporter, 'id')
 # Accessing an article's 'reporter' attribute returns None
 # if the reporter is set to None.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14167 - django/trunk/tests/modeltests/one_to_one

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 19:56:19 -0500 (Mon, 11 Oct 2010)
New Revision: 14167

Added:
   django/trunk/tests/modeltests/one_to_one/tests.py
Modified:
   django/trunk/tests/modeltests/one_to_one/models.py
Log:
Migrated one_to_one doctests. Thanks to George Sakkis for the patch. (We have 
always been at war with doctests)

Modified: django/trunk/tests/modeltests/one_to_one/models.py
===
--- django/trunk/tests/modeltests/one_to_one/models.py  2010-10-12 00:55:55 UTC 
(rev 14166)
+++ django/trunk/tests/modeltests/one_to_one/models.py  2010-10-12 00:56:19 UTC 
(rev 14167)
@@ -45,150 +45,3 @@
 
 def __unicode__(self):
 return u"Multimodel %s" % self.name
-
-__test__ = {'API_TESTS':"""
-# Create a couple of Places.
->>> p1 = Place(name='Demon Dogs', address='944 W. Fullerton')
->>> p1.save()
->>> p2 = Place(name='Ace Hardware', address='1013 N. Ashland')
->>> p2.save()
-
-# Create a Restaurant. Pass the ID of the "parent" object as this object's ID.
->>> r = Restaurant(place=p1, serves_hot_dogs=True, serves_pizza=False)
->>> r.save()
-
-# A Restaurant can access its place.
->>> r.place
-
-
-# A Place can access its restaurant, if available.
->>> p1.restaurant
-
-
-# p2 doesn't have an associated restaurant.
->>> p2.restaurant
-Traceback (most recent call last):
-...
-DoesNotExist: Restaurant matching query does not exist.
-
-# Set the place using assignment notation. Because place is the primary key on
-# Restaurant, the save will create a new restaurant
->>> r.place = p2
->>> r.save()
->>> p2.restaurant
-
->>> r.place
-
->>> p2.id
-2
-
-# Set the place back again, using assignment in the reverse direction.
->>> p1.restaurant = r
->>> p1.restaurant
-
-
->>> r = Restaurant.objects.get(pk=1)
->>> r.place
-
-
-# Restaurant.objects.all() just returns the Restaurants, not the Places.
-# Note that there are two restaurants - Ace Hardware the Restaurant was created
-# in the call to r.place = p2.
->>> Restaurant.objects.all()
-[, ]
-
-# Place.objects.all() returns all Places, regardless of whether they have
-# Restaurants.
->>> Place.objects.order_by('name')
-[, ]
-
->>> Restaurant.objects.get(place__id__exact=1)
-
->>> Restaurant.objects.get(pk=1)
-
->>> Restaurant.objects.get(place__exact=1)
-
->>> Restaurant.objects.get(place__exact=p1)
-
->>> Restaurant.objects.get(place=1)
-
->>> Restaurant.objects.get(place=p1)
-
->>> Restaurant.objects.get(place__pk=1)
-
->>> Restaurant.objects.get(place__name__startswith="Demon")
-
-
->>> Place.objects.get(id__exact=1)
-
->>> Place.objects.get(pk=1)
-
->>> Place.objects.get(restaurant__place__exact=1)
-
->>> Place.objects.get(restaurant__place__exact=p1)
-
->>> Place.objects.get(restaurant__pk=1)
-
->>> Place.objects.get(restaurant=1)
-
->>> Place.objects.get(restaurant=r)
-
->>> Place.objects.get(restaurant__exact=1)
-
->>> Place.objects.get(restaurant__exact=r)
-
-
-# Add a Waiter to the Restaurant.
->>> w = r.waiter_set.create(name='Joe')
->>> w.save()
->>> w
-
-
-# Query the waiters
->>> Waiter.objects.filter(restaurant__place__pk=1)
-[]
->>> Waiter.objects.filter(restaurant__place__exact=1)
-[]
->>> Waiter.objects.filter(restaurant__place__exact=p1)
-[]
->>> Waiter.objects.filter(restaurant__pk=1)
-[]
->>> Waiter.objects.filter(id__exact=1)
-[]
->>> Waiter.objects.filter(pk=1)
-[]
->>> Waiter.objects.filter(restaurant=1)
-[]
->>> Waiter.objects.filter(restaurant=r)
-[]
-
-# Delete the restaurant; the waiter should also be removed
->>> r = Restaurant.objects.get(pk=1)
->>> r.delete()
-
-# One-to-one fields still work if you create your own primary key
->>> o1 = ManualPrimaryKey(primary_key="abc123", name="primary")
->>> o1.save()
->>> o2 = RelatedModel(link=o1, name="secondary")
->>> o2.save()
-
-# You can have multiple one-to-one fields on a model, too.
->>> x1 = MultiModel(link1=p1, link2=o1, name="x1")
->>> x1.save()
->>> o1.multimodel
-
-
-# This will fail because each one-to-one field must be unique (and link2=o1 was
-# used for x1, above).
->>> sid = transaction.savepoint()
->>> try:
-... MultiModel(link1=p2, link2=o1, name="x1").save()
-... except Exception, e:
-... if isinstance(e, IntegrityError):
-... print "Pass"
-... else:
-... print "Fail with %s" % type(e)
-Pass
->>> transaction.savepoint_rollback(sid)
-
-"""}

Added: django/trunk/tests/modeltests/one_to_one/tests.py
===
--- django/trunk/tests/modeltests/one_to_one/tests.py   
(rev 0)
+++ django/trunk/tests/modeltests/one_to_one/tests.py   2010-10-12 00:56:19 UTC 
(rev 14167)
@@ -0,0 +1,119 @@
+from django.test import TestCase
+from django.db import transaction, IntegrityError
+from models import Place, Restaurant, Waiter, ManualPrimaryKey, RelatedModel, 
MultiModel
+
+class OneToOneTests(TestCase):
+
+def setUp(self):
+self.p1 = Place(name='Demon Dogs', address='944 W. Fullerton')
+

[Changeset] r14166 - django/trunk/tests/modeltests/many_to_one_null

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 19:55:55 -0500 (Mon, 11 Oct 2010)
New Revision: 14166

Added:
   django/trunk/tests/modeltests/many_to_one_null/tests.py
Modified:
   django/trunk/tests/modeltests/many_to_one_null/models.py
Log:
Migrated many_to_one_null doctests. Thanks to George Sakkis for the patch.

Modified: django/trunk/tests/modeltests/many_to_one_null/models.py
===
--- django/trunk/tests/modeltests/many_to_one_null/models.py2010-10-12 
00:55:31 UTC (rev 14165)
+++ django/trunk/tests/modeltests/many_to_one_null/models.py2010-10-12 
00:55:55 UTC (rev 14166)
@@ -22,108 +22,3 @@
 
 def __unicode__(self):
 return self.headline
-
-__test__ = {'API_TESTS':"""
-# Create a Reporter.
->>> r = Reporter(name='John Smith')
->>> r.save()
-
-# Create an Article.
->>> a = Article(headline="First", reporter=r)
->>> a.save()
-
->>> a.reporter.id
-1
-
->>> a.reporter
-
-
-# Article objects have access to their related Reporter objects.
->>> r = a.reporter
-
-# Create an Article via the Reporter object.
->>> a2 = r.article_set.create(headline="Second")
->>> a2
-
->>> a2.reporter.id
-1
-
-# Reporter objects have access to their related Article objects.
->>> r.article_set.all()
-[, ]
->>> r.article_set.filter(headline__startswith='Fir')
-[]
->>> r.article_set.count()
-2
-
-# Create an Article with no Reporter by passing "reporter=None".
->>> a3 = Article(headline="Third", reporter=None)
->>> a3.save()
->>> a3.id
-3
->>> print a3.reporter
-None
-
-# Need to reget a3 to refresh the cache
->>> a3 = Article.objects.get(pk=3)
->>> print a3.reporter.id
-Traceback (most recent call last):
-...
-AttributeError: 'NoneType' object has no attribute 'id'
-
-# Accessing an article's 'reporter' attribute returns None
-# if the reporter is set to None.
->>> print a3.reporter
-None
-
-# To retrieve the articles with no reporters set, use "reporter__isnull=True".
->>> Article.objects.filter(reporter__isnull=True)
-[]
-
-# We can achieve the same thing by filtering for the case where the reporter is
-# None.
->>> Article.objects.filter(reporter=None)
-[]
-
-# Set the reporter for the Third article
->>> r.article_set.add(a3)
->>> r.article_set.all()
-[, , ]
-
-# Remove an article from the set, and check that it was removed.
->>> r.article_set.remove(a3)
->>> r.article_set.all()
-[, ]
->>> Article.objects.filter(reporter__isnull=True)
-[]
-
-# Create another article and reporter
->>> r2 = Reporter(name='Paul Jones')
->>> r2.save()
->>> a4 = r2.article_set.create(headline='Fourth')
->>> r2.article_set.all()
-[]
-
-# Try to remove a4 from a set it does not belong to
->>> r.article_set.remove(a4)
-Traceback (most recent call last):
-...
-DoesNotExist:  is not related to .
-
->>> r2.article_set.all()
-[]
-
-# Use descriptor assignment to allocate ForeignKey. Null is legal, so
-# existing members of set that are not in the assignment set are set null
->>> r2.article_set = [a2, a3]
->>> r2.article_set.all()
-[, ]
-
-# Clear the rest of the set
->>> r.article_set.clear()
->>> r.article_set.all()
-[]
->>> Article.objects.filter(reporter__isnull=True)
-[, ]
-
-"""}

Added: django/trunk/tests/modeltests/many_to_one_null/tests.py
===
--- django/trunk/tests/modeltests/many_to_one_null/tests.py 
(rev 0)
+++ django/trunk/tests/modeltests/many_to_one_null/tests.py 2010-10-12 
00:55:55 UTC (rev 14166)
@@ -0,0 +1,84 @@
+from django.test import TestCase
+from models import Reporter, Article
+
+class ManyToOneNullTests(TestCase):
+
+def setUp(self):
+# Create a Reporter.
+self.r = Reporter(name='John Smith')
+self.r.save()
+# Create an Article.
+self.a = Article(headline="First", reporter=self.r)
+self.a.save()
+# Create an Article via the Reporter object.
+self.a2 = self.r.article_set.create(headline="Second")
+# Create an Article with no Reporter by passing "reporter=None".
+self.a3 = Article(headline="Third", reporter=None)
+self.a3.save()
+# Create another article and reporter
+self.r2 = Reporter(name='Paul Jones')
+self.r2.save()
+self.a4 = self.r2.article_set.create(headline='Fourth')
+
+def test_get_related(self):
+self.assertEqual(self.a.reporter.id, self.r.id)
+# Article objects have access to their related Reporter objects.
+r = self.a.reporter
+self.assertEqual(r.id, self.r.id)
+
+def test_created_via_related_set(self):
+self.assertEqual(self.a2.reporter.id, self.r.id)
+
+def test_related_set(self):
+# Reporter objects have access to their related Article objects.
+self.assertQuerysetEqual(self.r.article_set.all(),
+ ['', ''])
+
self.assertQuerysetEqual(self.r.article_set.filter(headline__startswith='Fir'),
+  

[Changeset] r14165 - django/trunk/tests/modeltests/properties

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 19:55:31 -0500 (Mon, 11 Oct 2010)
New Revision: 14165

Added:
   django/trunk/tests/modeltests/properties/tests.py
Modified:
   django/trunk/tests/modeltests/properties/models.py
Log:
Migrated properties doctests. Thanks to George Sakkis for the patch.

Modified: django/trunk/tests/modeltests/properties/models.py
===
--- django/trunk/tests/modeltests/properties/models.py  2010-10-12 00:55:05 UTC 
(rev 14164)
+++ django/trunk/tests/modeltests/properties/models.py  2010-10-12 00:55:31 UTC 
(rev 14165)
@@ -19,22 +19,3 @@
 full_name = property(_get_full_name)
 
 full_name_2 = property(_get_full_name, _set_full_name)
-
-__test__ = {'API_TESTS':"""
->>> a = Person(first_name='John', last_name='Lennon')
->>> a.save()
->>> a.full_name
-'John Lennon'
-
-# The "full_name" property hasn't provided a "set" method.
->>> a.full_name = 'Paul McCartney'
-Traceback (most recent call last):
-...
-AttributeError: can't set attribute
-
-# But "full_name_2" has, and it can be used to initialise the class.
->>> a2 = Person(full_name_2 = 'Paul McCartney')
->>> a2.save()
->>> a2.first_name
-'Paul'
-"""}

Added: django/trunk/tests/modeltests/properties/tests.py
===
--- django/trunk/tests/modeltests/properties/tests.py   
(rev 0)
+++ django/trunk/tests/modeltests/properties/tests.py   2010-10-12 00:55:31 UTC 
(rev 14165)
@@ -0,0 +1,20 @@
+from django.test import TestCase
+from models import Person
+
+class PropertyTests(TestCase):
+
+def setUp(self):
+self.a = Person(first_name='John', last_name='Lennon')
+self.a.save()
+
+def test_getter(self):
+self.assertEqual(self.a.full_name, 'John Lennon')
+
+def test_setter(self):
+# The "full_name" property hasn't provided a "set" method.
+self.assertRaises(AttributeError, setattr, self.a, 'full_name', 'Paul 
McCartney')
+
+# But "full_name_2" has, and it can be used to initialise the class.
+a2 = Person(full_name_2 = 'Paul McCartney')
+a2.save()
+self.assertEqual(a2.first_name, 'Paul')

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14164 - django/trunk/tests/modeltests/mutually_referential

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 19:55:05 -0500 (Mon, 11 Oct 2010)
New Revision: 14164

Added:
   django/trunk/tests/modeltests/mutually_referential/tests.py
Modified:
   django/trunk/tests/modeltests/mutually_referential/models.py
Log:
Migrated the mutually_referential doctests. Thanks to George Sakkis for the 
patch.

Modified: django/trunk/tests/modeltests/mutually_referential/models.py
===
--- django/trunk/tests/modeltests/mutually_referential/models.py
2010-10-12 00:14:49 UTC (rev 14163)
+++ django/trunk/tests/modeltests/mutually_referential/models.py
2010-10-12 00:55:05 UTC (rev 14164)
@@ -8,29 +8,12 @@
 
 class Parent(Model):
 name = CharField(max_length=100)
-
+
 # Use a simple string for forward declarations.
 bestchild = ForeignKey("Child", null=True, related_name="favoured_by")
 
 class Child(Model):
 name = CharField(max_length=100)
-
+
 # You can also explicitally specify the related app.
 parent = ForeignKey("mutually_referential.Parent")
-
-__test__ = {'API_TESTS':"""
-# Create a Parent
->>> q = Parent(name='Elizabeth')
->>> q.save()
-
-# Create some children
->>> c = q.child_set.create(name='Charles')
->>> e = q.child_set.create(name='Edward')
-
-# Set the best child
->>> q.bestchild = c
->>> q.save()
-
->>> q.delete()
-
-"""}
\ No newline at end of file

Added: django/trunk/tests/modeltests/mutually_referential/tests.py
===
--- django/trunk/tests/modeltests/mutually_referential/tests.py 
(rev 0)
+++ django/trunk/tests/modeltests/mutually_referential/tests.py 2010-10-12 
00:55:05 UTC (rev 14164)
@@ -0,0 +1,20 @@
+from django.test import TestCase
+from models import Parent, Child
+
+class MutuallyReferentialTests(TestCase):
+
+def test_mutually_referential(self):
+# Create a Parent
+q = Parent(name='Elizabeth')
+q.save()
+
+# Create some children
+c = q.child_set.create(name='Charles')
+e = q.child_set.create(name='Edward')
+
+# Set the best child
+# No assertion require here; if basic assignment and
+# deletion works, the test passes.
+q.bestchild = c
+q.save()
+q.delete()

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] #14439: Improve documentation on how to run the GIS test suite

2010-10-11 Thread Django
#14439: Improve documentation on how to run the GIS test suite
+---
  Reporter:  lukeplant  | Owner:  nobody
Status:  reopened   | Milestone:
 Component:  GIS|   Version:  1.2   
Resolution: |  Keywords:
 Stage:  Accepted   | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by jbronn):

  * status:  closed => reopened
  * summary:  Running the GIS testsuite is very hard. => Improve
  documentation on how to run the GIS test suite
  * resolution:  invalid =>
  * stage:  Unreviewed => Accepted

-- 
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-upda...@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] #14126: blocktrans count is parsing incorrectly

2010-10-11 Thread Django
#14126: blocktrans count is parsing incorrectly
-+--
  Reporter:  mark0978| Owner:  ramiro   
Status:  new | Milestone:   
 Component:  Translations|   Version:  1.2  
Resolution:  |  Keywords:  blocktrans plural
 Stage:  Design decision needed  | Has_patch:  0
Needs_docs:  0   |   Needs_tests:  0
Needs_better_patch:  0   |  
-+--
Comment (by ramiro):

 @mark0978:

 The case you report (no additional  variables bound in the blocktrans tag,
 only the counter var, and the counter variable being used in the plural
 literal but not in the singular one) is being tested in the Django 1.2.1
 (and the current trunk, unchanged since then) suite (see `i18n07` and
 `i18n08` tests):
 
http://code.djangoproject.com/browser/django/tags/releases/1.2.1/tests/regressiontests/templates/tests.py#L1069
 -- so there must be some additional detail(s) to your setup (like the
 language you are translating to and the relevant fragment of the .po file
 you are using) so please post them if you read this.

 @svetlyak40wt:

 That fragment of the Russian translation is correct: the 0th plural form
 isn't being used exclusively for the counter=1 case. According to the
 Plural forms formula for that language (located at the top of the same
 file), that form is also used for, e.g., when count is 21, 31,...

-- 
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-upda...@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] r14163 - in django/trunk/tests/modeltests: . m2o_recursive

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 19:14:49 -0500 (Mon, 11 Oct 2010)
New Revision: 14163

Added:
   django/trunk/tests/modeltests/m2o_recursive/tests.py
Removed:
   django/trunk/tests/modeltests/m2o_recursive2/
Modified:
   django/trunk/tests/modeltests/m2o_recursive/models.py
Log:
Migrated m2o_recursive and m2o_recursive2 tests, merging them into a single 
package. Thanks to George Sakkis for the patches.

Modified: django/trunk/tests/modeltests/m2o_recursive/models.py
===
--- django/trunk/tests/modeltests/m2o_recursive/models.py   2010-10-11 
23:57:03 UTC (rev 14162)
+++ django/trunk/tests/modeltests/m2o_recursive/models.py   2010-10-12 
00:14:49 UTC (rev 14163)
@@ -19,22 +19,10 @@
 def __unicode__(self):
 return self.name
 
-__test__ = {'API_TESTS':"""
-# Create a few Category objects.
->>> r = Category(id=None, name='Root category', parent=None)
->>> r.save()
->>> c = Category(id=None, name='Child category', parent=r)
->>> c.save()
+class Person(models.Model):
+full_name = models.CharField(max_length=20)
+mother = models.ForeignKey('self', null=True, 
related_name='mothers_child_set')
+father = models.ForeignKey('self', null=True, 
related_name='fathers_child_set')
 
->>> r.child_set.all()
-[]
->>> r.child_set.get(name__startswith='Child')
-
->>> print r.parent
-None
-
->>> c.child_set.all()
-[]
->>> c.parent
-
-"""}
+def __unicode__(self):
+return self.full_name

Added: django/trunk/tests/modeltests/m2o_recursive/tests.py
===
--- django/trunk/tests/modeltests/m2o_recursive/tests.py
(rev 0)
+++ django/trunk/tests/modeltests/m2o_recursive/tests.py2010-10-12 
00:14:49 UTC (rev 14163)
@@ -0,0 +1,38 @@
+from django.test import TestCase
+from models import Category, Person
+
+class ManyToOneRecursiveTests(TestCase):
+
+def setUp(self):
+self.r = Category(id=None, name='Root category', parent=None)
+self.r.save()
+self.c = Category(id=None, name='Child category', parent=self.r)
+self.c.save()
+
+def test_m2o_recursive(self):
+self.assertQuerysetEqual(self.r.child_set.all(),
+ [''])
+self.assertEqual(self.r.child_set.get(name__startswith='Child').id, 
self.c.id)
+self.assertEqual(self.r.parent, None)
+self.assertQuerysetEqual(self.c.child_set.all(), [])
+self.assertEqual(self.c.parent.id, self.r.id)
+
+class MultipleManyToOneRecursiveTests(TestCase):
+
+def setUp(self):
+self.dad = Person(full_name='John Smith Senior', mother=None, 
father=None)
+self.dad.save()
+self.mom = Person(full_name='Jane Smith', mother=None, father=None)
+self.mom.save()
+self.kid = Person(full_name='John Smith Junior', mother=self.mom, 
father=self.dad)
+self.kid.save()
+
+def test_m2o_recursive2(self):
+self.assertEqual(self.kid.mother.id, self.mom.id)
+self.assertEqual(self.kid.father.id, self.dad.id)
+self.assertQuerysetEqual(self.dad.fathers_child_set.all(),
+ [''])
+self.assertQuerysetEqual(self.mom.mothers_child_set.all(),
+ [''])
+self.assertQuerysetEqual(self.kid.mothers_child_set.all(), [])
+self.assertQuerysetEqual(self.kid.fathers_child_set.all(), [])

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14162 - django/trunk/docs/releases

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 18:57:03 -0500 (Mon, 11 Oct 2010)
New Revision: 14162

Modified:
   django/trunk/docs/releases/1.3.txt
Log:
Fixed a reference in the docs to a non-existant PasswordField.

Modified: django/trunk/docs/releases/1.3.txt
===
--- django/trunk/docs/releases/1.3.txt  2010-10-11 23:50:59 UTC (rev 14161)
+++ django/trunk/docs/releases/1.3.txt  2010-10-11 23:57:03 UTC (rev 14162)
@@ -85,7 +85,7 @@
 
 class LoginForm(forms.Form):
 username = forms.CharField(max_length=100)
-password = 
forms.PasswordField(widget=forms.PasswordInput(render_value=True))
+password = 
forms.CharField(widget=forms.PasswordInput(render_value=True))
 
 Clearable default widget for FileField
 ~~

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14161 - django/trunk/docs/releases

2010-10-11 Thread noreply
Author: lukeplant
Date: 2010-10-11 18:50:59 -0500 (Mon, 11 Oct 2010)
New Revision: 14161

Modified:
   django/trunk/docs/releases/1.3.txt
Log:
Moved the good stuff to the top in releases/1.3.txt

Modified: django/trunk/docs/releases/1.3.txt
===
--- django/trunk/docs/releases/1.3.txt  2010-10-11 23:35:23 UTC (rev 14160)
+++ django/trunk/docs/releases/1.3.txt  2010-10-11 23:50:59 UTC (rev 14161)
@@ -7,10 +7,55 @@
 up-to-date information for those who are following trunk.
 
 Django 1.3 includes a number of nifty `new features`_, lots of bug
-fixes and an easy upgrade path from Django 1.2.
+fixes, some minor `backwards incompatible changes`_ and an easy
+upgrade path from Django 1.2.
 
 .. _new features: `What's new in Django 1.3`_
 
+.. _backwards incompatible changes: backwards-incompatible-changes-1.3_
+
+What's new in Django 1.3
+
+
+Logging
+~~~
+
+Django 1.3 adds framework-level support for Python's logging module.
+This means you can now easily configure and control logging as part of
+your Django project. A number of logging handlers and logging calls
+have been added to Django's own code as well -- most notably, the
+error emails sent on a HTTP 500 server error are now handled as a
+logging activity. See :doc:`the documentation on Django's logging
+interface ` for more details.
+
+``unittest2`` support
+~
+
+Python 2.7 introduced some major changes to the unittest library,
+adding some extremely useful features. To ensure that every Django
+project can benefit from these new features, Django ships with a
+copy of unittest2_, a copy of the Python 2.7 unittest library,
+backported for Python 2.4 compatibility.
+
+To access this library, Django provides the
+``django.utils.unittest`` module alias. If you are using Python
+2.7, or you have installed unittest2 locally, Django will map the
+alias to the installed version of the unittest library. Otherwise,
+Django will use it's own bundled version of unittest2.
+
+To use this alias, simply use::
+
+from django.utils import unittest
+
+wherever you would have historically used::
+
+import unittest
+
+If you want to continue to use the base unittest libary, you can --
+you just won't get any of the nice new unittest2 features.
+
+.. _unittest2: http://pypi.python.org/pypi/unittest2
+
 .. _backwards-incompatible-changes-1.3:
 
 Backwards-incompatible changes in 1.3
@@ -122,45 +167,3 @@
 deprecated in favor of a new :attr:`~django.test.client.Response.templates`
 attribute, which is always a list, even if it has only a single element or no
 elements.
-
-What's new in Django 1.3
-
-
-Logging
-~~~
-
-Django 1.3 adds framework-level support for Python's logging module.
-This means you can now easily configure and control logging as part of
-your Django project. A number of logging handlers and logging calls
-have been added to Django's own code as well -- most notably, the
-error emails sent on a HTTP 500 server error are now handled as a
-logging activity. See :doc:`the documentation on Django's logging
-interface ` for more details.
-
-``unittest2`` support
-~
-
-Python 2.7 introduced some major changes to the unittest library,
-adding some extremely useful features. To ensure that every Django
-project can benefit from these new features, Django ships with a
-copy of unittest2_, a copy of the Python 2.7 unittest library,
-backported for Python 2.4 compatibility.
-
-To access this library, Django provides the
-``django.utils.unittest`` module alias. If you are using Python
-2.7, or you have installed unittest2 locally, Django will map the
-alias to the installed version of the unittest library. Otherwise,
-Django will use it's own bundled version of unittest2.
-
-To use this alias, simply use::
-
-from django.utils import unittest
-
-wherever you would have historically used::
-
-import unittest
-
-If you want to continue to use the base unittest libary, you can --
-you just won't get any of the nice new unittest2 features.
-
-.. _unittest2: http://pypi.python.org/pypi/unittest2

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14160 - in django/trunk: django/contrib/localflavor django/contrib/localflavor/be docs/ref/contrib tests/regressiontests/forms tests/regressiontests/forms/localflavor

2010-10-11 Thread noreply
Author: jezdez
Date: 2010-10-11 18:35:23 -0500 (Mon, 11 Oct 2010)
New Revision: 14160

Added:
   django/trunk/django/contrib/localflavor/be/
   django/trunk/django/contrib/localflavor/be/__init__.py
   django/trunk/django/contrib/localflavor/be/be_provinces.py
   django/trunk/django/contrib/localflavor/be/be_regions.py
   django/trunk/django/contrib/localflavor/be/forms.py
   django/trunk/tests/regressiontests/forms/localflavor/be.py
Modified:
   django/trunk/docs/ref/contrib/localflavor.txt
   django/trunk/tests/regressiontests/forms/tests.py
Log:
Fixed #14349 -- Added Belgium localflavor. Thanks for the report and patch, 
Laurent Luce.

Added: django/trunk/django/contrib/localflavor/be/__init__.py
===

Added: django/trunk/django/contrib/localflavor/be/be_provinces.py
===
--- django/trunk/django/contrib/localflavor/be/be_provinces.py  
(rev 0)
+++ django/trunk/django/contrib/localflavor/be/be_provinces.py  2010-10-11 
23:35:23 UTC (rev 14160)
@@ -0,0 +1,16 @@
+from django.utils.translation import ugettext_lazy as _
+
+# ISO codes
+PROVINCE_CHOICES = (
+('VAN', _('Antwerp')),
+('BRU', _('Brussels')),
+('VOV', _('East Flanders')),
+('VBR', _('Flemish Brabant')),
+('WHT', _('Hainaut')),
+('WLG', _('Liege')),
+('VLI', _('Limburg')),
+('WLX', _('Luxembourg')),
+('WNA', _('Namur')),
+('WBR', _('Walloon Brabant')),
+('VWV', _('West Flanders'))
+)

Added: django/trunk/django/contrib/localflavor/be/be_regions.py
===
--- django/trunk/django/contrib/localflavor/be/be_regions.py
(rev 0)
+++ django/trunk/django/contrib/localflavor/be/be_regions.py2010-10-11 
23:35:23 UTC (rev 14160)
@@ -0,0 +1,8 @@
+from django.utils.translation import ugettext_lazy as _
+
+# ISO codes
+REGION_CHOICES = (
+('BRU', _('Brussels Capital Region')),
+('VLG', _('Flemish Region')),
+('WAL', _('Wallonia'))
+)

Added: django/trunk/django/contrib/localflavor/be/forms.py
===
--- django/trunk/django/contrib/localflavor/be/forms.py 
(rev 0)
+++ django/trunk/django/contrib/localflavor/be/forms.py 2010-10-11 23:35:23 UTC 
(rev 14160)
@@ -0,0 +1,71 @@
+"""
+Belgium-specific Form helpers
+"""
+import re
+
+from django.core.validators import EMPTY_VALUES
+from django.forms import ValidationError
+from django.forms.fields import RegexField, Select
+from django.utils.translation import ugettext_lazy as _
+
+class BEPostalCodeField(RegexField):
+"""
+A form field that validates its input as a belgium postal code.
+
+Belgium postal code is a 4 digits string. The first digit indicates
+the province (except for the 3ddd numbers that are shared by the
+eastern part of Flemish Brabant and Limburg and the and 1ddd that
+are shared by the Brussels Capital Region, the western part of
+Flemish Brabant and Walloon Brabant)
+"""
+default_error_messages = {
+'invalid': _(
+'Enter a valid postal code in the range and format 1XXX - 9XXX.'),
+}
+
+def __init__(self, *args, **kwargs):
+super(BEPostalCodeField, self).__init__(r'^[1-9]\d{3}$',
+max_length=None, min_length=None, *args, **kwargs)
+
+class BEPhoneNumberField(RegexField):
+"""
+A form field that validates its input as a belgium phone number.
+
+Landlines have a seven-digit subscriber number and a one-digit area code,
+while smaller cities have a six-digit subscriber number and a two-digit 
+area code. Cell phones have a six-digit subscriber number and a two-digit 
+area code preceeded by the number 4.
+0d ddd dd dd, 0d/ddd.dd.dd, 0d.ddd.dd.dd, 
+0 - dialling a bigger city
+0dd dd dd dd, 0dd/dd.dd.dd, 0dd.dd.dd.dd, 
+0 - dialling a smaller city
+04dd ddd dd dd, 04dd/ddd.dd.dd, 
+04dd.ddd.dd.dd, 04d - dialling a mobile number
+"""
+default_error_messages = {
+'invalid': _('Enter a valid phone number in one of the formats '
+ '0x xxx xx xx, 0xx xx xx xx, 04xx xx xx xx, '
+ '0x/xxx.xx.xx, 0xx/xx.xx.xx, 04xx/xx.xx.xx, '
+ '0x.xxx.xx.xx, 0xx.xx.xx.xx, 04xx.xx.xx.xx, '
+ '0 or 04.'),
+}
+
+def __init__(self, *args, **kwargs):
+super(BEPhoneNumberField, self).__init__(r'^[0]\d{1}[/. ]?\d{3}[. 
]\d{2}[. ]?\d{2}$|^[0]\d{2}[/. ]?\d{2}[. ]?\d{2}[. ]?\d{2}$|^[0][4]\d{2}[/. 
]?\d{2}[. ]?\d{2}[. ]?\d{2}$',
+max_length=None, min_length=None, *args, **kwargs)
+
+class BERegionSelect(Select):
+"""
+A Select widget that uses a list of belgium regions as its choices.
+"""
+def __init__(self, attrs=None):
+from be_regions 

Re: [Django] #13902: When using a ManyToMany in list_filter, results may apper more than once

2010-10-11 Thread Django
#13902: When using a ManyToMany in list_filter, results may apper more than once
---+
  Reporter:  rasca | Owner:  rasca  
 
Status:  new   | Milestone:  1.3
 
 Component:  django.contrib.admin  |   Version:  SVN
 
Resolution:|  Keywords:  admin change_list 
list_filter manytomany
 Stage:  Accepted  | Has_patch:  1  
 
Needs_docs:  0 |   Needs_tests:  0  
 
Needs_better_patch:  0 |  
---+
Changes (by rasca):

  * milestone:  => 1.3

Comment:

 Uploaded new patch, taking into consideration Alex's note.

-- 
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-upda...@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] #14126: blocktrans count is parsing incorrectly

2010-10-11 Thread Django
#14126: blocktrans count is parsing incorrectly
-+--
  Reporter:  mark0978| Owner:  ramiro   
Status:  new | Milestone:   
 Component:  Translations|   Version:  1.2  
Resolution:  |  Keywords:  blocktrans plural
 Stage:  Design decision needed  | Has_patch:  0
Needs_docs:  0   |   Needs_tests:  0
Needs_better_patch:  0   |  
-+--
Changes (by ramiro):

  * owner:  nobody => ramiro
  * status:  reopened => 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-upda...@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] r14159 - in django/branches/releases/1.2.X: django/core/mail tests/regressiontests/mail

2010-10-11 Thread noreply
Author: jezdez
Date: 2010-10-11 17:36:17 -0500 (Mon, 11 Oct 2010)
New Revision: 14159

Modified:
   django/branches/releases/1.2.X/django/core/mail/__init__.py
   django/branches/releases/1.2.X/tests/regressiontests/mail/tests.py
Log:
[1.2.X] Fixed #13494 -- Correctly concat an email subject prefix with a 
translation string. Thanks, hcarvalhoalves and Andi Albrecht.

Backport from trunk (r14157).

Modified: django/branches/releases/1.2.X/django/core/mail/__init__.py
===
--- django/branches/releases/1.2.X/django/core/mail/__init__.py 2010-10-11 
22:35:24 UTC (rev 14158)
+++ django/branches/releases/1.2.X/django/core/mail/__init__.py 2010-10-11 
22:36:17 UTC (rev 14159)
@@ -87,7 +87,7 @@
 """Sends a message to the admins, as defined by the ADMINS setting."""
 if not settings.ADMINS:
 return
-EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
+EmailMessage(u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message,
  settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS],
  connection=connection).send(fail_silently=fail_silently)
 
@@ -96,7 +96,7 @@
 """Sends a message to the managers, as defined by the MANAGERS setting."""
 if not settings.MANAGERS:
 return
-EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
+EmailMessage(u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message,
  settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS],
  connection=connection).send(fail_silently=fail_silently)
 

Modified: django/branches/releases/1.2.X/tests/regressiontests/mail/tests.py
===
--- django/branches/releases/1.2.X/tests/regressiontests/mail/tests.py  
2010-10-11 22:35:24 UTC (rev 14158)
+++ django/branches/releases/1.2.X/tests/regressiontests/mail/tests.py  
2010-10-11 22:36:17 UTC (rev 14159)
@@ -316,3 +316,23 @@
 settings.ADMINS = old_admins
 settings.MANAGERS = old_managers
 
+def test_mail_prefix(self):
+"""Test prefix argument in manager/admin mail."""
+# Regression for #13494.
+old_admins = settings.ADMINS
+old_managers = settings.MANAGERS
+settings.ADMINS = settings.MANAGERS = [('nobody','nob...@example.com')]
+
+mail_managers(ugettext_lazy('Subject'), 'Content')
+self.assertEqual(len(mail.outbox), 1)
+message = mail.outbox[0]
+self.assertEqual(message.subject, '[Django] Subject')
+
+mail.outbox = []
+mail_admins(ugettext_lazy('Subject'), 'Content')
+self.assertEqual(len(mail.outbox), 1)
+message = mail.outbox[0]
+self.assertEqual(message.subject, '[Django] Subject')
+
+settings.ADMINS = old_admins
+settings.MANAGERS = old_managers

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14158 - django/branches/releases/1.2.X/django/conf

2010-10-11 Thread noreply
Author: jezdez
Date: 2010-10-11 17:35:24 -0500 (Mon, 11 Oct 2010)
New Revision: 14158

Modified:
   django/branches/releases/1.2.X/django/conf/global_settings.py
Log:
[1.2.X] Fixed links to the date formats choices in the global settings. Thanks, 
Russell.

Backport from trunk (r14032).

Modified: django/branches/releases/1.2.X/django/conf/global_settings.py
===
--- django/branches/releases/1.2.X/django/conf/global_settings.py   
2010-10-11 22:27:45 UTC (rev 14157)
+++ django/branches/releases/1.2.X/django/conf/global_settings.py   
2010-10-11 22:35:24 UTC (rev 14158)
@@ -292,34 +292,34 @@
 FORMAT_MODULE_PATH = None
 
 # Default formatting for date objects. See all available format strings here:
-# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
 DATE_FORMAT = 'N j, Y'
 
 # Default formatting for datetime objects. See all available format strings 
here:
-# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
 DATETIME_FORMAT = 'N j, Y, P'
 
 # Default formatting for time objects. See all available format strings here:
-# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
 TIME_FORMAT = 'P'
 
 # Default formatting for date objects when only the year and month are 
relevant.
 # See all available format strings here:
-# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
 YEAR_MONTH_FORMAT = 'F Y'
 
 # Default formatting for date objects when only the month and day are relevant.
 # See all available format strings here:
-# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
 MONTH_DAY_FORMAT = 'F j'
 
 # Default short formatting for date objects. See all available format strings 
here:
-# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
 SHORT_DATE_FORMAT = 'm/d/Y'
 
 # Default short formatting for datetime objects.
 # See all available format strings here:
-# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now
+# http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
 SHORT_DATETIME_FORMAT = 'm/d/Y P'
 
 # Default formats to be used when parsing dates from input boxes, in order

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14157 - in django/trunk: django/core/mail tests/regressiontests/mail

2010-10-11 Thread noreply
Author: jezdez
Date: 2010-10-11 17:27:45 -0500 (Mon, 11 Oct 2010)
New Revision: 14157

Modified:
   django/trunk/django/core/mail/__init__.py
   django/trunk/tests/regressiontests/mail/tests.py
Log:
Fixed #13494 -- Correctly concat an email subject prefix with a translation 
string. Thanks, hcarvalhoalves and Andi Albrecht.

Modified: django/trunk/django/core/mail/__init__.py
===
--- django/trunk/django/core/mail/__init__.py   2010-10-11 22:24:59 UTC (rev 
14156)
+++ django/trunk/django/core/mail/__init__.py   2010-10-11 22:27:45 UTC (rev 
14157)
@@ -87,7 +87,7 @@
 """Sends a message to the admins, as defined by the ADMINS setting."""
 if not settings.ADMINS:
 return
-EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
+EmailMessage(u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message,
  settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS],
  connection=connection).send(fail_silently=fail_silently)
 
@@ -96,7 +96,7 @@
 """Sends a message to the managers, as defined by the MANAGERS setting."""
 if not settings.MANAGERS:
 return
-EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message,
+EmailMessage(u'%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), message,
  settings.SERVER_EMAIL, [a[1] for a in settings.MANAGERS],
  connection=connection).send(fail_silently=fail_silently)
 

Modified: django/trunk/tests/regressiontests/mail/tests.py
===
--- django/trunk/tests/regressiontests/mail/tests.py2010-10-11 22:24:59 UTC 
(rev 14156)
+++ django/trunk/tests/regressiontests/mail/tests.py2010-10-11 22:27:45 UTC 
(rev 14157)
@@ -343,3 +343,23 @@
 settings.ADMINS = old_admins
 settings.MANAGERS = old_managers
 
+def test_mail_prefix(self):
+"""Test prefix argument in manager/admin mail."""
+# Regression for #13494.
+old_admins = settings.ADMINS
+old_managers = settings.MANAGERS
+settings.ADMINS = settings.MANAGERS = [('nobody','nob...@example.com')]
+
+mail_managers(ugettext_lazy('Subject'), 'Content')
+self.assertEqual(len(mail.outbox), 1)
+message = mail.outbox[0]
+self.assertEqual(message.subject, '[Django] Subject')
+
+mail.outbox = []
+mail_admins(ugettext_lazy('Subject'), 'Content')
+self.assertEqual(len(mail.outbox), 1)
+message = mail.outbox[0]
+self.assertEqual(message.subject, '[Django] Subject')
+
+settings.ADMINS = old_admins
+settings.MANAGERS = old_managers

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14156 - django/branches/releases/1.2.X/docs/ref/contrib/gis

2010-10-11 Thread noreply
Author: jbronn
Date: 2010-10-11 17:24:59 -0500 (Mon, 11 Oct 2010)
New Revision: 14156

Modified:
   django/branches/releases/1.2.X/docs/ref/contrib/gis/install.txt
Log:
[1.2.X] Updated version of PostGIS in GeoDjango install docs.

Backport of r14150 from trunk.

Modified: django/branches/releases/1.2.X/docs/ref/contrib/gis/install.txt
===
--- django/branches/releases/1.2.X/docs/ref/contrib/gis/install.txt 
2010-10-11 21:58:46 UTC (rev 14155)
+++ django/branches/releases/1.2.X/docs/ref/contrib/gis/install.txt 
2010-10-11 22:24:59 UTC (rev 14156)
@@ -240,9 +240,9 @@
 
 First download the source archive, and extract::
 
-$ wget http://postgis.refractions.net/download/postgis-1.5.1.tar.gz
-$ tar xzf postgis-1.5.1.tar.gz
-$ cd postgis-1.5.1
+$ wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
+$ tar xzf postgis-1.5.2.tar.gz
+$ cd postgis-1.5.2
 
 Next, configure, make and install PostGIS::
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] #14146: Incorrect query being generated by .exclude() in some inheritance cases

2010-10-11 Thread Django
#14146: Incorrect query being generated by .exclude() in some inheritance cases
---+
  Reporter:  coleifer  | Owner:  nobody
Status:  new   | Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.2   
Resolution:|  Keywords:
 Stage:  Unreviewed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by PhiR_42):

 Looks like a dup of #12823

-- 
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-upda...@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] #14423: Wrong SQL on exclude with inheritance

2010-10-11 Thread Django
#14423: Wrong SQL on exclude with inheritance
---+
  Reporter:  PhiR_42   | Owner:  nobody 

Status:  new   | Milestone: 

 Component:  Database layer (models, ORM)  |   Version:  1.1

Resolution:|  Keywords:  orm 
exclude inheritance
 Stage:  Accepted  | Has_patch:  1  

Needs_docs:  0 |   Needs_tests:  0  

Needs_better_patch:  0 |  
---+
Changes (by PhiR_42):

  * needs_tests:  1 => 0

Comment:

 I did give a pretty good look at the DB tickets and couldn't find it,
 though there are some pretty similar ones (#12823 and #13937 for example).

-- 
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-upda...@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] r14155 - django/branches/releases/1.2.X/docs/internals

2010-10-11 Thread noreply
Author: gabrielhurley
Date: 2010-10-11 16:58:46 -0500 (Mon, 11 Oct 2010)
New Revision: 14155

Modified:
   django/branches/releases/1.2.X/docs/internals/contributing.txt
Log:
[1.2.X] Added information about the "easy-pickings" keyword to the contributing 
docs. Thanks to Russ for the report and cmheisel for the patch.

Backport of [14154] from trunk.

Modified: django/branches/releases/1.2.X/docs/internals/contributing.txt
===
--- django/branches/releases/1.2.X/docs/internals/contributing.txt  
2010-10-11 21:57:25 UTC (rev 14154)
+++ django/branches/releases/1.2.X/docs/internals/contributing.txt  
2010-10-11 21:58:46 UTC (rev 14155)
@@ -15,7 +15,9 @@
   served up.
 
 * Submit patches for new and/or fixed behavior.  Please read `Submitting
-  patches`_, below, for details on how to submit a patch.
+  patches`_, below, for details on how to submit a patch. If you're looking
+  for an easy way to start contributing to Django have a look at the
+  `easy-pickings`_ tickets.
 
 * Join the `django-developers`_ mailing list and share your ideas for how
   to improve Django.  We're always open to suggestions, although we're
@@ -354,6 +356,9 @@
 * Correcting the "Needs tests", "Needs documentation", or "Has patch" flags
   for tickets where they are incorrectly set.
 
+* Adding the `easy-pickings`_ keyword to tickets that are small and
+  relatively straightforward.
+
 * Checking that old tickets are still valid. If a ticket hasn't seen
   any activity in a long time, it's possible that the problem has been
   fixed but the ticket hasn't yet been closed.
@@ -1282,3 +1287,4 @@
 .. _pep8.py: http://pypi.python.org/pypi/pep8/
 .. _i18n branch: http://code.djangoproject.com/browser/django/branches/i18n
 .. _`tags/releases`: http://code.djangoproject.com/browser/django/tags/releases
+.. _`easy-pickings`: 
http://code.djangoproject.com/query?status=new=assigned=reopened=~easy-pickings=priority

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14154 - django/trunk/docs/internals

2010-10-11 Thread noreply
Author: gabrielhurley
Date: 2010-10-11 16:57:25 -0500 (Mon, 11 Oct 2010)
New Revision: 14154

Modified:
   django/trunk/docs/internals/contributing.txt
Log:
Fixed #14227 -- Added information about the "easy-pickings" keyword to the 
contributing docs. Thanks to Russ for the report and cmheisel for the patch.

Modified: django/trunk/docs/internals/contributing.txt
===
--- django/trunk/docs/internals/contributing.txt2010-10-11 20:38:29 UTC 
(rev 14153)
+++ django/trunk/docs/internals/contributing.txt2010-10-11 21:57:25 UTC 
(rev 14154)
@@ -15,7 +15,9 @@
   served up.
 
 * Submit patches for new and/or fixed behavior.  Please read `Submitting
-  patches`_, below, for details on how to submit a patch.
+  patches`_, below, for details on how to submit a patch. If you're looking
+  for an easy way to start contributing to Django have a look at the
+  `easy-pickings`_ tickets.
 
 * Join the `django-developers`_ mailing list and share your ideas for how
   to improve Django.  We're always open to suggestions, although we're
@@ -354,6 +356,9 @@
 * Correcting the "Needs tests", "Needs documentation", or "Has patch" flags
   for tickets where they are incorrectly set.
 
+* Adding the `easy-pickings`_ keyword to tickets that are small and
+  relatively straightforward.
+
 * Checking that old tickets are still valid. If a ticket hasn't seen
   any activity in a long time, it's possible that the problem has been
   fixed but the ticket hasn't yet been closed.
@@ -1282,3 +1287,4 @@
 .. _pep8.py: http://pypi.python.org/pypi/pep8/
 .. _i18n branch: http://code.djangoproject.com/browser/django/branches/i18n
 .. _`tags/releases`: http://code.djangoproject.com/browser/django/tags/releases
+.. _`easy-pickings`: 
http://code.djangoproject.com/query?status=new=assigned=reopened=~easy-pickings=priority

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] #14227: Modify contributing docs to mention the 'easy-pickings' keyword in triage

2010-10-11 Thread Django
#14227: Modify contributing docs to mention the 'easy-pickings' keyword in 
triage
+---
  Reporter:  russellm   | Owner:  cmheisel 
Status:  assigned   | Milestone:   
 Component:  Documentation  |   Version:  1.2  
Resolution: |  Keywords:  easy-pickings
 Stage:  Ready for checkin  | Has_patch:  1
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Comment (by gabrielhurley):

 @cmheisel: those wiki pages are locked to prevent vandalism and can only
 be edited by Trac admins. I've added the links to the reports.

-- 
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-upda...@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] #14445: Use HMAC and constant-time comparison functions where needed in Django

2010-10-11 Thread Django
#14445: Use HMAC and constant-time comparison functions where needed in Django
+---
  Reporter:  lukeplant  | Owner:  nobody
Status:  new| Milestone:
 Component:  Uncategorized  |   Version:  1.2   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by lukeplant):

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

Comment:

 Notes on patch:

  * In most cases actually raising `PendingDeprecationWarning` wouldn't be
 helpful, so I haven't done that.
  * In every case there are tests for the hashes produced by Django 1.2
 still being accepted.
  * To make better tests for `FormWizard` I had to move the `tests.py` to a
 `tests/__init__.py` in order to create a `tests/templates` directory. The
 new tests are:
* `FormHmacTests`
* `PreviewTests`:  test_form_submit_django12_hash,
 test_form_submit_django12_hash_custom_hash
* `WizardTests`: test_bad_hash, test_good_hash_django12,
 test_good_hash_django12_subclass, test_good_hash_django13

 There are other uses of MD5/SHA1 that I haven't changed, because they are
 not an application of MAC (for example, the generation of unique keys in
 django/template/loaders/cached.py)

-- 
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-upda...@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] #14445: Use HMAC and constant-time comparison functions where needed in Django

2010-10-11 Thread Django
#14445: Use HMAC and constant-time comparison functions where needed in Django
---+
 Reporter:  lukeplant  |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Uncategorized  | Version:  1.2   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Various places in Django use MD5/SHA1 based methods as a kind of MAC
 (Message Authentication Code).  HMAC is a much better alternative.

 In most cases, we need to maintain backwards compatibility with existing
 signed values, by falling back to the existing MD5/SHA1 method.  This
 means we will continue to have potential weaknesses, but by only
 generating HMACs from now on, we can phase out support for these old
 values over time, using the normal deprecation method.  This should give
 plenty of time for the old hashes to expire naturally anyway.

 In addition, in all these places, and some others, the MACs are tested for
 validity using simple string equality, which potentially opens us up to
 timing-based attacks to discover the tokens.

-- 
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-upda...@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] r14153 - django/branches/releases/1.2.X/tests/modeltests/pagination

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 15:38:29 -0500 (Mon, 11 Oct 2010)
New Revision: 14153

Added:
   django/branches/releases/1.2.X/tests/modeltests/pagination/tests.py
Modified:
   django/branches/releases/1.2.X/tests/modeltests/pagination/models.py
Log:
[1.2.X] Fixed #1 -- Convert the pagination doctests to unittests.  We have 
always been at war with doctests.  Thanks to Gabriel Hurley for the patch.  
Backport of [14152].

Modified: django/branches/releases/1.2.X/tests/modeltests/pagination/models.py
===
--- django/branches/releases/1.2.X/tests/modeltests/pagination/models.py
2010-10-11 20:38:12 UTC (rev 14152)
+++ django/branches/releases/1.2.X/tests/modeltests/pagination/models.py
2010-10-11 20:38:29 UTC (rev 14153)
@@ -8,173 +8,10 @@
 
 from django.db import models
 
+
 class Article(models.Model):
 headline = models.CharField(max_length=100, default='Default headline')
 pub_date = models.DateTimeField()
 
 def __unicode__(self):
 return self.headline
-
-__test__ = {'API_TESTS':"""
-# Prepare a list of objects for pagination.
->>> from datetime import datetime
->>> for x in range(1, 10):
-... a = Article(headline='Article %s' % x, pub_date=datetime(2005, 7, 29))
-... a.save()
-
-##
-# Paginator/Page #
-##
-
->>> from django.core.paginator import Paginator
->>> paginator = Paginator(Article.objects.all(), 5)
->>> paginator.count
-9
->>> paginator.num_pages
-2
->>> paginator.page_range
-[1, 2]
-
-# Get the first page.
->>> p = paginator.page(1)
->>> p
-
->>> p.object_list
-[, , , , ]
->>> p.has_next()
-True
->>> p.has_previous()
-False
->>> p.has_other_pages()
-True
->>> p.next_page_number()
-2
->>> p.previous_page_number()
-0
->>> p.start_index()
-1
->>> p.end_index()
-5
-
-# Get the second page.
->>> p = paginator.page(2)
->>> p
-
->>> p.object_list
-[, , , ]
->>> p.has_next()
-False
->>> p.has_previous()
-True
->>> p.has_other_pages()
-True
->>> p.next_page_number()
-3
->>> p.previous_page_number()
-1
->>> p.start_index()
-6
->>> p.end_index()
-9
-
-# Empty pages raise EmptyPage.
->>> paginator.page(0)
-Traceback (most recent call last):
-...
-EmptyPage: ...
->>> paginator.page(3)
-Traceback (most recent call last):
-...
-EmptyPage: ...
-
-# Empty paginators with allow_empty_first_page=True.
->>> paginator = Paginator(Article.objects.filter(id=0), 5, 
allow_empty_first_page=True)
->>> paginator.count
-0
->>> paginator.num_pages
-1
->>> paginator.page_range
-[1]
-
-# Empty paginators with allow_empty_first_page=False.
->>> paginator = Paginator(Article.objects.filter(id=0), 5, 
allow_empty_first_page=False)
->>> paginator.count
-0
->>> paginator.num_pages
-0
->>> paginator.page_range
-[]
-
-# Paginators work with regular lists/tuples, too -- not just with QuerySets.
->>> paginator = Paginator([1, 2, 3, 4, 5, 6, 7, 8, 9], 5)
->>> paginator.count
-9
->>> paginator.num_pages
-2
->>> paginator.page_range
-[1, 2]
-
-# Get the first page.
->>> p = paginator.page(1)
->>> p
-
->>> p.object_list
-[1, 2, 3, 4, 5]
->>> p.has_next()
-True
->>> p.has_previous()
-False
->>> p.has_other_pages()
-True
->>> p.next_page_number()
-2
->>> p.previous_page_number()
-0
->>> p.start_index()
-1
->>> p.end_index()
-5
-
-# Paginator can be passed other objects with a count() method.
->>> class CountContainer:
-... def count(self):
-... return 42
->>> paginator = Paginator(CountContainer(), 10)
->>> paginator.count
-42
->>> paginator.num_pages
-5
->>> paginator.page_range
-[1, 2, 3, 4, 5]
-
-# Paginator can be passed other objects that implement __len__.
->>> class LenContainer:
-... def __len__(self):
-... return 42
->>> paginator = Paginator(LenContainer(), 10)
->>> paginator.count
-42
->>> paginator.num_pages
-5
->>> paginator.page_range
-[1, 2, 3, 4, 5]
-
-
-##
-# Orphan support #
-##
-
-# Add a few more records to test out the orphans feature.
->>> for x in range(10, 13):
-... Article(headline="Article %s" % x, pub_date=datetime(2006, 10, 
6)).save()
-
-# With orphans set to 3 and 10 items per page, we should get all 12 items on a 
single page.
->>> paginator = Paginator(Article.objects.all(), 10, orphans=3)
->>> paginator.num_pages
-1
-
-# With orphans only set to 1, we should get two pages.
->>> paginator = Paginator(Article.objects.all(), 10, orphans=1)
->>> paginator.num_pages
-2
-"""}

Added: django/branches/releases/1.2.X/tests/modeltests/pagination/tests.py
===
--- django/branches/releases/1.2.X/tests/modeltests/pagination/tests.py 
(rev 0)
+++ django/branches/releases/1.2.X/tests/modeltests/pagination/tests.py 
2010-10-11 20:38:29 UTC (rev 14153)
@@ -0,0 +1,132 @@
+from datetime import datetime
+from operator import attrgetter
+
+from django.core.paginator import Paginator, InvalidPage, EmptyPage
+from django.test import TestCase
+

[Changeset] r14152 - django/trunk/tests/modeltests/pagination

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 15:38:12 -0500 (Mon, 11 Oct 2010)
New Revision: 14152

Added:
   django/trunk/tests/modeltests/pagination/tests.py
Modified:
   django/trunk/tests/modeltests/pagination/models.py
Log:
Fixed #1 -- Convert the pagination doctests to unittests.  We have always 
been at war with doctests.  Thanks to Gabriel Hurley for the patch.

Modified: django/trunk/tests/modeltests/pagination/models.py
===
--- django/trunk/tests/modeltests/pagination/models.py  2010-10-11 20:34:16 UTC 
(rev 14151)
+++ django/trunk/tests/modeltests/pagination/models.py  2010-10-11 20:38:12 UTC 
(rev 14152)
@@ -8,173 +8,10 @@
 
 from django.db import models
 
+
 class Article(models.Model):
 headline = models.CharField(max_length=100, default='Default headline')
 pub_date = models.DateTimeField()
 
 def __unicode__(self):
 return self.headline
-
-__test__ = {'API_TESTS':"""
-# Prepare a list of objects for pagination.
->>> from datetime import datetime
->>> for x in range(1, 10):
-... a = Article(headline='Article %s' % x, pub_date=datetime(2005, 7, 29))
-... a.save()
-
-##
-# Paginator/Page #
-##
-
->>> from django.core.paginator import Paginator
->>> paginator = Paginator(Article.objects.all(), 5)
->>> paginator.count
-9
->>> paginator.num_pages
-2
->>> paginator.page_range
-[1, 2]
-
-# Get the first page.
->>> p = paginator.page(1)
->>> p
-
->>> p.object_list
-[, , , , ]
->>> p.has_next()
-True
->>> p.has_previous()
-False
->>> p.has_other_pages()
-True
->>> p.next_page_number()
-2
->>> p.previous_page_number()
-0
->>> p.start_index()
-1
->>> p.end_index()
-5
-
-# Get the second page.
->>> p = paginator.page(2)
->>> p
-
->>> p.object_list
-[, , , ]
->>> p.has_next()
-False
->>> p.has_previous()
-True
->>> p.has_other_pages()
-True
->>> p.next_page_number()
-3
->>> p.previous_page_number()
-1
->>> p.start_index()
-6
->>> p.end_index()
-9
-
-# Empty pages raise EmptyPage.
->>> paginator.page(0)
-Traceback (most recent call last):
-...
-EmptyPage: ...
->>> paginator.page(3)
-Traceback (most recent call last):
-...
-EmptyPage: ...
-
-# Empty paginators with allow_empty_first_page=True.
->>> paginator = Paginator(Article.objects.filter(id=0), 5, 
allow_empty_first_page=True)
->>> paginator.count
-0
->>> paginator.num_pages
-1
->>> paginator.page_range
-[1]
-
-# Empty paginators with allow_empty_first_page=False.
->>> paginator = Paginator(Article.objects.filter(id=0), 5, 
allow_empty_first_page=False)
->>> paginator.count
-0
->>> paginator.num_pages
-0
->>> paginator.page_range
-[]
-
-# Paginators work with regular lists/tuples, too -- not just with QuerySets.
->>> paginator = Paginator([1, 2, 3, 4, 5, 6, 7, 8, 9], 5)
->>> paginator.count
-9
->>> paginator.num_pages
-2
->>> paginator.page_range
-[1, 2]
-
-# Get the first page.
->>> p = paginator.page(1)
->>> p
-
->>> p.object_list
-[1, 2, 3, 4, 5]
->>> p.has_next()
-True
->>> p.has_previous()
-False
->>> p.has_other_pages()
-True
->>> p.next_page_number()
-2
->>> p.previous_page_number()
-0
->>> p.start_index()
-1
->>> p.end_index()
-5
-
-# Paginator can be passed other objects with a count() method.
->>> class CountContainer:
-... def count(self):
-... return 42
->>> paginator = Paginator(CountContainer(), 10)
->>> paginator.count
-42
->>> paginator.num_pages
-5
->>> paginator.page_range
-[1, 2, 3, 4, 5]
-
-# Paginator can be passed other objects that implement __len__.
->>> class LenContainer:
-... def __len__(self):
-... return 42
->>> paginator = Paginator(LenContainer(), 10)
->>> paginator.count
-42
->>> paginator.num_pages
-5
->>> paginator.page_range
-[1, 2, 3, 4, 5]
-
-
-##
-# Orphan support #
-##
-
-# Add a few more records to test out the orphans feature.
->>> for x in range(10, 13):
-... Article(headline="Article %s" % x, pub_date=datetime(2006, 10, 
6)).save()
-
-# With orphans set to 3 and 10 items per page, we should get all 12 items on a 
single page.
->>> paginator = Paginator(Article.objects.all(), 10, orphans=3)
->>> paginator.num_pages
-1
-
-# With orphans only set to 1, we should get two pages.
->>> paginator = Paginator(Article.objects.all(), 10, orphans=1)
->>> paginator.num_pages
-2
-"""}

Added: django/trunk/tests/modeltests/pagination/tests.py
===
--- django/trunk/tests/modeltests/pagination/tests.py   
(rev 0)
+++ django/trunk/tests/modeltests/pagination/tests.py   2010-10-11 20:38:12 UTC 
(rev 14152)
@@ -0,0 +1,132 @@
+from datetime import datetime
+from operator import attrgetter
+
+from django.core.paginator import Paginator, InvalidPage, EmptyPage
+from django.test import TestCase
+
+from models import Article
+
+
+class CountContainer(object):
+def count(self):
+return 42
+
+class LenContainer(object):
+def __len__(self):
+return 42
+

Re: [Django] #14439: Running the GIS testsuite is very hard.

2010-10-11 Thread Django
#14439: Running the GIS testsuite is very hard.
-+--
  Reporter:  lukeplant   | Owner:  nobody
Status:  closed  | Milestone:
 Component:  GIS |   Version:  1.2   
Resolution:  invalid |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Comment (by lukeplant):

 I was looking for somewhere that would tell me what I need to know to run
 the GeoDjango tests, and found it frustrating that after more than an hour
 I hadn't been able to collect enough information from the different parts
 of the docs to be able to do this.  I have finally succeeded in running
 them, at least with PostGIS. AFAICS, the process is to do something like:

  1. Following the installation instructions for GeoDjango, and set up
 users/databases etc.
  2. Create a throw-away a project using `django-admin.py startproject`
  3. Change the settings to use the
 `django.contrib.gis.db.backends.postgis` backend
  4. Add `TEST_RUNNER='django.contrib.gis.tests.run_gis_tests'` to the
 settings file (or, better,
 `'django.contrib.gis.tests.GeoDjangoTestSuiteRunner'`, since the former
 produces deprecation warnings)

 Number 1 is obvious, number 4 is documented
 [http://docs.djangoproject.com/en/1.2/ref/contrib/gis/testing/#geodjango-
 test-suite here], but the rest is not obvious from the perspective of
 someone just wanting to run the tests.

 It's absolutely fair enough to close as INVALID, since it's a pretty vague
 report, and I don't know what to do about it either.  But I thought it was
 worthwhile noting it to someone.

-- 
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-upda...@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] r14151 - django/trunk/docs/releases

2010-10-11 Thread noreply
Author: gabrielhurley
Date: 2010-10-11 15:34:16 -0500 (Mon, 11 Oct 2010)
New Revision: 14151

Modified:
   django/trunk/docs/releases/1.3.txt
Log:
Fixed the same set of typos as were corrected in [14149], this time in the 
release notes. Thanks to Paul McMillan for the report.

Modified: django/trunk/docs/releases/1.3.txt
===
--- django/trunk/docs/releases/1.3.txt  2010-10-11 19:48:15 UTC (rev 14150)
+++ django/trunk/docs/releases/1.3.txt  2010-10-11 20:34:16 UTC (rev 14151)
@@ -148,15 +148,15 @@
 
 To access this library, Django provides the
 ``django.utils.unittest`` module alias. If you are using Python
-2.7, or you have installed unittest2 locally, Django will mapt the
-alias to the installed version of the unittest library Otherwise,
+2.7, or you have installed unittest2 locally, Django will map the
+alias to the installed version of the unittest library. Otherwise,
 Django will use it's own bundled version of unittest2.
 
 To use this alias, simply use::
 
 from django.utils import unittest
 
-wherever you would historically used::
+wherever you would have historically used::
 
 import unittest
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] #14249: Inactive users have less permissions then anonymous users with custom backend

2010-10-11 Thread Django
#14249: Inactive users have less permissions then anonymous users with custom
backend
-+--
  Reporter:  hvdklauw| Owner:  nobody
Status:  new | Milestone:  1.3   
 Component:  Authentication  |   Version:  1.2   
Resolution:  |  Keywords:
 Stage:  Design decision needed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Comment (by Alex):

 Seems to me we'd want to add a flag to Auth backends, like we did for
 anonymous and per-object permissions.

-- 
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-upda...@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] #14444: Convert pagination doctests to unittests

2010-10-11 Thread Django
#1: Convert pagination doctests to unittests
---+
 Reporter:  gabrielhurley  |   Owner:  gabrielhurley
   Status:  new|   Milestone:  1.3  
Component:  Testing framework  | Version:  1.2  
 Keywords: |   Stage:  Unreviewed   
Has_patch:  1  |  
---+
 Patch to eradicate the pagination doctests.

-- 
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-upda...@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] r14150 - django/trunk/docs/ref/contrib/gis

2010-10-11 Thread noreply
Author: jbronn
Date: 2010-10-11 14:48:15 -0500 (Mon, 11 Oct 2010)
New Revision: 14150

Modified:
   django/trunk/docs/ref/contrib/gis/install.txt
Log:
Updated version of PostGIS in GeoDjango install docs.

Modified: django/trunk/docs/ref/contrib/gis/install.txt
===
--- django/trunk/docs/ref/contrib/gis/install.txt   2010-10-11 19:19:01 UTC 
(rev 14149)
+++ django/trunk/docs/ref/contrib/gis/install.txt   2010-10-11 19:48:15 UTC 
(rev 14150)
@@ -240,9 +240,9 @@
 
 First download the source archive, and extract::
 
-$ wget http://postgis.refractions.net/download/postgis-1.5.1.tar.gz
-$ tar xzf postgis-1.5.1.tar.gz
-$ cd postgis-1.5.1
+$ wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
+$ tar xzf postgis-1.5.2.tar.gz
+$ cd postgis-1.5.2
 
 Next, configure, make and install PostGIS::
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14149 - django/trunk/docs/topics

2010-10-11 Thread noreply
Author: gabrielhurley
Date: 2010-10-11 14:19:01 -0500 (Mon, 11 Oct 2010)
New Revision: 14149

Modified:
   django/trunk/docs/topics/testing.txt
Log:
Fixed a few typos in the unittest2 docs introduced in [14139].

Modified: django/trunk/docs/topics/testing.txt
===
--- django/trunk/docs/topics/testing.txt2010-10-11 18:18:12 UTC (rev 
14148)
+++ django/trunk/docs/topics/testing.txt2010-10-11 19:19:01 UTC (rev 
14149)
@@ -167,15 +167,15 @@
 
 To access this library, Django provides the
 ``django.utils.unittest`` module alias. If you are using Python
-2.7, or you have installed unittest2 locally, Django will mapt the
-alias to the installed version of the unittest library Otherwise,
+2.7, or you have installed unittest2 locally, Django will map the
+alias to the installed version of the unittest library. Otherwise,
 Django will use it's own bundled version of unittest2.
 
 To use this alias, simply use::
 
 from django.utils import unittest
 
-wherever you would historically used::
+wherever you would have historically used::
 
 import unittest
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] #14443: Oracle backend returns wrong test database name

2010-10-11 Thread Django
#14443: Oracle backend returns wrong test database name
---+
  Reporter:  gruszczy  | Owner:  nobody
Status:  new   | Milestone:
 Component:  Database layer (models, ORM)  |   Version:  SVN   
Resolution:|  Keywords:
 Stage:  Accepted  | Has_patch:  1 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by ramiro):

  * stage:  Unreviewed => Accepted

Comment:

 In the days when the 1.1 release was near there was some work in this area
 of the code. Please see changesets r10547 and r10608 and its associated
 ticket: #10716 (also, r8330 from the 1.0 development cycle). Note how some
 attempts to rationalize things that arose from simple code inspection had
 to be undone

 IMHO, certainly it would be helpful if somebody with a) access to a
 working Oracle setup, b) Oracle experience and c) time do dedicate to the
 task could make and test a holistic review and cleanup of the code. I can
 submit the resulting patch for review by the Oracle experts in the core
 development team and commit it if all goes ok.

 a) and b) are critical because AFAIK e.g. the Django test suite is running
 now under Oracle in these conditions and we don be the ones that break it,
 aren't we :)

-- 
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-upda...@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] #14433: Thread safety problem in contrib.sitemaps

2010-10-11 Thread Django
#14433: Thread safety problem in contrib.sitemaps
+---
  Reporter:  gabrielhurley  | Owner:  gabrielhurley
Status:  closed | Milestone:  1.3  
 Component:  Contrib apps   |   Version:  1.2  
Resolution:  fixed  |  Keywords:   
 Stage:  Unreviewed | Has_patch:  1
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Comment (by gabrielhurley):

 I knew the patch wasn't finished, but I had to run out the door. I wanted
 to give Justin or someone else who could run the GIS suite a chance to
 look at it. All the same, thanks for wrapping it up Luke.

-- 
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-upda...@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] #14439: Running the GIS testsuite is very hard.

2010-10-11 Thread Django
#14439: Running the GIS testsuite is very hard.
-+--
  Reporter:  lukeplant   | Owner:  nobody
Status:  closed  | Milestone:
 Component:  GIS |   Version:  1.2   
Resolution:  invalid |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by jbronn):

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

-- 
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-upda...@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] #14439: Running the GIS testsuite is very hard.

2010-10-11 Thread Django
#14439: Running the GIS testsuite is very hard.
-+--
  Reporter:  lukeplant   | Owner:  nobody
Status:  new | Milestone:
 Component:  GIS |   Version:  1.2   
Resolution:  |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Comment (by jbronn):

 You're trying to run GIS tests using the wrong database backend -- Alex is
 wrong, it's actually `django.contrib.gis.db.backends.postgis`.

 Did you read the [spatial backend docs
 http://docs.djangoproject.com/en/dev/ref/contrib/gis/db-api/#spatial-
 backends]?

 I don't see what I'm supposed to do with this ticket.

-- 
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-upda...@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] r14148 - django/branches/releases/1.2.X/tests/modeltests/ordering

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 13:18:12 -0500 (Mon, 11 Oct 2010)
New Revision: 14148

Added:
   django/branches/releases/1.2.X/tests/modeltests/ordering/tests.py
Modified:
   django/branches/releases/1.2.X/tests/modeltests/ordering/models.py
Log:
[1.2.X] Converted ordering tests from doctests to unittests.  We have always 
been at war with doctests.  Backport of [14147].

Modified: django/branches/releases/1.2.X/tests/modeltests/ordering/models.py
===
--- django/branches/releases/1.2.X/tests/modeltests/ordering/models.py  
2010-10-11 18:17:37 UTC (rev 14147)
+++ django/branches/releases/1.2.X/tests/modeltests/ordering/models.py  
2010-10-11 18:18:12 UTC (rev 14148)
@@ -15,6 +15,7 @@
 
 from django.db import models
 
+
 class Article(models.Model):
 headline = models.CharField(max_length=100)
 pub_date = models.DateTimeField()
@@ -23,67 +24,3 @@
 
 def __unicode__(self):
 return self.headline
-
-__test__ = {'API_TESTS':"""
-# Create a couple of Articles.
->>> from datetime import datetime
->>> a1 = Article(headline='Article 1', pub_date=datetime(2005, 7, 26))
->>> a1.save()
->>> a2 = Article(headline='Article 2', pub_date=datetime(2005, 7, 27))
->>> a2.save()
->>> a3 = Article(headline='Article 3', pub_date=datetime(2005, 7, 27))
->>> a3.save()
->>> a4 = Article(headline='Article 4', pub_date=datetime(2005, 7, 28))
->>> a4.save()
-
-# By default, Article.objects.all() orders by pub_date descending, then
-# headline ascending.
->>> Article.objects.all()
-[, , , ]
-
-# Override ordering with order_by, which is in the same format as the ordering
-# attribute in models.
->>> Article.objects.order_by('headline')
-[, , , ]
->>> Article.objects.order_by('pub_date', '-headline')
-[, , , ]
-
-# Only the last order_by has any effect (since they each override any previous
-# ordering).
->>> Article.objects.order_by('id')
-[, , , ]
->>> Article.objects.order_by('id').order_by('-headline')
-[, , , ]
-
-# Use the 'stop' part of slicing notation to limit the results.
->>> Article.objects.order_by('headline')[:2]
-[, ]
-
-# Use the 'stop' and 'start' parts of slicing notation to offset the result 
list.
->>> Article.objects.order_by('headline')[1:3]
-[, ]
-
-# Getting a single item should work too:
->>> Article.objects.all()[0]
-
-
-# Use '?' to order randomly. (We're using [...] in the output to indicate we
-# don't know what order the output will be in.
->>> Article.objects.order_by('?')
-[...]
-
-# Ordering can be reversed using the reverse() method on a queryset. This
-# allows you to extract things like "the last two items" (reverse and then
-# take the first two).
->>> Article.objects.all().reverse()[:2]
-[, ]
-
-# Ordering can be based on fields included from an 'extra' clause
->>> Article.objects.extra(select={'foo': 'pub_date'}, order_by=['foo', 
'headline'])
-[, , , ]
-
-# If the extra clause uses an SQL keyword for a name, it will be protected by 
quoting.
->>> Article.objects.extra(select={'order': 'pub_date'}, order_by=['order', 
'headline'])
-[, , , ]
-
-"""}

Added: django/branches/releases/1.2.X/tests/modeltests/ordering/tests.py
===
--- django/branches/releases/1.2.X/tests/modeltests/ordering/tests.py   
(rev 0)
+++ django/branches/releases/1.2.X/tests/modeltests/ordering/tests.py   
2010-10-11 18:18:12 UTC (rev 14148)
@@ -0,0 +1,137 @@
+from datetime import datetime
+from operator import attrgetter
+
+from django.test import TestCase
+
+from models import Article
+
+
+class OrderingTests(TestCase):
+def test_basic(self):
+a1 = Article.objects.create(
+headline="Article 1", pub_date=datetime(2005, 7, 26)
+)
+a2 = Article.objects.create(
+headline="Article 2", pub_date=datetime(2005, 7, 27)
+)
+a3 = Article.objects.create(
+headline="Article 3", pub_date=datetime(2005, 7, 27)
+)
+a4 = Article.objects.create(
+headline="Article 4", pub_date=datetime(2005, 7, 28)
+)
+
+# By default, Article.objects.all() orders by pub_date descending, then
+# headline ascending.
+self.assertQuerysetEqual(
+Article.objects.all(), [
+"Article 4",
+"Article 2",
+"Article 3",
+"Article 1",
+],
+attrgetter("headline")
+)
+
+# Override ordering with order_by, which is in the same format as the
+# ordering attribute in models.
+self.assertQuerysetEqual(
+Article.objects.order_by("headline"), [
+"Article 1",
+"Article 2",
+"Article 3",
+"Article 4",
+],
+attrgetter("headline")
+)
+self.assertQuerysetEqual(
+Article.objects.order_by("pub_date", "-headline"), [
+ 

[Changeset] r14147 - django/trunk/tests/modeltests/ordering

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 13:17:37 -0500 (Mon, 11 Oct 2010)
New Revision: 14147

Added:
   django/trunk/tests/modeltests/ordering/tests.py
Modified:
   django/trunk/tests/modeltests/ordering/models.py
Log:
Converted ordering tests from doctests to unittests.  We have always been at 
war with doctests.

Modified: django/trunk/tests/modeltests/ordering/models.py
===
--- django/trunk/tests/modeltests/ordering/models.py2010-10-11 17:41:59 UTC 
(rev 14146)
+++ django/trunk/tests/modeltests/ordering/models.py2010-10-11 18:17:37 UTC 
(rev 14147)
@@ -15,6 +15,7 @@
 
 from django.db import models
 
+
 class Article(models.Model):
 headline = models.CharField(max_length=100)
 pub_date = models.DateTimeField()
@@ -23,67 +24,3 @@
 
 def __unicode__(self):
 return self.headline
-
-__test__ = {'API_TESTS':"""
-# Create a couple of Articles.
->>> from datetime import datetime
->>> a1 = Article(headline='Article 1', pub_date=datetime(2005, 7, 26))
->>> a1.save()
->>> a2 = Article(headline='Article 2', pub_date=datetime(2005, 7, 27))
->>> a2.save()
->>> a3 = Article(headline='Article 3', pub_date=datetime(2005, 7, 27))
->>> a3.save()
->>> a4 = Article(headline='Article 4', pub_date=datetime(2005, 7, 28))
->>> a4.save()
-
-# By default, Article.objects.all() orders by pub_date descending, then
-# headline ascending.
->>> Article.objects.all()
-[, , , ]
-
-# Override ordering with order_by, which is in the same format as the ordering
-# attribute in models.
->>> Article.objects.order_by('headline')
-[, , , ]
->>> Article.objects.order_by('pub_date', '-headline')
-[, , , ]
-
-# Only the last order_by has any effect (since they each override any previous
-# ordering).
->>> Article.objects.order_by('id')
-[, , , ]
->>> Article.objects.order_by('id').order_by('-headline')
-[, , , ]
-
-# Use the 'stop' part of slicing notation to limit the results.
->>> Article.objects.order_by('headline')[:2]
-[, ]
-
-# Use the 'stop' and 'start' parts of slicing notation to offset the result 
list.
->>> Article.objects.order_by('headline')[1:3]
-[, ]
-
-# Getting a single item should work too:
->>> Article.objects.all()[0]
-
-
-# Use '?' to order randomly. (We're using [...] in the output to indicate we
-# don't know what order the output will be in.
->>> Article.objects.order_by('?')
-[...]
-
-# Ordering can be reversed using the reverse() method on a queryset. This
-# allows you to extract things like "the last two items" (reverse and then
-# take the first two).
->>> Article.objects.all().reverse()[:2]
-[, ]
-
-# Ordering can be based on fields included from an 'extra' clause
->>> Article.objects.extra(select={'foo': 'pub_date'}, order_by=['foo', 
'headline'])
-[, , , ]
-
-# If the extra clause uses an SQL keyword for a name, it will be protected by 
quoting.
->>> Article.objects.extra(select={'order': 'pub_date'}, order_by=['order', 
'headline'])
-[, , , ]
-
-"""}

Added: django/trunk/tests/modeltests/ordering/tests.py
===
--- django/trunk/tests/modeltests/ordering/tests.py 
(rev 0)
+++ django/trunk/tests/modeltests/ordering/tests.py 2010-10-11 18:17:37 UTC 
(rev 14147)
@@ -0,0 +1,137 @@
+from datetime import datetime
+from operator import attrgetter
+
+from django.test import TestCase
+
+from models import Article
+
+
+class OrderingTests(TestCase):
+def test_basic(self):
+a1 = Article.objects.create(
+headline="Article 1", pub_date=datetime(2005, 7, 26)
+)
+a2 = Article.objects.create(
+headline="Article 2", pub_date=datetime(2005, 7, 27)
+)
+a3 = Article.objects.create(
+headline="Article 3", pub_date=datetime(2005, 7, 27)
+)
+a4 = Article.objects.create(
+headline="Article 4", pub_date=datetime(2005, 7, 28)
+)
+
+# By default, Article.objects.all() orders by pub_date descending, then
+# headline ascending.
+self.assertQuerysetEqual(
+Article.objects.all(), [
+"Article 4",
+"Article 2",
+"Article 3",
+"Article 1",
+],
+attrgetter("headline")
+)
+
+# Override ordering with order_by, which is in the same format as the
+# ordering attribute in models.
+self.assertQuerysetEqual(
+Article.objects.order_by("headline"), [
+"Article 1",
+"Article 2",
+"Article 3",
+"Article 4",
+],
+attrgetter("headline")
+)
+self.assertQuerysetEqual(
+Article.objects.order_by("pub_date", "-headline"), [
+"Article 1",
+"Article 3",
+"Article 2",
+"Article 4",
+],
+attrgetter("headline")
+   

[Django] #14443: Oracle backend returns wrong test database name

2010-10-11 Thread Django
#14443: Oracle backend returns wrong test database name
--+-
 Reporter:  gruszczy  |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Database layer (models, ORM)  | Version:  SVN   
 Keywords:|   Stage:  Unreviewed
Has_patch:  0 |  
--+-
 While working on #14415 I have noticed that method {{{ _create_test_db }}}
 in {{{ DatabaseCreation }}} consistently returns either {{{ TEST_NAME }}}
 or {{{ 'test_' + NAME }}}, but this class for Oracle returns {{{
 self.connection.settings_dict['NAME'] }}}. Is that corrent? I am posting a
 one line patch, that returns proper value.

-- 
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-upda...@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] r14146 - django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 12:41:59 -0500 (Mon, 11 Oct 2010)
New Revision: 14146

Added:
   django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks/tests.py
Modified:
   django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks/models.py
Log:
[1.2.X] Converted save_delete_hooks tests from doctests to unittests.  We have 
always been at war with doctests.  Backport of [14145].

Modified: 
django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks/models.py
===
--- django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks/models.py 
2010-10-11 17:41:44 UTC (rev 14145)
+++ django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks/models.py 
2010-10-11 17:41:59 UTC (rev 14146)
@@ -7,37 +7,26 @@
 
 from django.db import models
 
+
 class Person(models.Model):
 first_name = models.CharField(max_length=20)
 last_name = models.CharField(max_length=20)
 
+def __init__(self, *args, **kwargs):
+super(Person, self).__init__(*args, **kwargs)
+self.data = []
+
 def __unicode__(self):
 return u"%s %s" % (self.first_name, self.last_name)
 
-def save(self, force_insert=False, force_update=False):
-print "Before save"
+def save(self, *args, **kwargs):
+self.data.append("Before save")
  # Call the "real" save() method
-super(Person, self).save(force_insert, force_update)
-print "After save"
+super(Person, self).save(*args, **kwargs)
+self.data.append("After save")
 
 def delete(self):
-print "Before deletion"
-super(Person, self).delete() # Call the "real" delete() method
-print "After deletion"
-
-__test__ = {'API_TESTS':"""
->>> p1 = Person(first_name='John', last_name='Smith')
->>> p1.save()
-Before save
-After save
-
->>> Person.objects.all()
-[]
-
->>> p1.delete()
-Before deletion
-After deletion
-
->>> Person.objects.all()
-[]
-"""}
+self.data.append("Before deletion")
+# Call the "real" delete() method
+super(Person, self).delete()
+self.data.append("After deletion")

Added: 
django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks/tests.py
===
--- django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks/tests.py  
(rev 0)
+++ django/branches/releases/1.2.X/tests/modeltests/save_delete_hooks/tests.py  
2010-10-11 17:41:59 UTC (rev 14146)
@@ -0,0 +1,30 @@
+from django.test import TestCase
+
+from models import Person
+
+
+class SaveDeleteHookTests(TestCase):
+def test_basic(self):
+p = Person(first_name="John", last_name="Smith")
+self.assertEqual(p.data, [])
+p.save()
+self.assertEqual(p.data, [
+"Before save",
+"After save",
+])
+
+self.assertQuerysetEqual(
+Person.objects.all(), [
+"John Smith",
+],
+unicode
+)
+
+p.delete()
+self.assertEqual(p.data, [
+"Before save",
+"After save",
+"Before deletion",
+"After deletion",
+])
+self.assertQuerysetEqual(Person.objects.all(), [])

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] r14145 - django/trunk/tests/modeltests/save_delete_hooks

2010-10-11 Thread noreply
Author: Alex
Date: 2010-10-11 12:41:44 -0500 (Mon, 11 Oct 2010)
New Revision: 14145

Added:
   django/trunk/tests/modeltests/save_delete_hooks/tests.py
Modified:
   django/trunk/tests/modeltests/save_delete_hooks/models.py
Log:
Converted save_delete_hooks tests from doctests to unittests.  We have always 
been at war with doctests.

Modified: django/trunk/tests/modeltests/save_delete_hooks/models.py
===
--- django/trunk/tests/modeltests/save_delete_hooks/models.py   2010-10-11 
15:18:34 UTC (rev 14144)
+++ django/trunk/tests/modeltests/save_delete_hooks/models.py   2010-10-11 
17:41:44 UTC (rev 14145)
@@ -7,37 +7,26 @@
 
 from django.db import models
 
+
 class Person(models.Model):
 first_name = models.CharField(max_length=20)
 last_name = models.CharField(max_length=20)
 
+def __init__(self, *args, **kwargs):
+super(Person, self).__init__(*args, **kwargs)
+self.data = []
+
 def __unicode__(self):
 return u"%s %s" % (self.first_name, self.last_name)
 
-def save(self, force_insert=False, force_update=False):
-print "Before save"
+def save(self, *args, **kwargs):
+self.data.append("Before save")
  # Call the "real" save() method
-super(Person, self).save(force_insert, force_update)
-print "After save"
+super(Person, self).save(*args, **kwargs)
+self.data.append("After save")
 
 def delete(self):
-print "Before deletion"
-super(Person, self).delete() # Call the "real" delete() method
-print "After deletion"
-
-__test__ = {'API_TESTS':"""
->>> p1 = Person(first_name='John', last_name='Smith')
->>> p1.save()
-Before save
-After save
-
->>> Person.objects.all()
-[]
-
->>> p1.delete()
-Before deletion
-After deletion
-
->>> Person.objects.all()
-[]
-"""}
+self.data.append("Before deletion")
+# Call the "real" delete() method
+super(Person, self).delete()
+self.data.append("After deletion")

Added: django/trunk/tests/modeltests/save_delete_hooks/tests.py
===
--- django/trunk/tests/modeltests/save_delete_hooks/tests.py
(rev 0)
+++ django/trunk/tests/modeltests/save_delete_hooks/tests.py2010-10-11 
17:41:44 UTC (rev 14145)
@@ -0,0 +1,30 @@
+from django.test import TestCase
+
+from models import Person
+
+
+class SaveDeleteHookTests(TestCase):
+def test_basic(self):
+p = Person(first_name="John", last_name="Smith")
+self.assertEqual(p.data, [])
+p.save()
+self.assertEqual(p.data, [
+"Before save",
+"After save",
+])
+
+self.assertQuerysetEqual(
+Person.objects.all(), [
+"John Smith",
+],
+unicode
+)
+
+p.delete()
+self.assertEqual(p.data, [
+"Before save",
+"After save",
+"Before deletion",
+"After deletion",
+])
+self.assertQuerysetEqual(Person.objects.all(), [])

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] #14442: During tests parse fixtures using setUpClass

2010-10-11 Thread Django
#14442: During tests parse fixtures using setUpClass
---+
 Reporter:  Alex   |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Uncategorized  | Version:  1.2   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Now that we can do class level setup we should move most of the stuff (but
 particularly parsing of fixtures) into setUpClass.

-- 
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-upda...@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] #14442: During tests parse fixtures using setUpClass

2010-10-11 Thread Django
#14442: During tests parse fixtures using setUpClass
+---
  Reporter:  Alex   | Owner:  Alex
Status:  assigned   | Milestone:  
 Component:  Testing framework  |   Version:  SVN 
Resolution: |  Keywords:  
 Stage:  Accepted   | Has_patch:  0   
Needs_docs:  0  |   Needs_tests:  0   
Needs_better_patch:  0  |  
+---
Changes (by Alex):

  * version:  1.2 => SVN

-- 
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-upda...@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] #14442: During tests parse fixtures using setUpClass

2010-10-11 Thread Django
#14442: During tests parse fixtures using setUpClass
+---
  Reporter:  Alex   | Owner:  Alex
Status:  assigned   | Milestone:  
 Component:  Testing framework  |   Version:  1.2 
Resolution: |  Keywords:  
 Stage:  Accepted   | Has_patch:  0   
Needs_docs:  0  |   Needs_tests:  0   
Needs_better_patch:  0  |  
+---
Changes (by Alex):

  * status:  new => assigned
  * needs_better_patch:  => 0
  * component:  Uncategorized => Testing framework
  * needs_tests:  => 0
  * owner:  nobody => Alex
  * needs_docs:  => 0
  * stage:  Unreviewed => Accepted

-- 
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-upda...@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] #14441: Oracle list limit exceeded with __in filters

2010-10-11 Thread Django
#14441: Oracle list limit exceeded with __in filters
---+
  Reporter:  DavidMAM  | Owner:  nobody
Status:  closed| Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.1   
Resolution:  duplicate |  Keywords:  Oracle
 Stage:  Design decision needed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by lrekucki):

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

Comment:

 Replying to [comment:2 Alex]:
 > Reformatted the message.  Can you try this on trunk, I'm almost positive
 I saw ian kelly commit a fix for this.

 That would be #14244. Closing as a duplicate.

-- 
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-upda...@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] #14441: Oracle list limit exceeded with __in filters

2010-10-11 Thread Django
#14441: Oracle list limit exceeded with __in filters
---+
  Reporter:  DavidMAM  | Owner:  nobody
Status:  new   | Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.1   
Resolution:|  Keywords:  Oracle
 Stage:  Design decision needed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Old description:

> Trying to retrieve a set of objects based on field values. I build the
> set of values as an array
>
> namelist=[]
>
> .. some code that does namelist.append(name) many times
>
> obl=MyObject.objects.filter(namefield__in=namelist)
>
> obl.count()
> if namelist is longer than 1000 then Oracle throws an error
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/local/lib/python2.6/site-
> packages/django/db/models/query.py", line 292, in count
> return self.query.get_count()
>   File "/usr/local/lib/python2.6/site-
> packages/django/db/models/sql/query.py", line 376, in get_count
> number = obj.get_aggregation()[None]
>   File "/usr/local/lib/python2.6/site-
> packages/django/db/models/sql/query.py", line 348, in get_aggregation
> result = query.execute_sql(SINGLE)
>   File "/usr/local/lib/python2.6/site-
> packages/django/db/models/sql/query.py", line 2369, in execute_sql
> cursor.execute(sql, params)
>   File "/usr/local/lib/python2.6/site-
> packages/django/db/backends/util.py", line 19, in execute
> return self.cursor.execute(sql, params)
>   File "/usr/local/lib/python2.6/site-
> packages/django/db/backends/oracle/base.py", line 443, in execute
> raise e
> DatabaseError: ORA-01795: maximum number of expressions in a list is 1000
>
> I don't know if there is an easy way to combine querysets as splitting
> them into batches of a suitable number would be no problem if they could
> be combined later.

New description:

 Trying to retrieve a set of objects based on field values. I build the set
 of values as an array
 {{{
 namelist=[]
 }}}
 .. some code that does namelist.append(name) many times
 {{{
 obl=MyObject.objects.filter(namefield__in=namelist)

 obl.count()
 }}}
 if namelist is longer than 1000 then Oracle throws an error
 {{{
 Traceback (most recent call last):
   File "", line 1, in 
   File "/usr/local/lib/python2.6/site-packages/django/db/models/query.py",
 line 292, in count
 return self.query.get_count()
   File "/usr/local/lib/python2.6/site-
 packages/django/db/models/sql/query.py", line 376, in get_count
 number = obj.get_aggregation()[None]
   File "/usr/local/lib/python2.6/site-
 packages/django/db/models/sql/query.py", line 348, in get_aggregation
 result = query.execute_sql(SINGLE)
   File "/usr/local/lib/python2.6/site-
 packages/django/db/models/sql/query.py", line 2369, in execute_sql
 cursor.execute(sql, params)
   File "/usr/local/lib/python2.6/site-
 packages/django/db/backends/util.py", line 19, in execute
 return self.cursor.execute(sql, params)
   File "/usr/local/lib/python2.6/site-
 packages/django/db/backends/oracle/base.py", line 443, in execute
 raise e
 DatabaseError: ORA-01795: maximum number of expressions in a list is 1000
 }}}
 I don't know if there is an easy way to combine querysets as splitting
 them into batches of a suitable number would be no problem if they could
 be combined later.

Comment (by Alex):

 Reformatted the message.  Can you try this on trunk, I'm almost positive I
 saw ian kelly commit a fix for this.

-- 
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-upda...@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] #14439: Running the GIS testsuite is very hard.

2010-10-11 Thread Django
#14439: Running the GIS testsuite is very hard.
-+--
  Reporter:  lukeplant   | Owner:  nobody
Status:  new | Milestone:
 Component:  GIS |   Version:  1.2   
Resolution:  |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Comment (by Alex):

 I believe you'd need to use
 "django.contrib.gis.db.backends.postgresql_psycopg2" to run the tests.

-- 
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-upda...@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] #14423: Wrong SQL on exclude with inheritance

2010-10-11 Thread Django
#14423: Wrong SQL on exclude with inheritance
---+
  Reporter:  PhiR_42   | Owner:  nobody 

Status:  new   | Milestone: 

 Component:  Database layer (models, ORM)  |   Version:  1.1

Resolution:|  Keywords:  orm 
exclude inheritance
 Stage:  Accepted  | Has_patch:  1  

Needs_docs:  0 |   Needs_tests:  1  

Needs_better_patch:  0 |  
---+
Changes (by Alex):

  * needs_tests:  0 => 1
  * stage:  Unreviewed => Accepted

Comment:

 FTR I'm almost positive this is a dupe.  In any event the change looks
 plausible, it needs a test 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-upda...@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] #13795: Add CACHE_KEY_PREFIX setting that prefixes the low-level cache API

2010-10-11 Thread Django
#13795: Add CACHE_KEY_PREFIX setting that prefixes the low-level cache API
---+
  Reporter:  bruth | Owner:  bruth
Status:  assigned  | Milestone:  1.3  
 Component:  Cache system  |   Version:  SVN  
Resolution:|  Keywords:   
 Stage:  Accepted  | Has_patch:  1
Needs_docs:  0 |   Needs_tests:  0
Needs_better_patch:  0 |  
---+
Comment (by bruth):

 I should clarify that I have not written the patch just yet. I wanted to
 get some quick feedback if people would find it useful, then I will write
 it.

-- 
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-upda...@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] #11154: Inconsistency with permissions for proxy models

2010-10-11 Thread Django
#11154: Inconsistency with permissions for proxy models
-+--
  Reporter:  etianen | Owner:  nobody
Status:  new | Milestone:  1.3   
 Component:  Authentication  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Accepted| Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Comment (by empty):

 Replying to [comment:12 DrMeers]:
 > Are you sure about that Malcolm? Proxy models could be quite useful for
 limiting permissions to a subset of objects.

 That's my general use case.

-- 
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-upda...@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] #13795: Add CACHE_KEY_PREFIX setting that prefixes the low-level cache API

2010-10-11 Thread Django
#13795: Add CACHE_KEY_PREFIX setting that prefixes the low-level cache API
---+
  Reporter:  bruth | Owner:  bruth
Status:  assigned  | Milestone:  1.3  
 Component:  Cache system  |   Version:  SVN  
Resolution:|  Keywords:   
 Stage:  Accepted  | Has_patch:  1
Needs_docs:  0 |   Needs_tests:  0
Needs_better_patch:  0 |  
---+
Changes (by bruth):

  * stage:  Ready for checkin => Accepted

Comment:

 I have an addition to the patch based on a suggestion from Jacob regarding
 cache versioning. I wrote a post yesterday on google groups, but it seems
 like it never got posted. I will reiterate here. Based on Eric Flo's
 http://github.com/ericflo/django-newcache cache backend, I think adding a
 CACHE_VERSION works well as a base setting, but more flexibility at
 runtime can be added by allowing for passing in a version keyword arg when
 getting/setting cache values:

 {{{
 cache.set('key', 'value', version=2)
 cache.get('key', version=1) # None
 }}}

 The default version will be CACHE_VERSION, but being able to pass a
 version during runtime could allow for more flexible cache versioning such
 as syncing versions of cache between multiple objects like a page and its
 components and cache invalidation, e.g. if the page's version is 2, and
 its components' version is 1, rebuild and cache.

 Thoughts?

-- 
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-upda...@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] r14144 - django/branches/releases/1.2.X/tests/regressiontests/mail

2010-10-11 Thread noreply
Author: jacob
Date: 2010-10-11 10:18:34 -0500 (Mon, 11 Oct 2010)
New Revision: 14144

Modified:
   django/branches/releases/1.2.X/tests/regressiontests/mail/tests.py
Log:
[1.2.X] Fixed #14440 - Converted mail doctests to unittests.

Thanks to Rob Hudson for the patch and also to andialbrecht who filed a
similar patch that I didn't use.

Backport of r14143 from trunk.

Modified: django/branches/releases/1.2.X/tests/regressiontests/mail/tests.py
===
--- django/branches/releases/1.2.X/tests/regressiontests/mail/tests.py  
2010-10-11 15:11:55 UTC (rev 14143)
+++ django/branches/releases/1.2.X/tests/regressiontests/mail/tests.py  
2010-10-11 15:18:34 UTC (rev 14144)
@@ -1,420 +1,318 @@
 # coding: utf-8
+import email
+import os
+import shutil
+import sys
+import tempfile
+from StringIO import StringIO
+from django.conf import settings
+from django.core import mail
+from django.core.mail import EmailMessage, mail_admins, mail_managers, 
EmailMultiAlternatives
+from django.core.mail import send_mail, send_mass_mail
+from django.core.mail.backends.base import BaseEmailBackend
+from django.core.mail.backends import console, dummy, locmem, filebased, smtp
+from django.core.mail.message import BadHeaderError
+from django.test import TestCase
+from django.utils.translation import ugettext_lazy
 
-r"""
-# Tests for the django.core.mail.
+class MailTests(TestCase):
 
->>> import os
->>> import shutil
->>> import tempfile
->>> from StringIO import StringIO
->>> from django.conf import settings
->>> from django.core import mail
->>> from django.core.mail import EmailMessage, mail_admins, mail_managers, 
EmailMultiAlternatives
->>> from django.core.mail import send_mail, send_mass_mail
->>> from django.core.mail.backends.base import BaseEmailBackend
->>> from django.core.mail.backends import console, dummy, locmem, filebased, 
smtp
->>> from django.utils.translation import ugettext_lazy
+def test_ascii(self):
+email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com'])
+message = email.message()
+self.assertEqual(message['Subject'].encode(), 'Subject')
+self.assertEqual(message.get_payload(), 'Content')
+self.assertEqual(message['From'], 'f...@example.com')
+self.assertEqual(message['To'], 't...@example.com')
 
-# Test normal ascii character case:
+def test_multiple_recipients(self):
+email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com','ot...@example.com'])
+message = email.message()
+self.assertEqual(message['Subject'].encode(), 'Subject')
+self.assertEqual(message.get_payload(), 'Content')
+self.assertEqual(message['From'], 'f...@example.com')
+self.assertEqual(message['To'], 't...@example.com, ot...@example.com')
 
->>> email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com'])
->>> message = email.message()
->>> message['Subject'].encode()
-'Subject'
->>> message.get_payload()
-'Content'
->>> message['From']
-'f...@example.com'
->>> message['To']
-'t...@example.com'
+def test_header_injection(self):
+email = EmailMessage('Subject\nInjection Test', 'Content', 
'f...@example.com', ['t...@example.com'])
+self.assertRaises(BadHeaderError, email.message)
+email = EmailMessage(ugettext_lazy('Subject\nInjection Test'), 
'Content', 'f...@example.com', ['t...@example.com'])
+self.assertRaises(BadHeaderError, email.message)
 
-# Test multiple-recipient case
+def test_space_continuation(self):
+"""
+Test for space continuation character in long (ascii) subject headers 
(#7747)
+"""
+email = EmailMessage('Long subject lines that get wrapped should use a 
space continuation character to get expected behaviour in Outlook and 
Thunderbird', 'Content', 'f...@example.com', ['t...@example.com'])
+message = email.message()
+self.assertEqual(message['Subject'], 'Long subject lines that get 
wrapped should use a space continuation\n character to get expected behaviour 
in Outlook and Thunderbird')
 
->>> email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com','ot...@example.com'])
->>> message = email.message()
->>> message['Subject'].encode()
-'Subject'
->>> message.get_payload()
-'Content'
->>> message['From']
-'f...@example.com'
->>> message['To']
-'t...@example.com, ot...@example.com'
+def test_message_header_overrides(self):
+"""
+Specifying dates or message-ids in the extra headers overrides the
+default values (#9233)
+"""
+headers = {"date": "Fri, 09 Nov 2001 01:08:47 -", "Message-ID": 
"foo"}
+email = EmailMessage('subject', 'content', 'f...@example.com', 
['t...@example.com'], headers=headers)
+self.assertEqual(email.message().as_string(), 'Content-Type: 
text/plain; charset="utf-8"\nMIME-Version: 

[Changeset] r14143 - django/trunk/tests/regressiontests/mail

2010-10-11 Thread noreply
Author: jacob
Date: 2010-10-11 10:11:55 -0500 (Mon, 11 Oct 2010)
New Revision: 14143

Modified:
   django/trunk/tests/regressiontests/mail/tests.py
Log:
Fixed #14440 - Converted mail doctests to unittests.

Thanks to Rob Hudson for the patch and also to andialbrecht who filed a
similar patch that I didn't use.

Modified: django/trunk/tests/regressiontests/mail/tests.py
===
--- django/trunk/tests/regressiontests/mail/tests.py2010-10-11 14:36:20 UTC 
(rev 14142)
+++ django/trunk/tests/regressiontests/mail/tests.py2010-10-11 15:11:55 UTC 
(rev 14143)
@@ -1,446 +1,345 @@
 # coding: utf-8
+import email
+import os
+import shutil
+import sys
+import tempfile
+from StringIO import StringIO
+from django.conf import settings
+from django.core import mail
+from django.core.mail import EmailMessage, mail_admins, mail_managers, 
EmailMultiAlternatives
+from django.core.mail import send_mail, send_mass_mail
+from django.core.mail.backends.base import BaseEmailBackend
+from django.core.mail.backends import console, dummy, locmem, filebased, smtp
+from django.core.mail.message import BadHeaderError
+from django.test import TestCase
+from django.utils.translation import ugettext_lazy
 
-r"""
-# Tests for the django.core.mail.
+class MailTests(TestCase):
 
->>> import os
->>> import shutil
->>> import tempfile
->>> from StringIO import StringIO
->>> from django.conf import settings
->>> from django.core import mail
->>> from django.core.mail import EmailMessage, mail_admins, mail_managers, 
EmailMultiAlternatives
->>> from django.core.mail import send_mail, send_mass_mail
->>> from django.core.mail.backends.base import BaseEmailBackend
->>> from django.core.mail.backends import console, dummy, locmem, filebased, 
smtp
->>> from django.utils.translation import ugettext_lazy
+def test_ascii(self):
+email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com'])
+message = email.message()
+self.assertEqual(message['Subject'].encode(), 'Subject')
+self.assertEqual(message.get_payload(), 'Content')
+self.assertEqual(message['From'], 'f...@example.com')
+self.assertEqual(message['To'], 't...@example.com')
 
-# Test normal ascii character case:
+def test_multiple_recipients(self):
+email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com','ot...@example.com'])
+message = email.message()
+self.assertEqual(message['Subject'].encode(), 'Subject')
+self.assertEqual(message.get_payload(), 'Content')
+self.assertEqual(message['From'], 'f...@example.com')
+self.assertEqual(message['To'], 't...@example.com, ot...@example.com')
 
->>> email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com'])
->>> message = email.message()
->>> message['Subject'].encode()
-'Subject'
->>> message.get_payload()
-'Content'
->>> message['From']
-'f...@example.com'
->>> message['To']
-'t...@example.com'
+def test_cc(self):
+"""Regression test for #7722"""
+email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com'], cc=['c...@example.com'])
+message = email.message()
+self.assertEqual(message['Cc'], 'c...@example.com')
+self.assertEqual(email.recipients(), ['t...@example.com', 
'c...@example.com'])
 
-# Test multiple-recipient case
+# Verify headers
+old_stdout = sys.stdout
+sys.stdout = StringIO()
+connection = console.EmailBackend()
+connection.send_messages([email])
+self.assertTrue(sys.stdout.getvalue().startswith('Content-Type: 
text/plain; charset="utf-8"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 
quoted-printable\nSubject: Subject\nFrom: f...@example.com\nto: 
t...@example.com\ncc: c...@example.com\ndate: '))
+sys.stdout = old_stdout
 
->>> email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com','ot...@example.com'])
->>> message = email.message()
->>> message['Subject'].encode()
-'Subject'
->>> message.get_payload()
-'Content'
->>> message['From']
-'f...@example.com'
->>> message['To']
-'t...@example.com, ot...@example.com'
+# Test multiple CC with multiple To
+email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com', 'ot...@example.com'], cc=['c...@example.com', 
'cc.ot...@example.com'])
+message = email.message()
+self.assertEqual(message['Cc'], 'c...@example.com, 
cc.ot...@example.com')
+self.assertEqual(email.recipients(), ['t...@example.com', 
'ot...@example.com', 'c...@example.com', 'cc.ot...@example.com'])
 
-# Test for header injection
+# Testing with Bcc
+email = EmailMessage('Subject', 'Content', 'f...@example.com', 
['t...@example.com', 'ot...@example.com'], cc=['c...@example.com', 
'cc.ot...@example.com'], bcc=['b...@example.com'])
+message = 

Re: [Django] #13795: Add CACHE_KEY_PREFIX setting that prefixes the low-level cache API

2010-10-11 Thread Django
#13795: Add CACHE_KEY_PREFIX setting that prefixes the low-level cache API
+---
  Reporter:  bruth  | Owner:  bruth
Status:  assigned   | Milestone:  1.3  
 Component:  Cache system   |   Version:  SVN  
Resolution: |  Keywords:   
 Stage:  Ready for checkin  | Has_patch:  1
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Changes (by agabel):

  * stage:  Accepted => Ready for checkin

Comment:

 Unless someone is working on a better patch or sees a problem with mine,
 I'd say this one is ready for checkin.

-- 
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-upda...@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] #14441: Oracle list limit exceeded with __in filters

2010-10-11 Thread Django
#14441: Oracle list limit exceeded with __in filters
---+
  Reporter:  DavidMAM  | Owner:  nobody
Status:  new   | Milestone:
 Component:  Database layer (models, ORM)  |   Version:  1.1   
Resolution:|  Keywords:  Oracle
 Stage:  Design decision needed| Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Changes (by lukeplant):

  * stage:  Unreviewed => Design decision needed

Comment:

 It doesn't sound like batching of the querysets is what you need to do -
 rather it is batching in the construction of the SQL expression.

 It sounds like you need to do:
 {{{
 #!python

 mylist = MyObject.objects.filter(Q(namefield__in=namelist_1) |
 Q(namefield__in=namelist_2))
 }}}

 where you have limited `namelist_1` to less than 1000 items, and put the
 rest into `namelist_2` - and then obviously extend this to the general
 case (untested):
 {{{
 #!python

 import operator
 # split namelist into chunks:
 namelists = [namelist[i:i+1000] for i in xrange(0, len(namelist), 1000)]
 if len(namelists) > 0:
 q = reduce(operator.or_, [Q(namefield__in=l) for l in namelists])
 mylist = MyObject.objects.filter(q)
 ...
 }}}

 I can't decide whether we just have to accept this as a limitation of
 Oracle, or whether we should work around it by including the above logic
 into the Oracle backend. Is there precedent for working around this kind
 of limitation in the SQL that backends accept?

-- 
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-upda...@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] r14142 - in django/branches/releases/1.2.X/django/contrib: gis/sitemaps sitemaps sitemaps/tests

2010-10-11 Thread noreply
Author: lukeplant
Date: 2010-10-11 09:36:20 -0500 (Mon, 11 Oct 2010)
New Revision: 14142

Modified:
   django/branches/releases/1.2.X/django/contrib/gis/sitemaps/georss.py
   django/branches/releases/1.2.X/django/contrib/gis/sitemaps/kml.py
   django/branches/releases/1.2.X/django/contrib/gis/sitemaps/views.py
   django/branches/releases/1.2.X/django/contrib/sitemaps/__init__.py
   django/branches/releases/1.2.X/django/contrib/sitemaps/tests/basic.py
   django/branches/releases/1.2.X/django/contrib/sitemaps/views.py
Log:
[1.2.X] Fixed #14433 - replaced a thread-unsafe solution to #10235 introduced 
in [13980]

This patch also addresses sitemap code found in contrib/gis, which [13980]
did not.

Thanks to gabrielhurley for the initial patch.

Refs #10235, #14386

Backport of [14141] from trunk.

Modified: django/branches/releases/1.2.X/django/contrib/gis/sitemaps/georss.py
===
--- django/branches/releases/1.2.X/django/contrib/gis/sitemaps/georss.py
2010-10-11 14:34:42 UTC (rev 14141)
+++ django/branches/releases/1.2.X/django/contrib/gis/sitemaps/georss.py
2010-10-11 14:36:20 UTC (rev 14142)
@@ -36,12 +36,12 @@
 else:
 self.locations.append(section)
  
-def get_urls(self, page=1):
+def get_urls(self, page=1, site=None):
 """
 This method is overrridden so the appropriate `geo_format` attribute
 is placed on each URL element.
 """
-urls = Sitemap.get_urls(self, page=page)
+urls = Sitemap.get_urls(self, page=page, site=site)
 for url in urls: url['geo_format'] = 'georss'
 return urls
 

Modified: django/branches/releases/1.2.X/django/contrib/gis/sitemaps/kml.py
===
--- django/branches/releases/1.2.X/django/contrib/gis/sitemaps/kml.py   
2010-10-11 14:34:42 UTC (rev 14141)
+++ django/branches/releases/1.2.X/django/contrib/gis/sitemaps/kml.py   
2010-10-11 14:36:20 UTC (rev 14142)
@@ -40,12 +40,12 @@
 raise TypeError('KML Sources must be a model or a 3-tuple.')
 return kml_sources
 
-def get_urls(self, page=1):
+def get_urls(self, page=1, site=None):
 """
 This method is overrridden so the appropriate `geo_format` attribute
 is placed on each URL element.
 """
-urls = Sitemap.get_urls(self, page=page)
+urls = Sitemap.get_urls(self, page=page, site=site)
 for url in urls: url['geo_format'] = self.geo_format
 return urls
 

Modified: django/branches/releases/1.2.X/django/contrib/gis/sitemaps/views.py
===
--- django/branches/releases/1.2.X/django/contrib/gis/sitemaps/views.py 
2010-10-11 14:34:42 UTC (rev 14141)
+++ django/branches/releases/1.2.X/django/contrib/gis/sitemaps/views.py 
2010-10-11 14:36:20 UTC (rev 14142)
@@ -46,12 +46,13 @@
 maps = sitemaps.values()
 
 page = request.GET.get("p", 1)
+current_site = get_current_site(request)
 for site in maps:
 try:
 if callable(site):
-urls.extend(site().get_urls(page))
+urls.extend(site().get_urls(page=page, site=current_site))
 else:
-urls.extend(site.get_urls(page))
+urls.extend(site.get_urls(page=page, site=current_site))
 except EmptyPage:
 raise Http404("Page %s empty" % page)
 except PageNotAnInteger:

Modified: django/branches/releases/1.2.X/django/contrib/sitemaps/__init__.py
===
--- django/branches/releases/1.2.X/django/contrib/sitemaps/__init__.py  
2010-10-11 14:34:42 UTC (rev 14141)
+++ django/branches/releases/1.2.X/django/contrib/sitemaps/__init__.py  
2010-10-11 14:36:20 UTC (rev 14142)
@@ -1,5 +1,6 @@
-from django.contrib.sites.models import get_current_site
+from django.contrib.sites.models import Site, get_current_site
 from django.core import urlresolvers, paginator
+from django.core.exceptions import ImproperlyConfigured
 import urllib
 
 PING_URL = "http://www.google.com/webmasters/tools/ping;
@@ -60,11 +61,19 @@
 return self._paginator
 paginator = property(_get_paginator)
 
-def get_urls(self, page=1):
-current_site = get_current_site(self.request)
+def get_urls(self, page=1, site=None):
+if site is None:
+if Site._meta.installed:
+try:
+site = Site.objects.get_current()
+except Site.DoesNotExist:
+pass
+if site is None:
+raise ImproperlyConfigured("In order to use Sitemaps you must 
either use the sites framework or pass in a Site or RequestSite object in your 
view code.")
+
 urls = []
 for item in self.paginator.page(page).object_list:
-loc = "http://%s%s; % 

Re: [Django] #14438: Deserializer raises ValidationError if natural key is given as string

2010-10-11 Thread Django
#14438: Deserializer raises ValidationError if natural key is given as string
+---
  Reporter:  zimnyx | Owner:  nobody
Status:  new| Milestone:
 Component:  Serialization  |   Version:  SVN   
Resolution: |  Keywords:
 Stage:  Unreviewed | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by zimnyx):

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

Comment:

 and in case of m2m relation, in yaml you have to use:
 {{{
 colors: [[red], [green], [blue]]
 }}}

 because:
 {{{
 colors: [red, green, blue]
 }}}
 will also fail with similar ValidationError.

-- 
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-upda...@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] r14141 - in django/trunk/django/contrib: gis/sitemaps sitemaps sitemaps/tests

2010-10-11 Thread noreply
Author: lukeplant
Date: 2010-10-11 09:34:42 -0500 (Mon, 11 Oct 2010)
New Revision: 14141

Modified:
   django/trunk/django/contrib/gis/sitemaps/georss.py
   django/trunk/django/contrib/gis/sitemaps/kml.py
   django/trunk/django/contrib/gis/sitemaps/views.py
   django/trunk/django/contrib/sitemaps/__init__.py
   django/trunk/django/contrib/sitemaps/tests/basic.py
   django/trunk/django/contrib/sitemaps/views.py
Log:
Fixed #14433 - replaced a thread-unsafe solution to #10235 introduced in [13980]

This patch also addresses sitemap code found in contrib/gis, which [13980]
did not.

Thanks to gabrielhurley for the initial patch.

Refs #10235, #14386

Modified: django/trunk/django/contrib/gis/sitemaps/georss.py
===
--- django/trunk/django/contrib/gis/sitemaps/georss.py  2010-10-11 13:18:00 UTC 
(rev 14140)
+++ django/trunk/django/contrib/gis/sitemaps/georss.py  2010-10-11 14:34:42 UTC 
(rev 14141)
@@ -36,12 +36,12 @@
 else:
 self.locations.append(section)
  
-def get_urls(self, page=1):
+def get_urls(self, page=1, site=None):
 """
 This method is overrridden so the appropriate `geo_format` attribute
 is placed on each URL element.
 """
-urls = Sitemap.get_urls(self, page=page)
+urls = Sitemap.get_urls(self, page=page, site=site)
 for url in urls: url['geo_format'] = 'georss'
 return urls
 

Modified: django/trunk/django/contrib/gis/sitemaps/kml.py
===
--- django/trunk/django/contrib/gis/sitemaps/kml.py 2010-10-11 13:18:00 UTC 
(rev 14140)
+++ django/trunk/django/contrib/gis/sitemaps/kml.py 2010-10-11 14:34:42 UTC 
(rev 14141)
@@ -40,12 +40,12 @@
 raise TypeError('KML Sources must be a model or a 3-tuple.')
 return kml_sources
 
-def get_urls(self, page=1):
+def get_urls(self, page=1, site=None):
 """
 This method is overrridden so the appropriate `geo_format` attribute
 is placed on each URL element.
 """
-urls = Sitemap.get_urls(self, page=page)
+urls = Sitemap.get_urls(self, page=page, site=site)
 for url in urls: url['geo_format'] = self.geo_format
 return urls
 

Modified: django/trunk/django/contrib/gis/sitemaps/views.py
===
--- django/trunk/django/contrib/gis/sitemaps/views.py   2010-10-11 13:18:00 UTC 
(rev 14140)
+++ django/trunk/django/contrib/gis/sitemaps/views.py   2010-10-11 14:34:42 UTC 
(rev 14141)
@@ -46,12 +46,13 @@
 maps = sitemaps.values()
 
 page = request.GET.get("p", 1)
+current_site = get_current_site(request)
 for site in maps:
 try:
 if callable(site):
-urls.extend(site().get_urls(page))
+urls.extend(site().get_urls(page=page, site=current_site))
 else:
-urls.extend(site.get_urls(page))
+urls.extend(site.get_urls(page=page, site=current_site))
 except EmptyPage:
 raise Http404("Page %s empty" % page)
 except PageNotAnInteger:

Modified: django/trunk/django/contrib/sitemaps/__init__.py
===
--- django/trunk/django/contrib/sitemaps/__init__.py2010-10-11 13:18:00 UTC 
(rev 14140)
+++ django/trunk/django/contrib/sitemaps/__init__.py2010-10-11 14:34:42 UTC 
(rev 14141)
@@ -1,5 +1,6 @@
-from django.contrib.sites.models import get_current_site
+from django.contrib.sites.models import Site, get_current_site
 from django.core import urlresolvers, paginator
+from django.core.exceptions import ImproperlyConfigured
 import urllib
 
 PING_URL = "http://www.google.com/webmasters/tools/ping;
@@ -60,11 +61,19 @@
 return self._paginator
 paginator = property(_get_paginator)
 
-def get_urls(self, page=1):
-current_site = get_current_site(self.request)
+def get_urls(self, page=1, site=None):
+if site is None:
+if Site._meta.installed:
+try:
+site = Site.objects.get_current()
+except Site.DoesNotExist:
+pass
+if site is None:
+raise ImproperlyConfigured("In order to use Sitemaps you must 
either use the sites framework or pass in a Site or RequestSite object in your 
view code.")
+
 urls = []
 for item in self.paginator.page(page).object_list:
-loc = "http://%s%s; % (current_site.domain, self.__get('location', 
item))
+loc = "http://%s%s; % (site.domain, self.__get('location', item))
 priority = self.__get('priority', item, None)
 url_info = {
 'location':   loc,
@@ -77,11 +86,8 @@
 
 class FlatPageSitemap(Sitemap):
 def items(self):
-current_site = 

Re: [Django] #14433: Thread safety problem in contrib.sitemaps

2010-10-11 Thread Django
#14433: Thread safety problem in contrib.sitemaps
+---
  Reporter:  gabrielhurley  | Owner:  gabrielhurley
Status:  assigned   | Milestone:  1.3  
 Component:  Contrib apps   |   Version:  1.2  
Resolution: |  Keywords:   
 Stage:  Unreviewed | Has_patch:  1
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Comment (by lukeplant):

 Thanks Gabriel. I will commit with changes:

  * added tests for raising !ImproperlyConfigured (and then added an import
 and some other logic that made the tests pass - hurray for TDD :-)
  * used keyword arguments in to Sitemap.get_urls() instead of positional,
 in django/contrib/sitemaps/views.py and
 django/contrib/gis/sitemaps/views.py

 I am unable to run the GIS testsuite (see #14439), so I have not checked
 that the GIS sections are correct, but they look correct are (hopefully)
 trivial.

-- 
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-upda...@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] #14439: Running the GIS testsuite is very hard.

2010-10-11 Thread Django
#14439: Running the GIS testsuite is very hard.
-+--
  Reporter:  lukeplant   | Owner:  nobody
Status:  new | Milestone:
 Component:  GIS |   Version:  1.2   
Resolution:  |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Old description:

> Starting small, I'm attempting to use Spatialite to run the GIS testsuite
> (or at least the relevant parts), just because I need to run the GIS
> tests as a core developer.
>
> First, the docs for this are very sketchy - the only thing I can find is
> this:
> {{{
> To run GeoDjango's own internal test suite, configure the TEST_RUNNER
> setting as follows:
>
>   TEST_RUNNER='django.contrib.gis.tests.run_gis_tests'
> }}}
>
> Doing this in the obvious place (runtests.py), produces this:
>
> {{{
> Traceback (most recent call last):
>   File "./runtests.py", line 314, in 
> failures = django_tests(int(options.verbosity), options.interactive,
> options.failfast, args)
>   File "./runtests.py", line 180, in django_tests
> extra_tests=extra_tests)
>   File
> "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py",
> line 19, in run_gis_tests
> return test_runner.run_tests(test_labels, extra_tests=extra_tests)
>   File "/home/luke/devel/django/trunk/django/test/simple.py", line 311,
> in run_tests
> self.setup_test_environment()
>   File
> "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py",
> line 37, in setup_test_environment
> if connection.ops.postgis and connection.ops.geography:
> AttributeError: 'DatabaseOperations' object has no attribute 'postgis'
> }}}
> Also #10420 about this.
>
> Using a test project and `./manage.py test` instead, I get the following:
> {{{
>
> Traceback (most recent call last):
>   File "./manage.py", line 11, in 
> execute_manager(settings)
>   File
> "/home/luke/devel/django/trunk/django/core/management/__init__.py", line
> 438, in execute_manager
> utility.execute()
>   File
> "/home/luke/devel/django/trunk/django/core/management/__init__.py", line
> 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/home/luke/devel/django/trunk/django/core/management/base.py",
> line 191, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File "/home/luke/devel/django/trunk/django/core/management/base.py",
> line 220, in execute
> output = self.handle(*args, **options)
>   File
> "/home/luke/devel/django/trunk/django/core/management/commands/test.py",
> line 34, in handle
> failures = TestRunner(test_labels, verbosity=verbosity,
> interactive=interactive)
>   File
> "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py",
> line 19, in run_gis_tests
> return test_runner.run_tests(test_labels, extra_tests=extra_tests)
>   File "/home/luke/devel/django/trunk/django/test/simple.py", line 311,
> in run_tests
> self.setup_test_environment()
>   File
> "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py",
> line 37, in setup_test_environment
> if connection.ops.postgis and connection.ops.geography:
> AttributeError: 'DatabaseOperations' object has no attribute 'postgis'
> }}}
>
> I do have `init_spatialite-2.3.sql` in the working directory, not sure if
> that is needed.

New description:

 Starting small, I'm attempting to use Spatialite to run the GIS testsuite
 (or at least the relevant parts), just because I need to run the GIS tests
 as a core developer.

 First, the docs for this are very sketchy - the only thing I can find is
 this:
 {{{
 To run GeoDjango's own internal test suite, configure the TEST_RUNNER
 setting as follows:

   TEST_RUNNER='django.contrib.gis.tests.run_gis_tests'
 }}}

 Doing this in the obvious place i.e. a settings file and using
 runtests.py, produces this:

 {{{
 Traceback (most recent call last):
   File "./runtests.py", line 314, in 
 failures = django_tests(int(options.verbosity), options.interactive,
 options.failfast, args)
   File "./runtests.py", line 180, in django_tests
 extra_tests=extra_tests)
   File
 "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py", line
 19, in run_gis_tests
 return test_runner.run_tests(test_labels, extra_tests=extra_tests)
   File "/home/luke/devel/django/trunk/django/test/simple.py", line 311, in
 run_tests
 self.setup_test_environment()
   File
 "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py", line
 37, in setup_test_environment
 if connection.ops.postgis and connection.ops.geography:
 AttributeError: 'DatabaseOperations' object has no attribute 'postgis'
 }}}
 Also #10420 about this.

 Using a test project and `./manage.py 

[Django] #14441: Oracle list limit exceeded with __in filters

2010-10-11 Thread Django
#14441: Oracle list limit exceeded with __in filters
+---
   Reporter:  DavidMAM  |Owner:  nobody
 Status:  new   |Milestone:
  Component:  Database layer (models, ORM)  |  Version:  1.1   
   Keywords:  Oracle|Stage:  Unreviewed
  Has_patch:  0 |   Needs_docs:  0 
Needs_tests:  0 |   Needs_better_patch:  0 
+---
 Trying to retrieve a set of objects based on field values. I build the set
 of values as an array

 namelist=[]

 .. some code that does namelist.append(name) many times

 obl=MyObject.objects.filter(namefield__in=namelist)

 obl.count()
 if namelist is longer than 1000 then Oracle throws an error
 Traceback (most recent call last):
   File "", line 1, in 
   File "/usr/local/lib/python2.6/site-packages/django/db/models/query.py",
 line 292, in count
 return self.query.get_count()
   File "/usr/local/lib/python2.6/site-
 packages/django/db/models/sql/query.py", line 376, in get_count
 number = obj.get_aggregation()[None]
   File "/usr/local/lib/python2.6/site-
 packages/django/db/models/sql/query.py", line 348, in get_aggregation
 result = query.execute_sql(SINGLE)
   File "/usr/local/lib/python2.6/site-
 packages/django/db/models/sql/query.py", line 2369, in execute_sql
 cursor.execute(sql, params)
   File "/usr/local/lib/python2.6/site-
 packages/django/db/backends/util.py", line 19, in execute
 return self.cursor.execute(sql, params)
   File "/usr/local/lib/python2.6/site-
 packages/django/db/backends/oracle/base.py", line 443, in execute
 raise e
 DatabaseError: ORA-01795: maximum number of expressions in a list is 1000

 I don't know if there is an easy way to combine querysets as splitting
 them into batches of a suitable number would be no problem if they could
 be combined later.

-- 
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-upda...@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] #7539: Add ON DELETE and ON UPDATE support to Django

2010-10-11 Thread Django
#7539: Add ON DELETE and ON UPDATE support to Django
---+
  Reporter:  glassfordm| Owner: 
Status:  new   | Milestone: 
 Component:  Database layer (models, ORM)  |   Version:  SVN
Resolution:|  Keywords:  feature
 Stage:  Design decision needed| Has_patch:  1  
Needs_docs:  1 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by lsaffre):

 * cc: luc.saf...@gmail.com (added)

Comment:

 I tried to apply the patch to revision 14140, but there were quite some
 failures. Is it asked much to post a new patch against the latest version?
 Here are the error messages I got:

 {{{
 L:\snapshots\django>patch -p0 < 7539.on_delete.r12380.diff
 patching file tests/modeltests/invalid_models/models.py
 Hunk #1 FAILED at 181.
 Hunk #2 FAILED at 285.
 2 out of 2 hunks FAILED -- saving rejects to file
 tests/modeltests/invalid_models/models.py.rej
 patching file tests/modeltests/delete/models.py
 Hunk #1 FAILED at 44.
 Hunk #2 FAILED at 79.
 Hunk #3 FAILED at 93.
 Hunk #4 FAILED at 107.
 Hunk #5 FAILED at 128.
 5 out of 5 hunks FAILED -- saving rejects to file
 tests/modeltests/delete/models.py.rej
 patching file tests/modeltests/on_delete/__init__.py
 patching file tests/modeltests/on_delete/models.py
 patching file django/db/models/sql/subqueries.py
 Hunk #1 FAILED at 26.
 Hunk #2 succeeded at 45 (offset -43 lines).
 1 out of 2 hunks FAILED -- saving rejects to file
 django/db/models/sql/subqueries.py.rej
 patching file django/db/models/base.py
 Hunk #1 FAILED at 7.
 Hunk #2 FAILED at 536.
 2 out of 2 hunks FAILED -- saving rejects to file
 django/db/models/base.py.rej
 patching file django/db/models/options.py
 Hunk #1 succeeded at 370 (offset -6 lines).
 patching file django/db/models/fields/related.py
 Hunk #2 succeeded at 734 (offset 46 lines).
 Hunk #3 succeeded at 744 (offset 46 lines).
 Hunk #4 succeeded at 764 (offset 46 lines).
 Hunk #5 succeeded at 820 with fuzz 1 (offset 49 lines).
 patching file django/db/models/__init__.py
 patching file django/db/models/deletion.py
 patching file django/db/models/query.py
 }}}

-- 
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-upda...@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] #14439: Running the GIS testsuite is very hard.

2010-10-11 Thread Django
#14439: Running the GIS testsuite is very hard.
-+--
  Reporter:  lukeplant   | Owner:  nobody
Status:  new | Milestone:
 Component:  GIS |   Version:  1.2   
Resolution:  |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by lukeplant):

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

Comment:

 I've tried installing PostGIS, and using the 'postgresql_psycopg2'
 backend, but having the same problem.

-- 
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-upda...@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] #12484: Document that cmemcache is definetly not thread safe

2010-10-11 Thread Django
#12484: Document that cmemcache is definetly not thread safe
+---
  Reporter:  anonymous  | Owner:  nobody   
Status:  closed | Milestone:   
 Component:  Documentation  |   Version:  1.1  
Resolution:  wontfix|  Keywords:  cmemcache
 Stage:  Accepted   | Has_patch:  0
Needs_docs:  0  |   Needs_tests:  0
Needs_better_patch:  0  |  
+---
Changes (by timo):

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

Comment:

 Since support for cmemcache was deprecated in 1.2 due to a lack of
 maintenance on the cmemcache library itself, probably not worth fixing.

-- 
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-upda...@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] #6548: django behind apache ssl proxy

2010-10-11 Thread Django
#6548: django behind apache ssl proxy
-+--
  Reporter:  laureline.gue...@makina-corpus.org  | Owner:  
nobody
Status:  new | Milestone:   
 
 Component:  HTTP handling   |   Version:  SVN  
 
Resolution:  |  Keywords:   
 
 Stage:  Design decision needed  | Has_patch:  0
 
Needs_docs:  0   |   Needs_tests:  0
 
Needs_better_patch:  0   |  
-+--
Comment (by gisle):

 I had the same issue here and worked around it by adding one more
 ProxyPassReverse line to my Apache configuration.  Something like this:

 {{{
 
ServerName foo.example.com
ProxyPass / http://localhost:8082/
ProxyPassReverse / http://localhost:8082/
ProxyPassReverse / http://foo.example.com/
Include ssl-sert
 
 }}}

-- 
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-upda...@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] r14140 - in django/trunk/docs: internals topics

2010-10-11 Thread noreply
Author: russellm
Date: 2010-10-11 08:18:00 -0500 (Mon, 11 Oct 2010)
New Revision: 14140

Modified:
   django/trunk/docs/internals/deprecation.txt
   django/trunk/docs/topics/testing.txt
Log:
Refs #12991 -- Added extra docs for the unittest2 changes made in r14139.

Modified: django/trunk/docs/internals/deprecation.txt
===
--- django/trunk/docs/internals/deprecation.txt 2010-10-11 12:55:17 UTC (rev 
14139)
+++ django/trunk/docs/internals/deprecation.txt 2010-10-11 13:18:00 UTC (rev 
14140)
@@ -108,6 +108,12 @@
   :attr:`~django.test.client.Response.templates` attribute should be
   used instead.
 
+* The features of the :class:`django.test.simple.DjangoTestRunner`
+  (including fail-fast and Ctrl-C test termination) can now be provided
+  by the unittest-native :class:`TextTestRunner`. The
+  :class:`~django.test.simple.DjangoTestRunner` will be removed in
+  favor of using the unittest-native class.
+
 * 2.0
 * ``django.views.defaults.shortcut()``. This function has been moved
   to ``django.contrib.contenttypes.views.shortcut()`` as part of the

Modified: django/trunk/docs/topics/testing.txt
===
--- django/trunk/docs/topics/testing.txt2010-10-11 12:55:17 UTC (rev 
14139)
+++ django/trunk/docs/topics/testing.txt2010-10-11 13:18:00 UTC (rev 
14140)
@@ -1431,6 +1431,61 @@
 # Empty the test outbox
 mail.outbox = []
 
+Skipping tests
+--
+
+.. versionadded:: 1.3
+
+The unittest library provides the `...@skipif`` and `...@skipunless``
+decorators to allow you to skip tests if you know ahead of time that
+those tests are going to fail under certain conditions.
+
+For example, if your test requires a particular optional library in
+order to succeed, you could decorate the test case with `...@skipif``.
+Then, the test runner will report that the test wasn't executed and
+why, instead of failing the test or omitting the test altogether.
+
+To supplement these test skipping behaviors, Django provides two
+additional skip decorators. Instead of testing a generic boolean,
+these decorators check the capabilities of the database, and skip the
+test if the database doesn't support a specific named feature.
+
+The decorators use a string identifier to describe database features.
+This string corresponds to attributes of the database connection
+features class. See :class:`~django.db.backends.BaseDatabaseFeatures`
+class for a full list of database features that can be used as a basis
+for skipping tests.
+
+skipIfDBFeature
+~~~
+
+Skip the decorated test if the named database feature is supported.
+
+For example, the following test will not be executed if the database
+supports transactions (e.g., it would *not* run under PostgreSQL, but
+it would under MySQL with MyISAM tables)::
+
+class MyTests(TestCase):
+@skipIfDBFeature('supports_transactions')
+def test_transaction_behavior(self):
+# ... conditional test code
+
+skipUnlessDBFeature
+~~~
+
+Skip the decorated test if the named database feature is *not*
+supported.
+
+For example, the following test will not be executed if the database
+supports transactions (e.g., it would run under PostgreSQL, but *not*
+under MySQL with MyISAM tables)::
+
+class MyTests(TestCase):
+@skipUnlessDBFeature('supports_transactions')
+def test_transaction_behavior(self):
+# ... conditional test code
+
+
 Using different testing frameworks
 ==
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@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] #14440: Conversion of mail tests from doctest to unittests

2010-10-11 Thread Django
#14440: Conversion of mail tests from doctest to unittests
---+
 Reporter:  andialbrecht   |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Testing framework  | Version:  1.2   
 Keywords: |   Stage:  Unreviewed
Has_patch:  1  |  
---+
 The test suite for django.core.mail is currently in doctest format. It
 should be in unittest format.

-- 
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-upda...@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] #14439: Running the GIS testsuite is very hard.

2010-10-11 Thread Django
#14439: Running the GIS testsuite is very hard.
---+
 Reporter:  lukeplant  |   Owner:  nobody
   Status:  new|   Milestone:
Component:  GIS| Version:  1.2   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Starting small, I'm attempting to use Spatialite to run the GIS testsuite
 (or at least the relevant parts), just because I need to run the GIS tests
 as a core developer.

 First, the docs for this are very sketchy - the only thing I can find is
 this:
 {{{
 To run GeoDjango's own internal test suite, configure the TEST_RUNNER
 setting as follows:

   TEST_RUNNER='django.contrib.gis.tests.run_gis_tests'
 }}}

 Doing this in the obvious place (runtests.py), produces this:

 {{{
 Traceback (most recent call last):
   File "./runtests.py", line 314, in 
 failures = django_tests(int(options.verbosity), options.interactive,
 options.failfast, args)
   File "./runtests.py", line 180, in django_tests
 extra_tests=extra_tests)
   File
 "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py", line
 19, in run_gis_tests
 return test_runner.run_tests(test_labels, extra_tests=extra_tests)
   File "/home/luke/devel/django/trunk/django/test/simple.py", line 311, in
 run_tests
 self.setup_test_environment()
   File
 "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py", line
 37, in setup_test_environment
 if connection.ops.postgis and connection.ops.geography:
 AttributeError: 'DatabaseOperations' object has no attribute 'postgis'
 }}}
 Also #10420 about this.

 Using a test project and `./manage.py test` instead, I get the following:
 {{{

 Traceback (most recent call last):
   File "./manage.py", line 11, in 
 execute_manager(settings)
   File "/home/luke/devel/django/trunk/django/core/management/__init__.py",
 line 438, in execute_manager
 utility.execute()
   File "/home/luke/devel/django/trunk/django/core/management/__init__.py",
 line 379, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/luke/devel/django/trunk/django/core/management/base.py",
 line 191, in run_from_argv
 self.execute(*args, **options.__dict__)
   File "/home/luke/devel/django/trunk/django/core/management/base.py",
 line 220, in execute
 output = self.handle(*args, **options)
   File
 "/home/luke/devel/django/trunk/django/core/management/commands/test.py",
 line 34, in handle
 failures = TestRunner(test_labels, verbosity=verbosity,
 interactive=interactive)
   File
 "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py", line
 19, in run_gis_tests
 return test_runner.run_tests(test_labels, extra_tests=extra_tests)
   File "/home/luke/devel/django/trunk/django/test/simple.py", line 311, in
 run_tests
 self.setup_test_environment()
   File
 "/home/luke/devel/django/trunk/django/contrib/gis/tests/__init__.py", line
 37, in setup_test_environment
 if connection.ops.postgis and connection.ops.geography:
 AttributeError: 'DatabaseOperations' object has no attribute 'postgis'
 }}}

 I do have `init_spatialite-2.3.sql` in the working directory, not sure if
 that is needed.

-- 
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-upda...@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.



  1   2   >