Zine

open source content publishing system


Changeset 512:c54bfe545bf7

Show
Ignore:
Timestamp:
10/25/08 15:48:39 (3 months ago)
Author:
EnTeQuAk
Branch:
default
Message:

hopefully fixed some plugin issues

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • zine/views/admin.py

    r510 r512  
    3939     touch_upload_folder, upload_file, create_thumbnail, file_exists, \ 
    4040     get_filename 
    41 from zine.utils.http import redirect_back, redirect_to 
     41from zine.utils.http import redirect_back, redirect_to, redirect 
    4242from zine.i18n import parse_datetime, format_system_datetime, \ 
    4343     list_timezones, has_timezone, list_languages, has_language 
     
    155155    # check for broken plugins if we have the plugin guard enabled 
    156156    if request.app.cfg['plugin_guard']: 
     157        plugins_to_deactivate = [] 
    157158        for plugin in request.app.plugins.itervalues(): 
    158159            if plugin.active and plugin.setup_error is not None: 
    159                 plugin.deactivate() 
     160                plugins_to_deactivate.append(plugin.name) 
    160161                exc_type, exc_value, tb = plugin.setup_error 
    161162                if exc_type is SetupError: 
     
    177178                    } 
    178179                flash(msg, 'error') 
     180 
     181        if plugins_to_deactivate: 
     182            #TODO: it's quite tricky – it needs at least two reloads to 
     183            #      deactivate the plugin (which is in fact a application reload) 
     184            cfg = request.app.cfg.edit() 
     185            cfg['plugins'] = u', '.join(sorted(set(request.app.cfg['plugins']) - \ 
     186                                               set(plugins_to_deactivate))) 
     187            cfg.commit() 
     188            # we change the plugins inline so that the user get somewhat more 
     189            # informations 
     190            request.app.cfg.touch() 
     191 
    179192 
    180193    #! used to flash messages, add links to stylesheets, modify the admin