New issue report by garthk:
What steps will reproduce the problem?
1. Create a Django app with models module xxx.yyy.models
2. Create a module xxx.yyy.schema_evolution with lots of print statements
3. Add 'xxx.yyy' to settings.INSTALLED_APPS
4. Run 'manage.py fingerprint yyy'
What is the expected output? What do you see instead?
You should expect printed output as xxx.yyy.schema_evolution is loaded.
Instead, you'll observe no printed output.
What version of the product are you using? On what operating system?
deseb trunk r77
Please provide any additional information below.
Django management commands for apps expect the last component of an
app's name as an argument. We pass 'auth' as an argument to
'manage.py sqlall', for example, not 'django.contrib.auth'.
deseb.schema_evolution.get_fingerprints_evolutions_from_app attempts
to determine the package containing an app's models and schema_evolution
modules by evaluating:
app_name = app.__name__.split('.')[-2]
get_fingerprint_evolutions_from_app then tries to append
'.schema_evolution' to the name and __import__ the result. This is
doomed unless len(app.__name__.split('.') == 2. For example:
import django.contrib.auth.models as app
app_name = app.__name__.split('.')[-2] # auth
app_se = __import__(app_name +'.schema_evolution').schema_evolution
# equiv to __import__('auth.schema_evolution').schema_evolution
# desired: __import__('django.contrib.auth.schema_evolution')...
get_sql_evolution_check_for_dead_models has a similar problem.
The safe way to get an application's model from its name is to use
django.db.models.loading.cache.get_app(app_name).
I've attached a patch to fix both methods.
Attachments:
schema_evolution.diff 2.6 KB
Issue attributes:
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings