Show
Ignore:
Timestamp:
05/31/08 22:01:20 (6 months ago)
Author:
JensDiemer
Message:
  • add a few test for the new plugin models
  • unittest: test plugin would be copied to the normal plugins. So this plugin would be auto installed with all other plugins.
  • Bugfix in lucidTag.py: 1 should not be converted to True ;)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/system/plugin_manager.py

    r1609 r1612  
    3030from django.db.models import Model 
    3131from django.core.management.sql import sql_model_create, \ 
    32                                                         sql_indexes_for_model, custom_sql_for_model 
     32                                    sql_indexes_for_model, custom_sql_for_model 
    3333from django.http import HttpResponse, Http404 
    3434 
     
    3636from PyLucid.system.exceptions import * 
    3737from PyLucid.system.plugin_import import get_plugin_module, \ 
    38                                                                         get_plugin_config, get_plugin_version 
    39  
    40  
     38                                        get_plugin_config, get_plugin_version 
    4139 
    4240 
     
    5351        ) 
    5452        request.page_msg(msg) 
    55         msg2 = '<i title="(Error details in page messages.)">["%s.%s" error.]</i>' % ( 
    56             plugin_name, method_name 
    57         ) 
     53        msg2 = ( 
     54            '<i title="(Error details in page messages.)">["%s.%s" error.]</i>' 
     55        ) % (plugin_name, method_name) 
    5856        local_response.write(msg2) 
    5957 
     
    198196 
    199197 
    200 def get_create_table(models): 
     198def get_create_table(plugin_models): 
    201199    from django.core.management.color import no_style 
    202200    style = no_style() 
    203201 
    204202    statements = [] 
    205     for model in models: 
     203    for model in plugin_models: 
    206204        statements += sql_model_create(model, style)[0] 
    207205        statements += sql_indexes_for_model(model, style) 
     
    210208 
    211209 
    212  
    213210def create_plugin_tables(plugin, extra_verbose): 
    214     plugin_module = get_plugin_module( 
     211    plugin_models = Plugin.objects.get_plugin_models( 
    215212        plugin.package_name, 
    216213        plugin.plugin_name, 
    217214        debug=extra_verbose, 
    218215    ) 
    219     if not hasattr(plugin_module, "PLUGIN_MODELS"): 
     216    if not plugin_models: 
    220217        # Plugin has no models 
    221         if extra_verbose: 
    222             print "Info: No 'plugin_models' list defined, ok." 
    223218        return 
    224  
    225     plugin_models = plugin_module.PLUGIN_MODELS 
    226219 
    227220    statements = get_create_table(plugin_models) 
    228221    cursor = connection.cursor() 
    229222    for statement in statements: 
    230         print repr(statement) 
     223        #print repr(statement) 
    231224        cursor.execute(statement) 
    232225