Skip to content

Commit 3de5792

Browse files
committed
[gsoc2009-testing] Massive merge update to trunk. This is to prep for upload
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/test-improvements@11480 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2 parents e2d14c0 + bb9cc01 commit 3de5792

File tree

19 files changed

+336
-28
lines changed

19 files changed

+336
-28
lines changed

django/contrib/admin/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ def get_action_choices(self, request, default_choices=BLANK_CHOICE_DASH):
482482

483483
def get_action(self, action):
484484
"""
485-
Return a given action from a parameter, which can either be a calable,
485+
Return a given action from a parameter, which can either be a callable,
486486
or the name of a method on the ModelAdmin. Return is a tuple of
487487
(callable, name, description).
488488
"""

django/contrib/admin/templates/admin/delete_selected_confirmation.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{% endfor %}
2020
</ul>
2121
{% else %}
22-
<p>{% blocktrans %}Are you sure you want to delete the selected {{ object_name }} objects? All of the following objects and it's related items will be deleted:{% endblocktrans %}</p>
22+
<p>{% blocktrans %}Are you sure you want to delete the selected {{ object_name }} objects? All of the following objects and their related items will be deleted:{% endblocktrans %}</p>
2323
{% for deleteable_object in deletable_objects %}
2424
<ul>{{ deleteable_object|unordered_list }}</ul>
2525
{% endfor %}
@@ -34,4 +34,4 @@
3434
</div>
3535
</form>
3636
{% endif %}
37-
{% endblock %}
37+
{% endblock %}

django/contrib/gis/management/commands/inspectdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def handle_inspection(self):
131131
if srid != 4326: extra_params['srid'] = srid
132132
else:
133133
try:
134-
field_type = connection.introspection.data_types_reverse[row[1]]
134+
field_type = connection.introspection.get_field_type(row[1], row)
135135
except KeyError:
136136
field_type = 'TextField'
137137
comment_notes.append('This field type is a guess.')

django/core/management/commands/inspectdb.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ def handle_noargs(self, **options):
1515
def handle_inspection(self):
1616
from django.db import connection
1717
import keyword
18-
19-
table2model = lambda table_name: table_name.title().replace('_', '').replace(' ', '').replace('-', '')
18+
19+
table2model = lambda table_name: table_name.title()
20+
.replace('_', '').replace(' ', '').replace('-', '').replace('*','_').replace(',','_')
2021

2122
cursor = connection.cursor()
2223
yield "# This is an auto-generated Django model module."
@@ -73,7 +74,7 @@ def handle_inspection(self):
7374
extra_params['db_column'] = column_name
7475
else:
7576
try:
76-
field_type = connection.introspection.data_types_reverse[row[1]]
77+
field_type = connection.introspection.get_field_type(row[1], row)
7778
except KeyError:
7879
field_type = 'TextField'
7980
comment_notes.append('This field type is a guess.')

django/db/backends/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,14 @@ class BaseDatabaseIntrospection(object):
470470
def __init__(self, connection):
471471
self.connection = connection
472472

