Changeset 1612 for trunk/pylucid/PyLucid/system/plugin_manager.py
- Timestamp:
- 05/31/08 22:01:20 (22 months ago)
- Files:
-
- 1 modified
-
trunk/pylucid/PyLucid/system/plugin_manager.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid/PyLucid/system/plugin_manager.py
r1609 r1612 30 30 from django.db.models import Model 31 31 from django.core.management.sql import sql_model_create, \ 32 sql_indexes_for_model, custom_sql_for_model32 sql_indexes_for_model, custom_sql_for_model 33 33 from django.http import HttpResponse, Http404 34 34 … … 36 36 from PyLucid.system.exceptions import * 37 37 from PyLucid.system.plugin_import import get_plugin_module, \ 38 get_plugin_config, get_plugin_version 39 40 38 get_plugin_config, get_plugin_version 41 39 42 40 … … 53 51 ) 54 52 request.page_msg(msg) 55 msg2 = '<i title="(Error details in page messages.)">["%s.%s" error.]</i>' %(56 plugin_name, method_name57 ) 53 msg2 = ( 54 '<i title="(Error details in page messages.)">["%s.%s" error.]</i>' 55 ) % (plugin_name, method_name) 58 56 local_response.write(msg2) 59 57 … … 198 196 199 197 200 def get_create_table( models):198 def get_create_table(plugin_models): 201 199 from django.core.management.color import no_style 202 200 style = no_style() 203 201 204 202 statements = [] 205 for model in models:203 for model in plugin_models: 206 204 statements += sql_model_create(model, style)[0] 207 205 statements += sql_indexes_for_model(model, style) … … 210 208 211 209 212 213 210 def create_plugin_tables(plugin, extra_verbose): 214 plugin_mod ule = get_plugin_module(211 plugin_models = Plugin.objects.get_plugin_models( 215 212 plugin.package_name, 216 213 plugin.plugin_name, 217 214 debug=extra_verbose, 218 215 ) 219 if not hasattr(plugin_module, "PLUGIN_MODELS"):216 if not plugin_models: 220 217 # Plugin has no models 221 if extra_verbose:222 print "Info: No 'plugin_models' list defined, ok."223 218 return 224 225 plugin_models = plugin_module.PLUGIN_MODELS226 219 227 220 statements = get_create_table(plugin_models) 228 221 cursor = connection.cursor() 229 222 for statement in statements: 230 print repr(statement)223 #print repr(statement) 231 224 cursor.execute(statement) 232 225