Changeset 3896 for waeup/branches


Ignore:
Timestamp:
30 Jan 2009, 19:01:04 (16 years ago)
Author:
uli
Message:

Make use of the new viewlet form-mixin.

File:
1 edited

Legend:

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

    r3893 r3896  
    66from waeup.interfaces import (IUniversity, IStudentContainer, IHostelContainer,
    77                              IFacultyContainer)
    8 from waeup.viewlets import MainArea, LeftSidebar, Index, Manage
     8from waeup.viewlets import MainArea, LeftSidebar, Index, Manage, FormWrapMixin
    99
    1010class University(grok.Application, grok.Container):
     
    4747        return
    4848
    49 class ManageUniversity(grok.Viewlet):
     49class ManageUniversity(FormWrapMixin, grok.Viewlet):
    5050    """A viewlet that renders the `ManageForm`.
    5151    """
     
    5555    grok.require('waeup.manageUniversity')
    5656   
    57     def update(self):
    58         self.form = getMultiAdapter((self.context, self.request),
    59                                     name='manageform')
    60         self.form.update_form()
    61         if self.request.method == 'POST':
    62             #app = get_application(self.context)
    63             #self.__parent__.redirect(self.__parent__.url(obj=app))
    64             pass
     57    formview_name = 'manageform' # The name of the formview we want to
     58                                 # be rendered in this viewlet.
    6559
    66     def render(self):
    67         result = self.form.render()
    68         try:
    69             # strip all except the form part...
    70             result = re.match('^.+\(<form[^\>]+>.*</form>).+$', result,
    71                               re.DOTALL).groups()[0]
    72         except:
    73             # except there is no such part...
    74             pass
    75         return result
    76         return self.form.render()
    77 
    78    
    79    
    8060class Content(grok.Viewlet):
    8161    grok.viewletmanager(MainArea)
Note: See TracChangeset for help on using the changeset viewer.