Changeset 1548
- Timestamp:
- 05/01/08 12:24:21 (23 months ago)
- Location:
- trunk/pylucid/PyLucid
- Files:
-
- 1 added
- 12 modified
-
db/preferences.py (modified) (2 diffs)
-
install/install.py (modified) (1 diff)
-
models.py (modified) (7 diffs)
-
plugins_internal/find_and_replace/find_and_replace.py (modified) (3 diffs)
-
plugins_internal/find_and_replace/find_and_replace_cfg.py (modified) (1 diff)
-
plugins_internal/preferences/preferences.py (modified) (4 diffs)
-
plugins_internal/search/search.py (modified) (8 diffs)
-
plugins_internal/system_settings/system_settings.py (modified) (1 diff)
-
system/BasePlugin.py (modified) (1 diff)
-
system/detect_page.py (modified) (1 diff)
-
system/plugin_import.py (modified) (5 diffs)
-
system/plugin_manager.py (modified) (7 diffs)
-
tools/newforms_utils.py (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid/PyLucid/db/preferences.py
r1544 r1548 4 4 PyLucid preferences API 5 5 ~~~~~~~~~~~~~~~~~~~~~~~ 6 7 OBSOLETE 6 8 7 9 Last commit info: … … 168 170 169 171 172 def get_pref_dict(plugin_name): 173 """ 174 returns the data_dict for the given plugin_name. Used the cache. 175 If a plugin use preferences in a newforms, it must have access to the 176 preferences at module level. 177 FIXME: If the admin change the preferences, the values in a plugin module 178 level would only updated, if the server instance restarted. 179 """ 180 if plugin_name in preference_cache: 181 return preference_cache[plugin_name] 182 183 plugin = Plugin.objects.get(plugin_name=plugin_name) 184 185 p = Preferences() 186 p.set_plugin(plugin) 187 p.load_from_db() 188 return p.data_dict 189 170 190 171 191 #______________________________________________________________________________ -
trunk/pylucid/PyLucid/install/install.py
r1544 r1548 31 31 DROP_TABLES = ( 32 32 "PyLucid_pagearchiv", 33 "PyLucid_plugin", 34 "PyLucid_preference", 33 35 "PyLucid_preference2", 34 36 ) -
trunk/pylucid/PyLucid/models.py
r1544 r1548 19 19 20 20 import os, posixpath, pickle 21 from pprint import pformat 21 22 22 23 from django.conf import settings … … 26 27 from django.utils.translation import ugettext as _ 27 28 29 from PyLucid.tools.newforms_utils import get_init_dict, setup_help_text 30 from PyLucid.tools.data_eval import data_eval, DataEvalError 28 31 from PyLucid.tools.shortcuts import getUniqueShortcut 29 32 from PyLucid.tools import crypt 30 33 from PyLucid.system.utils import get_uri_base 34 from PyLucid.system.plugin_import import get_plugin_module 35 31 36 #from PyLucid.db.cache import delete_page_cache 32 37 … … 175 180 """ 176 181 try: 177 entry = Preference.objects.get(name="index page")178 except P reference.DoesNotExist:182 preferences = Plugin.objects.get_preferences("system_settings") 183 except Plugin.DoesNotExist, e: 179 184 # Update old PyLucid installation? 180 185 return 181 186 182 index_page_id = entry.value187 index_page_id = preferences["index_page"] 183 188 184 189 if int(self.id) != int(index_page_id): … … 224 229 """ 225 230 try: 226 auto_shortcuts = Preference.objects.get(name='auto shortcuts').value227 except P reference.DoesNotExist:231 preferences = Plugin.objects.get_preferences("system_settings") 232 except Plugin.DoesNotExist, e: 228 233 # Update old PyLucid installation? 229 234 auto_shortcuts = True 230 231 if auto_shortcuts in (1, True, "1"): 235 else: 236 print ">>>", preferences 237 auto_shortcuts = preferences["auto_shortcuts"] 238 239 if auto_shortcuts: 232 240 # We should rebuild the shortcut 233 241 self.shortcut = self.name … … 485 493 486 494 487 #class Markup(models.Model): 488 # # Obsolete! 489 # pass 490 491 #class PagesInternal(models.Model): 492 # # Obsolete! 493 # pass 495 class Preference(models.Model): 496 # Obsolete! 497 pass 494 498 495 499 #____________________________________________________________________ 496 500 501 preference_cache = {} 502 503 class PluginManager(models.Manager): 504 def get_preferences(self, plugin_name): 505 """ 506 returns the preference data dict, use the cache 507 """ 508 # Get the name of the plugin, if __file__ used 509 plugin_name = os.path.splitext(os.path.basename(plugin_name))[0] 510 print "plugin name: '%s'" % plugin_name 511 512 if plugin_name in preference_cache: 513 return preference_cache[plugin_name] 514 515 plugin = self.get(plugin_name = plugin_name) 516 return plugin.get_preferences() 517 518 497 519 class Plugin(models.Model): 520 objects = PluginManager() 521 522 plugin_name = models.CharField(max_length=90, unique=True) 523 498 524 package_name = models.CharField(max_length=255) 499 plugin_name = models.CharField(max_length=90, unique=True)500 version = models.CharField(null=True, blank=True, max_length=45)501 525 author = models.CharField(blank=True, max_length=150) 502 526 url = models.CharField(blank=True, max_length=255) 503 527 description = models.CharField(blank=True, max_length=255) 504 long_description = models.TextField(blank=True) 528 529 pref_data_string = models.TextField( 530 null=True, blank=True, 531 help_text="printable representation of the newform data dictionary" 532 ) 505 533 can_deinstall = models.BooleanField(default=True, 506 534 help_text=( … … 512 540 help_text="Is this plugin is enabled and useable?" 513 541 ) 542 543 def init_pref_form(self, pref_form): 544 """ 545 Set self.pref_data_string from the given newforms form and his initial 546 values. 547 """ 548 init_dict = get_init_dict(pref_form) 549 preference_cache[self.plugin_name] = init_dict 550 self.set_pref_data_string(init_dict) 551 552 def set_pref_data_string(self, data_dict): 553 """ 554 set the dict via pformat 555 """ 556 preference_cache[self.plugin_name] = data_dict 557 self.pref_data_string = pformat(data_dict) 558 559 def get_preferences(self): 560 """ 561 evaluate the pformat string into a dict and return it. 562 """ 563 data_dict = data_eval(self.pref_data_string) 564 preference_cache[self.plugin_name] = data_dict 565 return data_dict 566 567 def get_pref_form(self, debug): 568 """ 569 Get the 'PreferencesForm' newform class from the plugin modul, insert 570 initial information into the help text and return the form. 571 """ 572 plugin_module = get_plugin_module( 573 self.package_name, self.plugin_name, debug 574 ) 575 form = getattr(plugin_module, "PreferencesForm") 576 setup_help_text(form) 577 return form 514 578 515 579 def save(self): … … 535 599 class Admin: 536 600 list_display = ( 537 "active", "plugin_name", "description", " version", "can_deinstall"601 "active", "plugin_name", "description", "can_deinstall" 538 602 ) 539 603 list_display_links = ("plugin_name",) 540 604 ordering = ('package_name', 'plugin_name') 541 list_filter = ("author", )605 list_filter = ("author","package_name", "can_deinstall") 542 606 543 607 def __unicode__(self): 544 608 txt = u"%s - %s" % (self.package_name, self.plugin_name) 545 609 return txt.replace(u"_",u" ") 546 547 #______________________________________________________________________________548 # Preference549 550 class Preference(models.Model):551 """552 Stores preferences553 554 Any pickleable Python object can be stored.555 556 Use a small cache, so the pickle.loads() method would only be used on the557 first access.558 559 Note:560 - This model has no Admin class. Because it makes no sense to edit561 pickled data strings in the django admin panel ;)562 """563 plugin = models.ForeignKey("Plugin", help_text="The associated plugin")564 repr_string = models.TextField(565 help_text="printable representation of the newform data dictionary"566 )567 568 lastupdatetime = models.DateTimeField(auto_now=True, editable=False)569 lastupdateby = models.ForeignKey(570 User, null=True, blank=True, editable=False,571 )572 573 #__________________________________________________________________________574 575 def __unicode__(self):576 return u"Preference object for '%s'" % self.plugin577 578 class Admin:579 pass580 581 class Meta:582 # Use a new table583 db_table = u'PyLucid_preference2'584 585 586 class PreferenceOld(models.Model):587 """588 Stores preferences for the PyLucid system and all Plugins.589 590 Any pickleable Python object can be stored.591 Use a small cache, so the pickle.loads() method would only be used on the592 first get_value access. The default_value used no cache.593 594 Usage:595 ---------------------------------------------------------------------------596 Preference(name = "value name", value = my_python_data_object).save()597 598 p = Preference.objects.get(name = "value name")599 print p.value600 ---------------------------------------------------------------------------601 602 Note:603 - This model has no Admin class. Because it makes no sense to edit604 pickled data strings in the django admin panel ;)605 - value and default_value are properties606 """607 __cache = {} # Cache the pickleable Python object608 609 #__________________________________________________________________________610 611 def _get_cache_key(self):612 """ returns plugin name + preferences name as a string """613 return "%s-%s" % (self.plugin, self.name)614 615 #__________________________________________________________________________616 # get and set methods for the value property of the entry617 618 def __get_value(self):619 """620 returns the pickleable Python object back. Use the cache first.621 """622 cache_key = self._get_cache_key()623 624 if cache_key in self.__cache:625 value = self.__cache[cache_key]626 else:627 self._value = str(self._value)628 value = pickle.loads(self._value)629 self.__cache[cache_key] = value630 return value631 632 def __set_value(self, value):633 """634 Save a the pickleable Python object into the database. Remember the635 source object in the cache636 """637 cache_key = self._get_cache_key()638 639 self.__cache[cache_key] = value640 self._value = pickle.dumps(value)641 642 #__________________________________________________________________________643 # get and set methods for the default value property of the entry644 645 def __get_default_value(self):646 """647 returns the default value back648 """649 self._default_value = str(self._default_value)650 default_value = pickle.loads(self._default_value)651 return default_value652 653 def __set_default_value(self, default_value):654 """655 save a default value656 """657 self._default_value = pickle.dumps(default_value)658 659 #__________________________________________________________________________660 # The attributes661 662 plugin = models.ForeignKey(663 "Plugin", help_text="The associated plugin",664 null=True, blank=True, editable=False665 )666 name = models.CharField(667 max_length=150, db_index=True, editable=False,668 help_text="Name of the preferences entry",669 )670 description = models.TextField(editable=False)671 672 _value = models.TextField(673 editable=False, help_text="Pickled Python object"674 )675 value = property(__get_value, __set_value)676 677 _default_value = models.TextField(678 editable=False, help_text="Pickled Python object"679 )680 default_value = property(__get_default_value, __set_default_value)681 682 field_type = models.CharField(max_length=150, editable=False,683 help_text="The data type for this entry (For building a html form)."684 )685 686 lastupdatetime = models.DateTimeField(auto_now=True)687 lastupdateby = models.ForeignKey(688 User, null=True, blank=True, editable=False,689 )690 691 #__________________________________________________________________________692 693 def save(self):694 """695 Save a new or update a preference entry696 """697 if self.id == None:698 # A new preferences should be saved.699 if self._default_value == "":700 # No default value given in the __init__ -> Use current value701 self._default_value = self._value702 703 super(Preference, self).save() # Call the "real" save() method704 705 def __unicode__(self):706 # <Preference: Preference object>707 return "%s '%s'" % (self.plugin, self.name)708 709 class Meta:710 # Use the old table711 db_table = u'PyLucid_preference'712 610 713 611 -
trunk/pylucid/PyLucid/plugins_internal/find_and_replace/find_and_replace.py
r1544 r1548 29 29 30 30 from django import newforms as forms 31 from django.utils.safestring import mark_safe 31 32 from django.utils.translation import ugettext as _ 32 from django.utils.safestring import mark_safe33 33 34 from PyLucid.system.BasePlugin import PyLucidBasePlugin 34 35 from PyLucid.models import Page, Template, Style 35 from PyLucid.system.BasePlugin import PyLucidBasePlugin 36 #from PyLucid.db.preferences import get_pref_dict 37 from PyLucid.tools.Diff import diff_lines 36 38 from PyLucid.tools.utils import escape 37 from PyLucid.tools.Diff import diff_lines38 39 39 # How min/max long must a search term be?40 MIN_TERM_LEN = 241 MAX_TERM_LEN = 15042 40 43 41 class PreferencesForm(forms.Form): … … 59 57 ) 60 58 59 60 # We used preferences values in a newform. We need these values here. 61 try: 62 preferences = Plugin.objects.get_preferences(__file__) 63 except Plugin.DoesNotExist, e: 64 # in _install section? 65 pass 66 else: 67 min_term_len = preferences["min_term_len"] 68 max_term_len = preferences["max_term_len"] 69 70 61 71 class FindReplaceForm(forms.Form): 62 72 # TODO: min und max should be saved in the prefereces. 63 73 find_string = forms.CharField( 64 min_length = MIN_TERM_LEN, max_length = MAX_TERM_LEN,74 min_length = min_term_len, max_length = max_term_len, 65 75 ) 66 76 replace_string = forms.CharField( 67 min_length = MIN_TERM_LEN, max_length = MAX_TERM_LEN,77 min_length = min_term_len, max_length = max_term_len, 68 78 ) 69 79 type = forms.ChoiceField( … … 79 89 80 90 def find_and_replace(self): 81 self.page_msg("Preferences:", self.preferences)82 83 91 context = {} 84 92 if self.request.method == 'POST': -
trunk/pylucid/PyLucid/plugins_internal/find_and_replace/find_and_replace_cfg.py
r1479 r1548 26 26 }, 27 27 } 28 29 preferences = ( 30 { 31 "name": "term len limit", 32 "description": "How min/max long must a search term be?", 33 "value": { 34 "min term len": 1, 35 "max term len": 255, 36 } 37 }, 38 ) -
trunk/pylucid/PyLucid/plugins_internal/preferences/preferences.py
r1544 r1548 26 26 from django.utils.translation import ugettext as _ 27 27 28 from PyLucid.db.preferences import get_all_prefs, Preferences29 28 from PyLucid.system.BasePlugin import PyLucidBasePlugin 30 from PyLucid. tools.data_eval import data_eval, DataEvalError29 from PyLucid.models import Plugin 31 30 32 31 … … 44 43 45 44 items = [] 46 for pref in get_all_prefs(): 47 edit_link = self.URLs.methodLink("edit", args=pref.id) 45 plugins = Plugin.objects.all() 46 for plugin in plugins: 47 if plugin.pref_data_string == None: 48 continue 49 50 edit_link = self.URLs.methodLink("edit", args=plugin.id) 48 51 49 52 items.append({ 50 "plugin_name": self._vebose_plugin_name(pref),51 "plugin_description": p ref.plugin.description,53 "plugin_name": unicode(plugin), 54 "plugin_description": plugin.description, 52 55 "edit_link": edit_link, 53 56 }) … … 62 65 try: 63 66 url_args = url_args.strip("/") 64 p ref_id = int(url_args)67 plugin_id = int(url_args) 65 68 except Exception, e: 66 69 self.page_msg.red("url error:", e) 67 70 return 68 71 69 p = Preferences() 70 p.init_via_id(pref_id) 71 data_dict = p.data_dict 72 73 p.load_form(self.request) 74 unbound_form = p.form 72 plugin = Plugin.objects.get(id = plugin_id) 73 unbound_form = plugin.get_pref_form(self.request.debug) 75 74 76 75 if self.request.method == 'POST': … … 78 77 if form.is_valid(): 79 78 new_data_dict = form.cleaned_data 80 p.update_and_save(new_data_dict) 79 80 plugin.set_pref_data_string(new_data_dict) 81 plugin.save() 81 82 self.page_msg("New preferences saved.") 82 83 return self.select() # Display the menu 83 84 else: 85 data_dict = plugin.get_preferences() 84 86 form = unbound_form(data_dict) 85 87 86 88 context = { 87 "plugin_name": self._vebose_plugin_name(p),89 "plugin_name": unicode(plugin), 88 90 "form": form, 89 91 "url_abort": self.URLs.methodLink("select"), -
trunk/pylucid/PyLucid/plugins_internal/search/search.py
r1544 r1548 27 27 28 28 from django import newforms as forms 29 from django.utils.safestring import mark_safe 29 30 from django.utils.translation import ugettext as _ 30 from django.utils.safestring import mark_safe 31 32 from PyLucid.models import Page 31 33 32 from PyLucid.system.BasePlugin import PyLucidBasePlugin 34 33 from PyLucid.tools.utils import escape 35 36 37 # How min/max long must a search term be? 38 MIN_TERM_LEN = 3 39 MAX_TERM_LEN = 50 40 41 # Number of the paged for the result page: 42 MAX_RESULTS = 20 43 44 # The length of the text-hit-cutouts: 45 TEXT_CUTOUT_LEN = 50 46 47 # Max. cutout lines for every search term: 48 MAX_CUTOUTS_LINES = 5 34 from PyLucid.models import Page, Plugin 49 35 50 36 … … 71 57 ) 72 58 73 74 class SearchForm(forms.Form): 75 # TODO: min und max should be saved in the prefereces. 76 search_string = forms.CharField( 77 min_length = MIN_TERM_LEN, max_length = MAX_TERM_LEN 78 ) 59 # We used preferences values in a newform. We need these values here. 60 try: 61 preferences = Plugin.objects.get_preferences(__file__) 62 except Plugin.DoesNotExist, e: 63 # in _install section? 64 pass 65 else: 66 class SearchForm(forms.Form): 67 search_string = forms.CharField( 68 min_length = preferences["min_term_len"], 69 max_length = preferences["max_term_len"], 70 ) 79 71 80 72 … … 85 77 Insert a empty search form into the page. 86 78 """ 87 self.page_msg("Preferences:", self.preferences)88 79 search_form = SearchForm() 89 80 context = { … … 138 129 search_strings = [] 139 130 for term in raw_search_strings: 140 if len(term)< MIN_TERM_LEN:131 if len(term)<preferences["min_term_len"]: 141 132 self.page_msg("Ignore '%s' (too small)" % cgi.escape(term)) 142 133 else: … … 178 169 179 170 # Use only the first pages: 180 results = results[: MAX_RESULTS]171 results = results[:preferences["max_results"]] 181 172 182 173 # Build a dict, for the template … … 191 182 the lines. 192 183 """ 184 text_cutout_len = preferences["text_cutout_len"] 185 max_cutout_lines = preferences["max_cutout_lines"] 186 193 187 for result in results: 194 188 result["cutouts"] = [] … … 197 191 for term in search_strings: 198 192 start = 0 199 for _ in xrange( MAX_CUTOUTS_LINES):193 for _ in xrange(max_cutout_lines): 200 194 try: 201 195 index = content.index(term, start) … … 206 200 start = index+1 207 201 208 if index< TEXT_CUTOUT_LEN:209 txt = content[: TEXT_CUTOUT_LEN]202 if index<text_cutout_len: 203 txt = content[:text_cutout_len] 210 204 else: 211 txt = content[index-TEXT_CUTOUT_LEN:index+TEXT_CUTOUT_LEN] 205 start = index-text_cutout_len 206 end = index+text_cutout_len 207 txt = content[start:end] 212 208 213 209 txt = escape(txt) -
trunk/pylucid/PyLucid/plugins_internal/system_settings/system_settings.py
r1544 r1548 60 60 Insert a empty search form into the page. 61 61 """ 62 self.page_msg("Preferences:", self.preferences)62 self.page_msg("Preferences:", preferences) -
trunk/pylucid/PyLucid/system/BasePlugin.py
r1544 r1548 59 59 60 60 self.current_page = self.context["PAGE"] 61 self.preferences = self.context.preferences62 61 63 62 def build_menu(self): -
trunk/pylucid/PyLucid/system/detect_page.py
r1507 r1548 17 17 """ 18 18 19 from PyLucid.models import Page , Preference19 from PyLucid.models import Page 20 20 from PyLucid.system.exceptions import AccessDenied, LowLevelError 21 21 -
trunk/pylucid/PyLucid/system/plugin_import.py
r1544 r1548 21 21 22 22 23 def _import( request, from_name, object_name):23 def _import(from_name, object_name, debug): 24 24 """ 25 25 from 'from_name' import 'object_name' … … 28 28 return __import__(from_name, {}, {}, [object_name]) 29 29 except (ImportError, SyntaxError), e: 30 if request.user.is_superuser or request.debug:30 if debug: 31 31 raise 32 32 raise ImportError, "Can't import %s from %s: %s" % ( … … 34 34 ) 35 35 36 def get_plugin_module( request, package_name, plugin_name):37 plugin_module = _import( request,36 def get_plugin_module(package_name, plugin_name, debug): 37 plugin_module = _import( 38 38 from_name = ".".join([package_name, plugin_name, plugin_name]), 39 object_name = plugin_name 39 object_name = plugin_name, 40 debug = debug, 40 41 ) 41 42 return plugin_module 42 43 43 #def get_plugin_class(request, package_name, plugin_name): 44 # """ 45 # import the plugin/plugin and returns the class object 46 # """ 47 # plugin_module = get_plugin_module(request, package_name, plugin_name) 48 # plugin_class = getattr(plugin_module, plugin_name) 49 # return plugin_class 44 # debug = request.user.is_superuser or request.debug 45 50 46 51 47 def debug_plugin_config(page_msg, plugin_config): … … 65 61 """ 66 62 config_name = "%s_cfg" % plugin_name 63 debug = request.user.is_superuser or request.debug 67 64 68 65 def get_plugin(object_name): … … 70 67 if extra_verbose: 71 68 print "from %s import %s" % (from_name, object_name) 72 return _import( request, from_name, object_name)69 return _import(from_name, object_name, debug) 73 70 74 71 config_plugin = get_plugin(config_name) -
trunk/pylucid/PyLucid/system/plugin_manager.py
r1544 r1548 34 34 from django.http import HttpResponse, Http404 35 35 36 from PyLucid.db.preferences import Preferences, preference_cache, \ 37 PreferenceDoesntExist 36 #from PyLucid.db.preferences import Preferences, preference_cache, PreferenceDoesntExist 38 37 from PyLucid.system.plugin_import import get_plugin_module, get_plugin_config 39 38 from PyLucid.system.exceptions import * … … 112 111 URLs.current_plugin = plugin_name 113 112 114 plugin_module = get_plugin_module(request, plugin.package_name, plugin_name) 115 116 if plugin_name in preference_cache: 117 context.preferences = preference_cache[plugin_name] 118 else: 119 if hasattr(plugin_module, "PreferencesForm"): 120 # Get the preferences dict data from the database 121 try: 122 p = Preferences() 123 p.set_plugin(plugin) 124 p.load_from_db() 125 context.preferences = p.data_dict 126 except PreferenceDoesntExist, e: 127 error("Can't get preferences: %s" % e) 128 return 129 else: 130 # plugin has no preferences 131 context.preferences = None 113 debug = request.user.is_superuser or request.debug 114 plugin_module = get_plugin_module(plugin.package_name, plugin_name, debug) 132 115 133 116 plugin_class = getattr(plugin_module, plugin_name) 117 # print plugin_class, type(plugin_class) 134 118 class_instance = plugin_class(context, local_response) 135 119 unbound_method = getattr(class_instance, method_name) … … 216 200 217 201 218 def _install_plugin( package_name, plugin_name, plugin_config, active,202 def _install_plugin(request, package_name, plugin_name, plugin_config, active, 219 203 extra_verbose): 220 204 """ … … 223 207 if extra_verbose: 224 208 print "Install %s.%s..." % (package_name, plugin_name), 209 225 210 plugin = Plugin.objects.create( 226 211 package_name = package_name, 227 212 plugin_name = plugin_name, 228 version = plugin_config.__version__,229 213 author = plugin_config.__author__, 230 214 url = plugin_config.__url__, 231 215 description = plugin_config.__description__, 232 long_description = plugin_config.__long_description__,233 216 can_deinstall = getattr(plugin_config, "__can_deinstall__", True), 234 217 active = active, 235 218 ) 219 debug = request.user.is_superuser or request.debug 220 plugin_module = get_plugin_module(package_name, plugin_name, debug) 221 pref_form = getattr(plugin_module, "PreferencesForm", None) 222 if pref_form: 223 # plugin module has a preferences newform class 224 plugin.init_pref_form(pref_form) 225 226 236 227 plugin.save() 237 228 if extra_verbose: … … 239 230 return plugin 240 231 241 242 def _insert_preferences(request, plugin, package_name, plugin_name):243 """244 insertet the initial values from the newforms preferences class into the245 database.246 """247 plugin_module = get_plugin_module(request, package_name, plugin_name)248 249 pref_form = getattr(plugin_module, "PreferencesForm", None)250 if pref_form == None:251 # Has no preferences newform class252 return253 254 p = Preferences()255 p.set_plugin(plugin)256 p.create_initial(pref_form)257 232 258 233 … … 280 255 281 256 plugin = _install_plugin( 282 package_name, plugin_name, plugin_config, active, extra_verbose 257 request, package_name, plugin_name, 258 plugin_config, active, extra_verbose 283 259 ) 284 _insert_preferences(request, plugin, package_name, plugin_name)285 260 286 261 … … 314 289 ) 315 290 except Exception, e: 316 print "Error:", e 291 print "Error:" 292 import traceback 293 traceback.print_exc() 317 294 continue 318 295