Ignore:
Timestamp:
15 Dec 2014, 13:29:51 (10 years ago)
Author:
Henrik Bettermann
Message:

Remove deprecated HTML and REST widgets and use html2dict instead.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r11874 r12247  
    3434    IApplicantRegisterUpdate, ISpecialApplicant
    3535    )
     36from waeup.kofa.utils.helpers import html2dict
    3637from waeup.kofa.applicants.container import (
    3738    ApplicantsContainer, VirtualApplicantsExportJobContainer)
     
    6061    FriendlyDateDisplayWidget,
    6162    FriendlyDatetimeDisplayWidget)
    62 from waeup.kofa.widgets.htmlwidget import HTMLDisplayWidget
    6363
    6464grok.context(IKofaObject) # Make IKofaObject the default context
     
    7272    grok.require('waeup.Public')
    7373    form_fields = grok.AutoFields(IApplicantsRoot)
    74     form_fields['description'].custom_widget = HTMLDisplayWidget
    7574    label = _('Application Section')
    7675    pnav = 3
     
    189188        return del_local_roles(self,3,**data)
    190189
    191     def _description(self):
    192         view = ApplicantsRootPage(
    193             self.context,self.request)
    194         view.setUpWidgets()
    195         return view.widgets['description']()
    196 
    197190    @action(_('Save'), style='primary')
    198191    def save(self, **data):
    199192        self.applyData(self.context, **data)
    200         self.context.description_dict = self._description()
     193        description = getattr(self.context, 'description', None)
     194        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     195        self.context.description_dict = html2dict(description, portal_language)
    201196        self.flash(_('Form has been saved.'))
    202197        return
     
    302297    @property
    303298    def form_fields(self):
    304         form_fields = grok.AutoFields(IApplicantsContainer).omit('title')
    305         form_fields['description'].custom_widget = HTMLDisplayWidget
     299        form_fields = grok.AutoFields(IApplicantsContainer).omit(
     300            'title', 'description')
    306301        form_fields[
    307302            'startdate'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     
    368363        return get_users_with_local_roles(self.context)
    369364
    370     def _description(self):
    371         view = ApplicantsContainerPage(
    372             self.context,self.request)
    373         view.setUpWidgets()
    374         return view.widgets['description']()
    375 
    376365    @action(_('Save'), style='primary')
    377366    def save(self, **data):
     
    381370        else:
    382371            changed_fields = []
    383         self.context.description_dict = self._description()
     372        description = getattr(self.context, 'description', None)
     373        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     374        self.context.description_dict = html2dict(description, portal_language)
    384375        # Always refresh title. So we can change titles
    385376        # if APP_TYPES_DICT has been edited.
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicantscontainerpage.pt

    r10101 r12247  
    22  <tbody>
    33    <tal:block repeat="widget view/widgets">
    4       <tal:condition condition="python:widget.name != 'form.description'">
    54      <tr>
    65        <td class="fieldname">
     
    1110        </td>
    1211      </tr>
    13       </tal:condition>
    1412    </tal:block>
    1513  </tbody>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r12104 r12247  
    6464from waeup.kofa.utils.batching import VirtualExportJobContainer
    6565from waeup.kofa.utils.helpers import get_current_principal, to_timezone, now
    66 from waeup.kofa.widgets.restwidget import ReSTDisplayWidget
    6766from waeup.kofa.students.interfaces import (
    6867    IStudentsContainer, IStudent,
Note: See TracChangeset for help on using the changeset viewer.