Changeset 4686


Ignore:
Timestamp:
6 Jan 2010, 02:21:39 (15 years ago)
Author:
uli
Message:

Remove viewing stuff from hostels. It was not really used yet anyway.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-layout/src/waeup/hostel/hostelcontainer.py

    r4081 r4686  
    33from zope.interface import implementedBy
    44from waeup.interfaces import IHostelContainer, IHostel
    5 from waeup.viewlets import MainArea, Index, Add, FormWrapMixin
    65
    76class HostelContainer(grok.Container):
     
    3635    def getInterfaces(self):
    3736        return implementedBy(HostelContainer)
    38 
    39 
    40 class AddHostelForm(grok.AddForm):
    41     grok.context(IHostelContainer)
    42     form_fields = grok.AutoFields(IHostel)
    43     label = 'Add a hostel'
    44 
    45     @grok.action('Add hostel')
    46     def addHostel(self, **data):
    47         hostel = getUtility(IHostel)
    48         self.applyData(hostel, **data)
    49         try:
    50             self.context.addHostel(hostel)
    51         except DuplicationError:
    52             self.status = Invalid('The name chosen already exists '
    53                                   'in the database')
    54             return
    55         self.redirect(self.url(self.context))
    56 
    57 class AddHostel(FormWrapMixin, grok.Viewlet):
    58     """A viewlet that wraps the `AddHostelForm`.
    59     """
    60     grok.viewletmanager(MainArea)
    61     grok.context(IHostelContainer)
    62     grok.view(Add)
    63     grok.require('waeup.manageUniversity')
    64 
    65     formview_name = 'addhostelform' # The name of the formview we want
    66                                     # to be rendered in this viewlet.
    67 
Note: See TracChangeset for help on using the changeset viewer.