473+
def get_field_type(self, data_type, description):
474+
"""Hook for a database backend to use the cursor description to
475+
match a Django field type to a database column.
476+
477+
For Oracle, the column data_type on its own is insufficient to
478+
distinguish between a FloatField and IntegerField, for example."""
479+
return self.data_types_reverse[data_type]
480+
473481
def table_name_converter(self, name):
474482
"""Apply a conversion to the name for the purposes of comparison.
475483
@@ -560,4 +568,3 @@ class BaseDatabaseValidation(object):
560568
def validate_field(self, errors, opts, f):
561569
"By default, there is no backend-specific validation"
562570
pass
563-

django/db/backends/oracle/base.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
IntegrityError = Database.IntegrityError
3737

3838

39+
# Check whether cx_Oracle was compiled with the WITH_UNICODE option. This will
40+
# also be True in Python 3.0.
41+
if int(Database.version.split('.', 1)[0]) >= 5 and not hasattr(Database, 'UNICODE'):
42+
convert_unicode = force_unicode
43+
else:
44+
convert_unicode = smart_str
45+
46+
3947
class DatabaseFeatures(BaseDatabaseFeatures):
4048
empty_fetchmany_value = ()
4149
needs_datetime_string_cast = False
@@ -170,10 +178,10 @@ def return_insert_id(self):
170178
return "RETURNING %s INTO %%s", (InsertIdVar(),)
171179

172180
def savepoint_create_sql(self, sid):
173-
return "SAVEPOINT " + self.quote_name(sid)
181+
return convert_unicode("SAVEPOINT " + self.quote_name(sid))
174182

175183
def savepoint_rollback_sql(self, sid):
176-
return "ROLLBACK TO SAVEPOINT " + self.quote_name(sid)
184+
return convert_unicode("ROLLBACK TO SAVEPOINT " + self.quote_name(sid))
177185

178186
def sql_flush(self, style, tables, sequences):
179187
# Return a list of 'TRUNCATE x;', 'TRUNCATE y;',
@@ -304,7 +312,7 @@ def _connect_string(self):
304312
def _cursor(self):
305313
cursor = None
306314
if not self._valid_connection():
307-
conn_string = self._connect_string()
315+
conn_string = convert_unicode(self._connect_string())
308316
self.connection = Database.connect(conn_string, **self.settings_dict['DATABASE_OPTIONS'])
309317
cursor = FormatStylePlaceholderCursor(self.connection)
310318
# Set oracle date to ansi date format. This only needs to execute
@@ -355,7 +363,8 @@ def __init__(self, param, cursor, strings_only=False):
355363
if hasattr(param, 'bind_parameter'):
356364
self.smart_str = param.bind_parameter(cursor)
357365
else:
358-
self.smart_str = smart_str(param, cursor.charset, strings_only)
366+
self.smart_str = convert_unicode(param, cursor.charset,
367+
strings_only)
359368
if hasattr(param, 'input_size'):
360369
# If parameter has `input_size` attribute, use that.
361370
self.input_size = param.input_size
@@ -423,7 +432,7 @@ def execute(self, query, params=None):
423432
# is being passed to SQL*Plus.
424433
if query.endswith(';') or query.endswith('/'):
425434
query = query[:-1]
426-
query = smart_str(query, self.charset) % tuple(args)
435+
query = convert_unicode(query % tuple(args), self.charset)
427436
self._guess_input_sizes([params])
428437
try:
429438
return self.cursor.execute(query, self._param_generator(params))
@@ -445,7 +454,7 @@ def executemany(self, query, params=None):
445454
# is being passed to SQL*Plus.
446455
if query.endswith(';') or query.endswith('/'):
447456
query = query[:-1]
448-
query = smart_str(query, self.charset) % tuple(args)
457+
query = convert_unicode(query % tuple(args), self.charset)
449458
formatted = [self._format_params(i) for i in params]
450459
self._guess_input_sizes(formatted)
451460
try:

django/db/backends/oracle/introspection.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
2626
except AttributeError:
2727
pass
2828

29+
def get_field_type(self, data_type, description):
30+
# If it's a NUMBER with scale == 0, consider it an IntegerField
31+
if data_type == cx_Oracle.NUMBER and description[5] == 0:
32+
return 'IntegerField'
33+
else:
34+
return super(DatabaseIntrospection, self).get_field_type(
35+
data_type, description)
36+
2937
def get_table_list(self, cursor):
3038
"Returns a list of table names in the current database."
3139
cursor.execute("SELECT TABLE_NAME FROM USER_TABLES")

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
# other places throughout the built documents.
4242
#
4343
# The short X.Y version.
44-
version = '1.0'
44+
version = '1.1'
4545
# The full version, including alpha/beta/rc tags.
4646
release = version
4747
# The next version to be released
48-
django_next_version = '1.1'
48+
django_next_version = '1.2'
4949

5050
# There are two options for replacing |today|: either, you set today to some
5151
# non-false value, then it is used:

docs/howto/deployment/modpython.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ the ``media`` subdirectory and any URL that ends with ``.jpg``, ``.gif`` or
264264

265265

266266
.. _lighttpd: http://www.lighttpd.net/
267-
.. _Nginx: http://wiki.codemongers.com/Main
267+
.. _Nginx: http://wiki.nginx.org/Main
268268
.. _TUX: http://en.wikipedia.org/wiki/TUX_web_server
269269
.. _Apache: http://httpd.apache.org/
270270
.. _Cherokee: http://www.cherokee-project.com/

docs/howto/deployment/modwsgi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ file. All other URLs will be served using mod_wsgi::
9898
</Directory>
9999

100100
.. _lighttpd: http://www.lighttpd.net/
101-
.. _Nginx: http://wiki.codemongers.com/Main
101+
.. _Nginx: http://wiki.nginx.org/Main
102102
.. _TUX: http://en.wikipedia.org/wiki/TUX_web_server
103103
.. _Apache: http://httpd.apache.org/
104104
.. _Cherokee: http://www.cherokee-project.com/

docs/index.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ The Django open-source project
189189
* **Community:**
190190
:ref:`How to get involved <internals-contributing>` |
191191
:ref:`The release process <internals-release-process>` |
192-
:ref:`Team of committers <internals-committers>`
192+
:ref:`Team of committers <internals-committers>` |
193+
:ref:`The Django source code repository <internals-svn>`
193194

194195
* **Design philosophies:**
195196
:ref:`Overview <misc-design-philosophies>`

0 commit comments

Comments
 (0)