Opened 17 years ago
Closed 17 years ago
#4826 closed (duplicate)
str.upper() failed in _get_installed_models when syncdb
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | unicode, oracle, str | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Problem:
I'm using django svn-5640
#python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 11, in ?
execute_manager(settings)
File "/usr/lib/python2.4/site-packages/django/core/management.py", line 1742, in execute_manager
execute_from_command_line(action_mapping, argv)
File "/usr/lib/python2.4/site-packages/django/core/management.py", line 1639, in execute_from_command_line
action_mapping[action](int(options.verbosity), options.interactive)
File "/usr/lib/python2.4/site-packages/django/core/management.py", line 549, in syncdb
seen_models = _get_installed_models(table_list)
File "/usr/lib/python2.4/site-packages/django/core/management.py", line 71, in _get_installed_models
return set([m for m in all_models if converter(m._meta.db_table) in map(converter, table_list)])
TypeError: descriptor 'upper' requires a 'str' object but received a 'unicode'
Since some backend (eg:oracle xe) use case insensitive table names,
django will run str.upper() to make table names unique.
however str.upper() expect for a str type,
and now django trunk version give a unicode type back,
that would cause a problem.
Solution:
Change str.upper() in _get_installed_models at management.py to string.upper() would avoid this problem.
--- /usr/lib/python2.4/site-packages/django/core/management.py.orig 2007-07-10 16:55:07.000000000 +0800
+++ /usr/lib/python2.4/site-packages/django/core/management.py 2007-07-10 16:37:27.000000000 +0800
@@ -65,7 +65,9 @@
for model in models.get_models(app):
all_models.append(model)
if backend.uses_case_insensitive_names:
- converter = str.upper
+ import string
+ converter = string.upper
else:
converter = lambda x: x
return set([m for m in all_models if converter(m._meta.db_table) in map(converter, table_list)])
Change History (2)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
sorry, please ignore this, this is duplicated with #4827