Permalink
Browse files

[soc2009/model-validation] Merged to trunk at r11478

  • Loading branch information...
1 parent f20e7fc commit 78d75b86e3e45ec3ca9f2ace21255922046dd509 @HonzaKral HonzaKral committed Sep 11, 2009
View
@@ -1,4 +1,4 @@
-VERSION = (1, 1, 0, 'final', 0)
+VERSION = (1, 2, 0, 'alpha', 0)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
@@ -482,7 +482,7 @@ def get_action_choices(self, request, default_choices=BLANK_CHOICE_DASH):
def get_action(self, action):
"""
- Return a given action from a parameter, which can either be a calable,
+ Return a given action from a parameter, which can either be a callable,
or the name of a method on the ModelAdmin. Return is a tuple of
(callable, name, description).
"""
@@ -19,7 +19,7 @@
{% endfor %}
</ul>
{% else %}
- <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>
+ <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>
{% for deleteable_object in deletable_objects %}
<ul>{{ deleteable_object|unordered_list }}</ul>
{% endfor %}
@@ -34,4 +34,4 @@
</div>
</form>
{% endif %}
-{% endblock %}
+{% endblock %}
@@ -131,7 +131,7 @@ def handle_inspection(self):
if srid != 4326: extra_params['srid'] = srid
else:
try:
- field_type = connection.introspection.data_types_reverse[row[1]]
+ field_type = connection.introspection.get_field_type(row[1], row)
except KeyError:
field_type = 'TextField'
comment_notes.append('This field type is a guess.')
@@ -73,7 +73,7 @@ def handle_inspection(self):
extra_params['db_column'] = column_name
else:
try:
- field_type = connection.introspection.data_types_reverse[row[1]]
+ field_type = connection.introspection.get_field_type(row[1], row)
except KeyError:
field_type = 'TextField'
comment_notes.append('This field type is a guess.')
@@ -470,6 +470,14 @@ class BaseDatabaseIntrospection(object):
def __init__(self, connection):
self.connection = connection
+ def get_field_type(self, data_type, description):
+ """Hook for a database backend to use the cursor description to
+ match a Django field type to a database column.
+
+ For Oracle, the column data_type on its own is insufficient to
+ distinguish between a FloatField and IntegerField, for example."""
+ return self.data_types_reverse[data_type]
+
def table_name_converter(self, name):
"""Apply a conversion to the name for the purposes of comparison.
@@ -560,4 +568,3 @@ class BaseDatabaseValidation(object):
def validate_field(self, errors, opts, f):
"By default, there is no backend-specific validation"
pass
-
@@ -36,6 +36,14 @@
IntegrityError = Database.IntegrityError
+# Check whether cx_Oracle was compiled with the WITH_UNICODE option. This will
+# also be True in Python 3.0.
+if int(Database.version.split('.', 1)[0]) >= 5 and not hasattr(Database, 'UNICODE'):
+ convert_unicode = force_unicode
+else:
+ convert_unicode = smart_str
+
+
class DatabaseFeatures(BaseDatabaseFeatures):
empty_fetchmany_value = ()
needs_datetime_string_cast = False
@@ -170,10 +178,10 @@ def return_insert_id(self):
return "RETURNING %s INTO %%s", (InsertIdVar(),)
def savepoint_create_sql(self, sid):
- return "SAVEPOINT " + self.quote_name(sid)
+ return convert_unicode("SAVEPOINT " + self.quote_name(sid))
def savepoint_rollback_sql(self, sid):
- return "ROLLBACK TO SAVEPOINT " + self.quote_name(sid)
+ return convert_unicode("ROLLBACK TO SAVEPOINT " + self.quote_name(sid))
def sql_flush(self, style, tables, sequences):
# Return a list of 'TRUNCATE x;', 'TRUNCATE y;',
@@ -304,7 +312,7 @@ def _connect_string(self):
def _cursor(self):
cursor = None
if not self._valid_connection():
- conn_string = self._connect_string()
+ conn_string = convert_unicode(self._connect_string())
self.connection = Database.connect(conn_string, **self.settings_dict['DATABASE_OPTIONS'])
cursor = FormatStylePlaceholderCursor(self.connection)
# Set oracle date to ansi date format. This only needs to execute
@@ -355,7 +363,8 @@ def __init__(self, param, cursor, strings_only=False):
if hasattr(param, 'bind_parameter'):
self.smart_str = param.bind_parameter(cursor)
else:
- self.smart_str = smart_str(param, cursor.charset, strings_only)
+ self.smart_str = convert_unicode(param, cursor.charset,
+ strings_only)
if hasattr(param, 'input_size'):
# If parameter has `input_size` attribute, use that.
self.input_size = param.input_size
@@ -423,7 +432,7 @@ def execute(self, query, params=None):
# is being passed to SQL*Plus.
if query.endswith(';') or query.endswith('/'):
query = query[:-1]
- query = smart_str(query, self.charset) % tuple(args)
+ query = convert_unicode(query % tuple(args), self.charset)
self._guess_input_sizes([params])
try:
return self.cursor.execute(query, self._param_generator(params))
@@ -445,7 +454,7 @@ def executemany(self, query, params=None):
# is being passed to SQL*Plus.
if query.endswith(';') or query.endswith('/'):
query = query[:-1]
- query = smart_str(query, self.charset) % tuple(args)
+ query = convert_unicode(query % tuple(args), self.charset)
formatted = [self._format_params(i) for i in params]
self._guess_input_sizes(formatted)
try:
@@ -26,6 +26,14 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
except AttributeError:
pass
+ def get_field_type(self, data_type, description):
+ # If it's a NUMBER with scale == 0, consider it an IntegerField
+ if data_type == cx_Oracle.NUMBER and description[5] == 0:
+ return 'IntegerField'
+ else:
+ return super(DatabaseIntrospection, self).get_field_type(
+ data_type, description)
+
def get_table_list(self, cursor):
"Returns a list of table names in the current database."
cursor.execute("SELECT TABLE_NAME FROM USER_TABLES")
View
@@ -41,11 +41,11 @@
# other places throughout the built documents.
#
# The short X.Y version.
-version = '1.0'
+version = '1.1'
# The full version, including alpha/beta/rc tags.
release = version
# The next version to be released
-django_next_version = '1.1'
+django_next_version = '1.2'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
@@ -264,7 +264,7 @@ the ``media`` subdirectory and any URL that ends with ``.jpg``, ``.gif`` or
.. _lighttpd: http://www.lighttpd.net/
-.. _Nginx: http://wiki.codemongers.com/Main
+.. _Nginx: http://wiki.nginx.org/Main
.. _TUX: http://en.wikipedia.org/wiki/TUX_web_server
.. _Apache: http://httpd.apache.org/
.. _Cherokee: http://www.cherokee-project.com/
@@ -98,7 +98,7 @@ file. All other URLs will be served using mod_wsgi::
</Directory>
.. _lighttpd: http://www.lighttpd.net/
-.. _Nginx: http://wiki.codemongers.com/Main
+.. _Nginx: http://wiki.nginx.org/Main
.. _TUX: http://en.wikipedia.org/wiki/TUX_web_server
.. _Apache: http://httpd.apache.org/
.. _Cherokee: http://www.cherokee-project.com/
View
@@ -187,7 +187,8 @@ The Django open-source project
* **Community:**
:ref:`How to get involved <internals-contributing>` |
:ref:`The release process <internals-release-process>` |
- :ref:`Team of committers <internals-committers>`
+ :ref:`Team of committers <internals-committers>` |
+ :ref:`The Django source code repository <internals-svn>`
* **Design philosophies:**
:ref:`Overview <misc-design-philosophies>`
@@ -135,19 +135,21 @@ Joseph Kocherhans
.. _michael meeks: http://en.wikipedia.org/wiki/Michael_Meeks_(software)
`Brian Rosner`_
- Brian is currently a web developer working on an e-commerce system in
- Django. He spends his free time contributing to Django and enjoys to learn
- more about programming languages and system architectures. Brian is the
- co-host of the weekly podcast, `This Week in Django`_.
-
+ Brian is currently the tech lead at Eldarion_ managing and developing
+ Django / Pinax_ based websites. He enjoys learning more about programming
+ languages and system architectures and contributing to open source
+ projects. Brian is the host of the `Django Dose`_ podcasts.
+
Brian helped immensely in getting Django's "newforms-admin" branch finished
in time for Django 1.0; he's now a full committer, continuing to improve on
the admin and forms system.
- Brian lives in Denver, USA.
+ Brian lives in Denver, Colorado, USA.
.. _brian rosner: http://oebfare.com/
-.. _this week in django: http://thisweekindjango.com/
+.. _eldarion: http://eldarion.com/
+.. _pinax: http://pinaxproject.com/
+.. _django dose: http://djangodose.com/
`Gary Wilson`_
Gary starting contributing patches to Django in 2006 while developing Web
Oops, something went wrong.

0 comments on commit 78d75b8

Please sign in to comment.