- Timestamp:
- 05/01/08 12:24:21 (7 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
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':
