Ignore:
Timestamp:
6 Feb 2009, 16:36:40 (16 years ago)
Author:
uli
Message:

Let AddFaculty? viewlet use the new mixin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/university/facultycontainer.py

    r3884 r3910  
    55from waeup.basecontainer import BaseContainer
    66from waeup.interfaces import IFacultyContainer
    7 from waeup.viewlets import MainArea, LeftSidebar, Index, Add
     7from waeup.viewlets import MainArea, LeftSidebar, Index, Add, FormWrapMixin
    88from interfaces import IFaculty
    99from faculty import Faculty
     
    6969        self.redirect(self.url(self.context))
    7070
    71 class AddFaculty(grok.Viewlet):
     71       
     72class AddFaculty(FormWrapMixin, grok.Viewlet):
    7273    """A viewlet that wraps the `AddFacultyForm`.
    7374    """
     
    7677    grok.view(Add)
    7778    grok.require('waeup.manageUniversity')
    78    
    79     def update(self, **data):
    80         self.form = getMultiAdapter((self.context, self.request),
    81                                     name='addfacultyform')
    82         result = self.form.update_form()
    83         if self.request.method == 'POST':
    84             #app = get_application(self.context)
    85             #self.__parent__.redirect(self.__parent__.url(obj=app))
    86             pass
    87         return
    8879
    89     def render(self):
    90         result = self.form.render()
    91         try:
    92             # strip all except the form part...
    93             result = re.match('^.+\(<form[^\>]+>.*</form>).+$', result,
    94                               re.DOTALL).groups()[0]
    95         except:
    96             # except there is no such part...
    97             pass
    98         return result
     80    formview_name = 'addfacultyform' # The name of the formview we
     81                                     # want to be rendered in this
     82                                     # viewlet.
     83
    9984
    10085class AddFacultyLink(grok.Viewlet):
Note: See TracChangeset for help on using the changeset viewer.